Skip to content

Commit

Permalink
[type:feat] support e2e contain in k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
moremind committed Sep 19, 2023
1 parent 0ca1f7f commit a09f86f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 39 deletions.
15 changes: 5 additions & 10 deletions shenyu-e2e/k8s/script/init/mysql_container_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@
# limitations under the License.

# prepare mysql
bash ./shenyu-e2e/k8s/script/storage/storage_init_mysql.sh

## todo: for test
ls /tmp/shenyu-e2e/mysql/schema
ls /tmp/shenyu-e2e/mysql/driver
## todo: for test
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$(dirname "$curPath")")
echo "$PRGDIR"
bash "${PRGDIR}"/storage/storage_init_mysql.sh

# init kubernetes for mysql
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=`dirname "$(dirname "$curPath")"`
echo $PRGDIR
kubectl apply -f ${PRGDIR}/shenyu-mysql.yml
kubectl apply -f "${PRGDIR}"/shenyu-mysql.yml
sleep 30s
kubectl get pod -o wide

Expand Down
15 changes: 5 additions & 10 deletions shenyu-e2e/k8s/script/init/postgres_container_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@
# limitations under the License.

# prepare mysql
bash ./shenyu-e2e/k8s/script/storage/storage_init_postgres.sh

## todo: for test
ls /tmp/shenyu-e2e/postgres/schema
ls /tmp/shenyu-e2e/postgres/driver
## todo: for test
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=$(dirname "$(dirname "$curPath")")
echo "$PRGDIR"
bash "${PRGDIR}"/storage/storage_init_postgres.sh

# init kubernetes for mysql
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=`dirname "$(dirname "$curPath")"`
echo $PRGDIR
kubectl apply -f ${PRGDIR}/shenyu-postgres.yml
kubectl apply -f "${PRGDIR}"/shenyu-postgres.yml
sleep 30s
kubectl get pod -o wide

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@

# init kubernetes for h2
curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=`dirname "$curPath"`
echo $PRGDIR
kubectl apply -f ${PRGDIR}/shenyu-deployment-h2.yml
kubectl apply -f ${PRGDIR}/shenyu-app-service-h2.yml
PRGDIR=$(dirname "$curPath")
echo "$PRGDIR"
kubectl apply -f "${PRGDIR}"/shenyu-deployment-h2.yml
kubectl apply -f "${PRGDIR}"/shenyu-app-service-h2.yml

sleep 60s

kubectl get pod -o wide

# execute healthcheck.sh
chmod +x ${curPath}/healthcheck.sh
sh ${curPath}/healthcheck.sh h2
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh h2

## run e2e-test

curl -S "http://localhost:31195/actuator/pluginData"

admin_status=`curl -s -o /dev/null -w "%{http_code}" -X GET "http://localhost:31095/actuator/health" -H "accept: */*"`
bootstrap_status=`curl -s -o /dev/null -w "%{http_code}" -X GET "http://localhost:31195/actuator/health" -H "accept: */*"`
admin_status=$(curl -s -o /dev/null -w "%{http_code}" -X GET "http://localhost:31095/actuator/health" -H "accept: */*")
bootstrap_status=$(curl -s -o /dev/null -w "%{http_code}" -X GET "http://localhost:31195/actuator/health" -H "accept: */*")

if [ $admin_status -eq 200 -a $bootstrap_status -eq 200 ]; then
if [ "$admin_status" -eq 200 -a "$bootstrap_status" -eq 200 ]; then
echo -e "Success to send request: $admin_status"
echo -e "Success to send request: $bootstrap_status"
echo -e "\n-------------------"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
echo -e `nc -z -v -w30 shenyu-mysql 30306`

curPath=$(readlink -f "$(dirname "$0")")
PRGDIR=`dirname "$curPath"`
echo $PRGDIR
kubectl apply -f ${PRGDIR}/shenyu-deployment-mysql.yml
kubectl apply -f ${PRGDIR}/shenyu-app-service-mysql.yml
PRGDIR=$(dirname "$curPath")
echo "$PRGDIR"
kubectl apply -f "${PRGDIR}"/shenyu-deployment-mysql.yml
kubectl apply -f "${PRGDIR}"/shenyu-app-service-mysql.yml

kubectl get pod -o wide

sleep 60s

kubectl get pod -o wide

chmod +x ${curPath}/healthcheck.sh
sh ${curPath}/healthcheck.sh mysql
chmod +x "${curPath}"/healthcheck.sh
sh "${curPath}"/healthcheck.sh mysql

Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
# limitations under the License.
#

PRGDIR=`dirname "$0"`
for service in `grep -v -E "^$|^#" ${PRGDIR}/services-"${1}".list`
PRGDIR=$(dirname "$0")

for service in $(grep -v -E "^$|^#" "${PRGDIR}"/services-"${1}".list)
do
for loop in `seq 1 30`
do
status=`curl -o /dev/null -s -w %{http_code} $service`
status=$(curl -o /dev/null -s -w %{http_code} "$service")
echo -e "curl $service response $status"

if [ $status -eq 200 ]; then
if [ "$status" -eq 200 ]; then
break
fi

Expand Down

0 comments on commit a09f86f

Please sign in to comment.