Skip to content

Commit 13dcb83

Browse files
authored
Revert "[kvm] Use run_tests.sh script in sonic-mgmt to run PR tests (sonic-net#139)" (sonic-net#142)
This reverts commit b52807c.
1 parent b52807c commit 13dcb83

File tree

8 files changed

+78
-51
lines changed

8 files changed

+78
-51
lines changed

jenkins/mgmt/sonic-mgmt-canary/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pipeline {
3939

4040
post {
4141
always {
42-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/logs/**/tr.xml')
43-
archiveArtifacts(artifacts: 'sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
42+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
43+
archiveArtifacts(artifacts: 'sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
4444
}
4545
}
4646
}

jenkins/mgmt/sonic-mgmt-pr/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ pipeline {
3636

3737
post {
3838
always {
39-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/logs/**/tr.xml')
40-
archiveArtifacts(artifacts: 'sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
39+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
40+
archiveArtifacts(artifacts: 'sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
4141
}
4242
}
4343
}

jenkins/vs/buildimage-vs-image-201911-test/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pipeline {
6767
post {
6868

6969
always {
70-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/logs/**/tr.xml')
71-
archiveArtifacts(artifacts: 'sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
70+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
71+
archiveArtifacts(artifacts: 'sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
7272
}
7373

7474
fixed {

jenkins/vs/buildimage-vs-image-pr/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ sudo cp ../target/sonic-vs.bin /nfs/jenkins/sonic-vs-${JOB_NAME##*/}.${BUILD_NUM
8787

8888
post {
8989
always {
90-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/logs/**/tr.xml')
91-
archiveArtifacts(artifacts: 'target/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
90+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
91+
archiveArtifacts(artifacts: 'target/**, sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
9292
}
9393
}
9494
}

jenkins/vs/buildimage-vs-image-test/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pipeline {
6767
post {
6868

6969
always {
70-
archiveArtifacts(artifacts: 'sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
71-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/logs/**/tr.xml')
70+
archiveArtifacts(artifacts: 'sonic-mgmt/tests/logs/**, sonic-mgmt/tests/results/**, kvmdump/**, ptfdump/**')
71+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
7272
}
7373

7474
fixed {

jenkins/vs/buildimage-vs-image/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ sudo cp ../target/sonic-vs-dbg.bin /nfs/jenkins/sonic-vs-dbg-${JOB_NAME##*/}.${B
100100

101101
post {
102102
always {
103-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/logs/**/tr.xml')
104-
archiveArtifacts(artifacts: 'target/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
103+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml')
104+
archiveArtifacts(artifacts: 'target/**, sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**, kvmdump/**, ptfdump/**')
105105
}
106106
}
107107

+65-38
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
#!/bin/bash -xe
22

33
tbname=$1
4-
dut=$2
4+
5+
run_pytest()
6+
{
7+
tgname=$1
8+
shift
9+
tests=$@
10+
11+
echo "run tests: $tests"
12+
13+
mkdir -p logs/$tgname
14+
for tn in ${tests}; do
15+
tdir=$(dirname $tn)
16+
if [ $tdir != "." ]; then
17+
mkdir -p logs/$tgname/$tdir
18+
mkdir -p results/$tgname/$tdir
19+
fi
20+
py.test $PYTEST_COMMON_OPTS --log-file logs/$tgname/$tn.log --junitxml=results/$tgname/$tn.xml $tn.py
21+
done
22+
}
523

624
cd $HOME
725
mkdir -p .ssh
@@ -22,59 +40,68 @@ export ANSIBLE_LIBRARY=/data/sonic-mgmt/ansible/library/
2240
# workaround for issue https://github.com/Azure/sonic-mgmt/issues/1659
2341
export export ANSIBLE_KEEP_REMOTE_FILES=1
2442

25-
PYTEST_CLI_COMMON_OPTS="\
26-
-i veos.vtb \
27-
-d $dut \
28-
-n $tbname \
29-
-f vtestbed.csv \
30-
-k debug \
31-
-l warning \
32-
-m group \
33-
-e --disable_loganalyzer
34-
"
43+
PYTEST_COMMON_OPTS="--inventory veos.vtb \
44+
--host-pattern all \
45+
--user admin \
46+
-vvv \
47+
--show-capture stdout \
48+
--testbed $tbname \
49+
--testbed_file vtestbed.csv \
50+
--disable_loganalyzer \
51+
--log-file-level debug"
3552

53+
# Check testbed health
3654
cd /data/sonic-mgmt/tests
37-
rm -rf logs
55+
rm -rf logs results
3856
mkdir -p logs
57+
mkdir -p results
58+
py.test $PYTEST_COMMON_OPTS --log-file logs/test_nbr_health.log --junitxml=results/tr.xml test_nbr_health.py
3959

40-
# Run tests_1vlan on vlab-01 virtual switch
41-
# TODO: Use a marker to select these tests rather than providing a hard-coded list here.
60+
# Run anounce route test case in order to populate BGP route
61+
py.test $PYTEST_COMMON_OPTS --log-file logs/test_announce_routes.log --junitxml=results/tr.xml test_announce_routes.py
62+
63+
# Tests to run using one vlan configuration
4264
tgname=1vlan
4365
tests="\
44-
test_interfaces.py \
45-
bgp/test_bgp_fact.py \
46-
bgp/test_bgp_gr_helper.py \
47-
bgp/test_bgp_speaker.py \
48-
cacl/test_cacl_application.py \
49-
cacl/test_cacl_function.py \
50-
dhcp_relay/test_dhcp_relay.py \
51-
lldp/test_lldp.py \
52-
ntp/test_ntp.py \
53-
pc/test_po_update.py \
54-
route/test_default_route.py \
55-
snmp/test_snmp_cpu.py \
56-
snmp/test_snmp_interfaces.py \
57-
snmp/test_snmp_lldp.py \
58-
snmp/test_snmp_pfc_counters.py \
59-
snmp/test_snmp_queue.py \
60-
syslog/test_syslog.py \
61-
tacacs/test_rw_user.py \
62-
tacacs/test_ro_user.py \
63-
telemetry/test_telemetry.py"
66+
test_interfaces \
67+
pc/test_po_update \
68+
bgp/test_bgp_fact \
69+
lldp/test_lldp \
70+
route/test_default_route \
71+
bgp/test_bgp_speaker \
72+
bgp/test_bgp_gr_helper \
73+
dhcp_relay/test_dhcp_relay \
74+
syslog/test_syslog \
75+
tacacs/test_rw_user \
76+
tacacs/test_ro_user \
77+
ntp/test_ntp \
78+
cacl/test_cacl_application \
79+
cacl/test_cacl_function \
80+
telemetry/test_telemetry \
81+
snmp/test_snmp_cpu \
82+
snmp/test_snmp_interfaces \
83+
snmp/test_snmp_lldp \
84+
snmp/test_snmp_pfc_counters \
85+
snmp/test_snmp_queue
86+
"
6487

88+
# Run tests_1vlan on vlab-01 virtual switch
6589
pushd /data/sonic-mgmt/tests
66-
./run_tests.sh $PYTEST_CLI_COMMON_OPTS -c "$tests" -p logs/$tgname
90+
run_pytest $tgname $tests
6791
popd
6892

6993
# Create and deploy two vlan configuration (two_vlan_a) to the virtual switch
7094
cd /data/sonic-mgmt/ansible
7195
./testbed-cli.sh -m veos.vtb -t vtestbed.csv deploy-mg $tbname lab password.txt -e vlan_config=two_vlan_a
7296
sleep 180
7397

74-
# Run tests_2vlans on vlab-01 virtual switch
98+
# Tests to run using two vlan configuration
7599
tgname=2vlans
76-
tests="dhcp_relay/test_dhcp_relay.py"
100+
tests="\
101+
dhcp_relay/test_dhcp_relay \
102+
"
77103

104+
# Run tests_2vlans on vlab-01 virtual switch
78105
pushd /data/sonic-mgmt/tests
79-
./run_tests.sh $PYTEST_CLI_COMMON_OPTS -c "$tests" -p logs/$tgname
106+
run_pytest $tgname $tests
80107
popd

scripts/vs/buildimage-vs-image/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cd sonic-mgmt/ansible
2828
sed -i s:use_own_value:johnar: veos.vtb
2929
echo abc > password.txt
3030
cd ../../
31-
docker run --rm=true -v $(pwd):/data -w /data -i sonicdev-microsoft.azurecr.io:443/docker-sonic-mgmt ./scripts/vs/buildimage-vs-image/runtest.sh $tbname $dut
31+
docker run --rm=true -v $(pwd):/data -w /data -i sonicdev-microsoft.azurecr.io:443/docker-sonic-mgmt ./scripts/vs/buildimage-vs-image/runtest.sh $tbname
3232

3333
# save dut state if test fails
3434
if [ $? != 0 ]; then

0 commit comments

Comments
 (0)