Skip to content

Commit a52b210

Browse files
authored
support to use python docker 3.5.0 (sonic-net#585)
* support to use python docker 3.5.0 start from docker 3.0.0, results from exec_run changed to dict(outout, code) Signed-off-by: Guohan Lu <gulv@microsoft.com> * limit the scope of exception Signed-off-by: Guohan Lu <gulv@microsoft.com> * modify runcmd output to include exitcode Signed-off-by: Guohan Lu <gulv@microsoft.com>
1 parent cb28e4a commit a52b210

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

tests/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SWSS Integration tests runs on docker-sonic-vs which runs on top of SAI virtual
88

99
- Install docker and pytest on your dev machine
1010
```
11-
sudo pip install --system docker==2.6.1
11+
sudo pip install --system docker==3.5.0
1212
sudo pip install --system pytest==3.3.0
1313
```
1414
- Compile and install swss common library. Follow instructions [here](https://github.com/Azure/sonic-swss-common/blob/master/README.md) to first install prerequisites to build swss common library.

tests/conftest.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ def check_ready(self, timeout=30):
172172
started = 0
173173
while True:
174174
# get process status
175-
out = self.ctn.exec_run("supervisorctl status")
175+
res = self.ctn.exec_run("supervisorctl status")
176+
try:
177+
out = res.output
178+
except AttributeError:
179+
out = res
176180
for l in out.split('\n'):
177181
fds = re_space.split(l)
178182
if len(fds) < 2:
@@ -204,7 +208,14 @@ def init_asicdb_validator(self):
204208
self.asicdb = AsicDbValidator(self)
205209

206210
def runcmd(self, cmd):
207-
return self.ctn.exec_run(cmd)
211+
res = self.ctn.exec_run(cmd)
212+
try:
213+
exitcode = res.exit_code
214+
out = res.output
215+
except AttributeError:
216+
exitcode = 0
217+
out = res
218+
return (exitcode, out)
208219

209220
@pytest.yield_fixture(scope="module")
210221
def dvs(request):

tests/test_warm_reboot.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def test_VlanMgrdWarmRestart(dvs):
169169
assert status == True
170170

171171

172-
bv_before = dvs.runcmd("bridge vlan")
172+
(exitcode, bv_before) = dvs.runcmd("bridge vlan")
173173
print(bv_before)
174174

175175
restart_count = swss_get_RestartCount(state_db)
@@ -178,15 +178,15 @@ def test_VlanMgrdWarmRestart(dvs):
178178
dvs.runcmd(['sh', '-c', 'supervisorctl start vlanmgrd'])
179179
time.sleep(2)
180180

181-
bv_after = dvs.runcmd("bridge vlan")
181+
(exitcode, bv_after) = dvs.runcmd("bridge vlan")
182182
assert bv_after == bv_before
183183

184184
# No create/set/remove operations should be passed down to syncd for vlanmgr warm restart
185-
num = dvs.runcmd(['sh', '-c', 'grep \|c\| /var/log/swss/sairedis.rec | wc -l'])
185+
(exitcode, num) = dvs.runcmd(['sh', '-c', 'grep \|c\| /var/log/swss/sairedis.rec | wc -l'])
186186
assert num == '0\n'
187-
num = dvs.runcmd(['sh', '-c', 'grep \|s\| /var/log/swss/sairedis.rec | wc -l'])
187+
(exitcode, num) = dvs.runcmd(['sh', '-c', 'grep \|s\| /var/log/swss/sairedis.rec | wc -l'])
188188
assert num == '0\n'
189-
num = dvs.runcmd(['sh', '-c', 'grep \|r\| /var/log/swss/sairedis.rec | wc -l'])
189+
(exitcode, num) = dvs.runcmd(['sh', '-c', 'grep \|r\| /var/log/swss/sairedis.rec | wc -l'])
190190
assert num == '0\n'
191191

192192
#new ip on server 5

0 commit comments

Comments
 (0)