diff options
| author | gy95 <guoyao17@huawei.com> | 2022-09-06 11:27:09 +0800 |
|---|---|---|
| committer | gy95 <guoyao17@huawei.com> | 2022-09-06 16:52:56 +0800 |
| commit | 863830172432328a393840846e486924707c54a4 (patch) | |
| tree | 4b817f5a4f28181cb64889a91d872f97a76e6330 | |
| parent | Merge pull request #4150 from Shelley-BaoYue/master-metalog (diff) | |
| download | kubeedge-863830172432328a393840846e486924707c54a4.tar.gz | |
fix e2e failure not report
Signed-off-by: gy95 <guoyao17@huawei.com>
| -rwxr-xr-x | edge/test/integration/scripts/execute.sh | 17 | ||||
| -rwxr-xr-x | edge/test/integration/scripts/fast_test.sh | 28 | ||||
| -rwxr-xr-x | tests/e2e/scripts/execute.sh | 21 | ||||
| -rwxr-xr-x | tests/e2e/scripts/fast_test.sh | 16 | ||||
| -rwxr-xr-x | tests/e2e/scripts/keadm_deprecated_e2e.sh | 23 | ||||
| -rwxr-xr-x | tests/e2e/scripts/keadm_e2e.sh | 17 |
6 files changed, 44 insertions, 78 deletions
diff --git a/edge/test/integration/scripts/execute.sh b/edge/test/integration/scripts/execute.sh index 186e6f697..60af398e6 100755 --- a/edge/test/integration/scripts/execute.sh +++ b/edge/test/integration/scripts/execute.sh @@ -47,23 +47,6 @@ function run_test() { local module=$1 MQTT_SERVER=127.0.0.1 bash -x ${TEST_DIR}/scripts/fast_test.sh $module - - grep -e "Running Suite" -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | sed -r 's/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' - echo "Integration Test Final Summary Report" - echo "===============================================" - echo "Total Number of Test cases = `grep "Ran " /tmp/testcase.log | awk '{sum+=$2} END {print sum}'`" - passed=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $3}' | sed -r "s/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` - echo "Number of Test cases PASSED = $passed" - fail=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $6}' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` - echo "Number of Test cases FAILED = $fail" - echo "==================Result Summary=======================" - if [ "$fail" != "0" ];then - echo "Integration suite has failures, Please check !!" - exit 1 - else - echo "Integration suite successfully passed all the tests !!" - exit 0 - fi } set -eE diff --git a/edge/test/integration/scripts/fast_test.sh b/edge/test/integration/scripts/fast_test.sh index 2de3e0090..1af5b0555 100755 --- a/edge/test/integration/scripts/fast_test.sh +++ b/edge/test/integration/scripts/fast_test.sh @@ -34,13 +34,33 @@ cat >config.json<<END } END +GINKGO_EXIT_CODE=0 if [[ $# -eq 0 ]]; then #run testcase export KUBEEDGE_ROOT=$KUBEEDGE_ROOT - ./appdeployment/appdeployment.test $debugflag 2>&1 | tee -a /tmp/testcase.log - ./device/device.test $debugflag 2>&1 | tee -a /tmp/testcase.log - ./metaserver/metaserver.test $debugflag 2>&1 | tee -a /tmp/testcase.log + ./appdeployment/appdeployment.test $debugflag + if [[ $? != 0 ]]; then + GINKGO_EXIT_CODE=1 + fi + ./device/device.test $debugflag + if [[ $? != 0 ]]; then + GINKGO_EXIT_CODE=1 + fi + ./metaserver/metaserver.test $debugflag + if [[ $? != 0 ]]; then + GINKGO_EXIT_CODE=1 + fi else - ./$compilemodule/$compilemodule.test $debugflag $runtest 2>&1 | tee -a /tmp/testcase.log + ./$compilemodule/$compilemodule.test $debugflag $runtest + if [[ $? != 0 ]]; then + GINKGO_EXIT_CODE=1 + fi fi +if [[ $GINKGO_EXIT_CODE != 0 ]]; then + echo "Integration suite has failures, Please check !!" + exit 1 +else + echo "Integration suite successfully passed all the tests !!" + exit 0 +fi diff --git a/tests/e2e/scripts/execute.sh b/tests/e2e/scripts/execute.sh index ac6703ea2..077a9ae21 100755 --- a/tests/e2e/scripts/execute.sh +++ b/tests/e2e/scripts/execute.sh @@ -66,25 +66,8 @@ kubectl create clusterrolebinding system:anonymous --clusterrole=cluster-admin - :> /tmp/testcase.log -bash -x ${E2E_DIR}/scripts/fast_test.sh $1 - -#stop the edgecore after the test completion -grep -e "Running Suite" -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | sed -r 's/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' -echo "Integration Test Final Summary Report" -echo "===============================================" -echo "Total Number of Test cases = `grep "Ran " /tmp/testcase.log | awk '{sum+=$2} END {print sum}'`" -passed=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $3}' | sed -r "s/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` -echo "Number of Test cases PASSED = $passed" -fail=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $6}' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` -echo "Number of Test cases FAILED = $fail" -echo "==================Result Summary=======================" +export GINKGO_TESTING_RESULT=0 trap cleanup EXIT -if [ "$fail" != "0" ];then - echo "Integration suite has failures, Please check !!" - exit 1 -else - echo "Integration suite successfully passed all the tests !!" - exit 0 -fi +bash -x ${E2E_DIR}/scripts/fast_test.sh $1 diff --git a/tests/e2e/scripts/fast_test.sh b/tests/e2e/scripts/fast_test.sh index 47014e614..89f3748cf 100755 --- a/tests/e2e/scripts/fast_test.sh +++ b/tests/e2e/scripts/fast_test.sh @@ -36,14 +36,22 @@ then --image-url=nginx \ --kube-master="https://$MASTER_IP:6443" \ --kubeconfig=$KUBECONFIG \ - --test.v \ - 2>&1 | tee -a /tmp/testcase.log + --test.v + GINKGO_TESTING_RESULT=$? else ginkgo -v ./$compilemodule/$compilemodule.test -- \ --image-url=nginx \ --image-url=nginx \ --kube-master="https://$MASTER_IP:6443" \ --kubeconfig=$KUBECONFIG \ - --test.v \ - 2>&1 | tee -a /tmp/testcase.log + --test.v + GINKGO_TESTING_RESULT=$? +fi + +if [[ $GINKGO_TESTING_RESULT != 0 ]]; then + echo "Integration suite has failures, Please check !!" + exit 1 +else + echo "Integration suite successfully passed all the tests !!" + exit 0 fi diff --git a/tests/e2e/scripts/keadm_deprecated_e2e.sh b/tests/e2e/scripts/keadm_deprecated_e2e.sh index 087fe323a..8517a6839 100755 --- a/tests/e2e/scripts/keadm_deprecated_e2e.sh +++ b/tests/e2e/scripts/keadm_deprecated_e2e.sh @@ -87,25 +87,10 @@ function run_test() { --image-url=nginx \ --kube-master="https://$MASTER_IP:6443" \ --kubeconfig=$KUBECONFIG \ - --test.v \ - 2>&1 | tee -a /tmp/testcase.log - - #stop the edgecore after the test completion - grep -e "Running Suite" -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | sed -r 's/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' - echo "Integration Test Final Summary Report" - echo "=======================================================" - echo "Total Number of Test cases = `grep "Ran " /tmp/testcase.log | awk '{sum+=$2} END {print sum}'`" - passed=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $3}' | sed -r "s/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` - echo "Number of Test cases PASSED = $passed" - fail=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $6}' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` - echo "Number of Test cases FAILED = $fail" - echo "==================Result Summary=======================" - - if [ "$fail" != "0" ];then - echo "Integration suite has failures, Please check !!" - exit 1 - else - echo "Integration suite successfully passed all the tests !!" + --test.v + if [[ $? != 0 ]]; then + echo "Integration suite has failures, Please check !!" + exit 1 fi } diff --git a/tests/e2e/scripts/keadm_e2e.sh b/tests/e2e/scripts/keadm_e2e.sh index df462375a..ac26d4927 100755 --- a/tests/e2e/scripts/keadm_e2e.sh +++ b/tests/e2e/scripts/keadm_e2e.sh @@ -90,21 +90,8 @@ function run_test() { --image-url=nginx \ --kube-master="https://$MASTER_IP:6443" \ --kubeconfig=$KUBECONFIG \ - --test.v \ - 2>&1 | tee -a /tmp/testcase.log - - #stop the edgecore after the test completion - grep -e "Running Suite" -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | sed -r 's/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' | sed -r 's/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g' - echo "Integration Test Final Summary Report" - echo "=======================================================" - echo "Total Number of Test cases = `grep "Ran " /tmp/testcase.log | awk '{sum+=$2} END {print sum}'`" - passed=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $3}' | sed -r "s/\x1B\[([0-9];)?([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` - echo "Number of Test cases PASSED = $passed" - fail=`grep -e "SUCCESS\!" -e "FAIL\!" /tmp/testcase.log | awk '{print $6}' | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" | awk '{sum+=$1} END {print sum}'` - echo "Number of Test cases FAILED = $fail" - echo "==================Result Summary=======================" - - if [ "$fail" != "0" ];then + --test.v + if [[ $? != 0 ]]; then echo "Integration suite has failures, Please check !!" exit 1 else |
