From da26ace0383517919e71bb027ab4461b4528ee71 Mon Sep 17 00:00:00 2001 From: mint570 <70396898+mint570@users.noreply.github.com> Date: Mon, 29 Aug 2022 10:11:33 -0700 Subject: [PATCH] Run 20 vs tests at a time. (#1111) In vs test, run 20 tests at a time instead of running all the tests together. This may help in fixing the test issue. --- .../test-docker-sonic-vs-template.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/test-docker-sonic-vs-template.yml b/.azure-pipelines/test-docker-sonic-vs-template.yml index 1447c34e5..69fbb91b6 100644 --- a/.azure-pipelines/test-docker-sonic-vs-template.yml +++ b/.azure-pipelines/test-docker-sonic-vs-template.yml @@ -64,7 +64,22 @@ jobs: docker ps ip netns list pushd sonic-swss/tests - sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) + all_tests=$(ls test_*.py) + all_tests="${all_tests} p4rt" + test_set=() + # Run 20 tests as a set. + for test in ${all_tests}; do + test_set+=("${test}") + if [ ${#test_set[@]} -ge 20 ]; then + test_name=$(echo "${test_set[0]}" | cut -d "." -f 1) + echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) + test_set=() + fi + done + if [ ${#test_set[@]} -gt 0 ]; then + test_name=$(echo "${test_set[0]}" | cut -d "." -f 1) + echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) + fi rm -rf $(Build.ArtifactStagingDirectory)/download displayName: "Run vs tests"