Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .azure-pipelines/run-test-elastictest-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ steps:
displayName: "Trigger test"

- script: |
set -e
set -o
echo "Lock testbed"

echo -e "\033[33mSONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com \033[0m"
IFS=',' read -ra TEST_PLAN_ID_LIST <<< "$TEST_PLAN_ID_LIST_STRING"
failure_count=0
for TEST_PLAN_ID in "${TEST_PLAN_ID_LIST[@]}"
do
echo -e -n "\033[33mPlease visit Elastictest page \033[0m"
Expand All @@ -244,17 +245,27 @@ steps:
# When "LOCK_TESTBED" finish, it changes into "PREPARE_TESTBED"
echo "[test_plan.py] poll LOCK_TESTBED status"
python ./.azure-pipelines/test_plan.py poll -i $TEST_PLAN_ID --expected-state LOCK_TESTBED
RET=$?
if [ $RET -ne 0 ]; then
((failure_count++))
fi
done

if [ $failure_count -eq ${#TEST_PLAN_ID_LIST[@]} ]; then
echo "All testplan failed, cancel following steps"
exit 3
fi

displayName: "Lock testbed"

- script: |
set -e
set -o
echo "Prepare testbed"
echo "Preparing the testbed(add-topo, deploy-mg) may take 15-30 minutes. Before the testbed is ready, the progress of the test plan keeps displayed as 0, please be patient"

echo -e "\033[33mSONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com \033[0m"
IFS=',' read -ra TEST_PLAN_ID_LIST <<< "$TEST_PLAN_ID_LIST_STRING"
failure_count=0
for TEST_PLAN_ID in "${TEST_PLAN_ID_LIST[@]}"
do
echo -e -n "\033[33mPlease visit Elastictest page \033[0m"
Expand All @@ -263,16 +274,26 @@ steps:
# When "PREPARE_TESTBED" finish, it changes into "EXECUTING"
echo "[test_plan.py] poll PREPARE_TESTBED status"
python ./.azure-pipelines/test_plan.py poll -i $TEST_PLAN_ID --expected-state PREPARE_TESTBED
RET=$?
if [ $RET -ne 0 ]; then
((failure_count++))
fi
done

if [ "$failure_count" -eq ${#TEST_PLAN_ID_LIST[@]} ]; then
echo "All testplan failed, cancel following steps"
exit 3
fi

displayName: "Prepare testbed"

- script: |
set -e
set -o
echo "Run test"

echo -e "\033[33mSONiC PR system-level test is powered by SONiC Elastictest, for any issue, please send email to sonicelastictest@microsoft.com \033[0m"
IFS=',' read -ra TEST_PLAN_ID_LIST <<< "$TEST_PLAN_ID_LIST_STRING"
failure_count=0
for TEST_PLAN_ID in "${TEST_PLAN_ID_LIST[@]}"
do
echo -e -n "\033[33mPlease visit Elastictest page \033[0m"
Expand All @@ -281,8 +302,17 @@ steps:
# When "EXECUTING" finish, it changes into "KVMDUMP", "FAILED", "CANCELLED" or "FINISHED"
echo "[test_plan.py] poll EXECUTING status"
python ./.azure-pipelines/test_plan.py poll -i $TEST_PLAN_ID --expected-state EXECUTING --expected-result ${{ parameters.EXPECTED_RESULT }}
RET=$?
if [ $RET -ne 0 ]; then
((failure_count++))
fi
done

if [ $failure_count -eq ${#TEST_PLAN_ID_LIST[@]} ]; then
echo "All testplan failed, cancel following steps"
exit 3
fi

displayName: "Run test"
timeoutInMinutes: ${{ parameters.MAX_RUN_TEST_MINUTES }}

Expand Down