From 1ca2fe5a5131dfac63f756f85ef92ec76310d8e0 Mon Sep 17 00:00:00 2001 From: Jianquan Ye Date: Fri, 12 Jul 2024 11:32:56 +1000 Subject: [PATCH] Revert "Temporarily skip vstest (#891)" (#892) This reverts commit 11c68d8e4260d18997bbe762c46cac933cdbe412. --- .../test-docker-sonic-vs-template.yml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.azure-pipelines/test-docker-sonic-vs-template.yml b/.azure-pipelines/test-docker-sonic-vs-template.yml index 7e23a5758..f26ee4c09 100644 --- a/.azure-pipelines/test-docker-sonic-vs-template.yml +++ b/.azure-pipelines/test-docker-sonic-vs-template.yml @@ -67,6 +67,44 @@ jobs: sudo pip3 install pytest==4.6.2 attrs==19.1.0 exabgp==4.0.10 distro==1.5.0 docker>=4.4.1 redis==3.3.4 flaky==3.7.0 requests==2.31.0 displayName: "Install dependencies" + - script: | + set -ex + sudo docker load -i $(Build.ArtifactStagingDirectory)/download/docker-sonic-vs.gz + docker ps + ip netns list + pushd sonic-swss/tests + + # run pytests in sets of 20 + all_tests=$(ls test_*.py) + all_tests="${all_tests} p4rt" + test_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" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) + container_count=$(docker ps -q -a | wc -l) + if [ ${container_count} -gt 0 ]; then + docker stop $(docker ps -q -a) + docker rm $(docker ps -q -a) + fi + 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" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) + container_count=$(docker ps -q -a | wc -l) + if [ ${container_count} -gt 0 ]; then + docker stop $(docker ps -q -a) + docker rm $(docker ps -q -a) + fi + fi + + rm -rf $(Build.ArtifactStagingDirectory)/download + displayName: "Run vs tests" + ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: + continueOnError: true - task: PublishTestResults@2 inputs: