diff --git a/tests/README.md b/tests/README.md index 27b5e1f35022..e4ebaa40ea7b 100644 --- a/tests/README.md +++ b/tests/README.md @@ -8,7 +8,7 @@ SWSS Integration tests runs on docker-sonic-vs which runs on top of SAI virtual - Install docker and pytest on your dev machine ``` - sudo pip install --system docker==2.6.1 + sudo pip install --system docker==3.5.0 sudo pip install --system pytest==3.3.0 ``` - 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. diff --git a/tests/conftest.py b/tests/conftest.py index bfd6d6fbaceb..da8d49d2e1b2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -172,7 +172,11 @@ def check_ready(self, timeout=30): started = 0 while True: # get process status - out = self.ctn.exec_run("supervisorctl status") + res = self.ctn.exec_run("supervisorctl status") + try: + out = res.output + except AttributeError: + out = res for l in out.split('\n'): fds = re_space.split(l) if len(fds) < 2: @@ -204,7 +208,14 @@ def init_asicdb_validator(self): self.asicdb = AsicDbValidator(self) def runcmd(self, cmd): - return self.ctn.exec_run(cmd) + res = self.ctn.exec_run(cmd) + try: + exitcode = res.exit_code + out = res.output + except AttributeError: + exitcode = 0 + out = res + return (exitcode, out) @pytest.yield_fixture(scope="module") def dvs(request): diff --git a/tests/test_warm_reboot.py b/tests/test_warm_reboot.py index 13902d1f2b84..87499139ca76 100644 --- a/tests/test_warm_reboot.py +++ b/tests/test_warm_reboot.py @@ -169,7 +169,7 @@ def test_VlanMgrdWarmRestart(dvs): assert status == True - bv_before = dvs.runcmd("bridge vlan") + (exitcode, bv_before) = dvs.runcmd("bridge vlan") print(bv_before) restart_count = swss_get_RestartCount(state_db) @@ -178,15 +178,15 @@ def test_VlanMgrdWarmRestart(dvs): dvs.runcmd(['sh', '-c', 'supervisorctl start vlanmgrd']) time.sleep(2) - bv_after = dvs.runcmd("bridge vlan") + (exitcode, bv_after) = dvs.runcmd("bridge vlan") assert bv_after == bv_before # No create/set/remove operations should be passed down to syncd for vlanmgr warm restart - num = dvs.runcmd(['sh', '-c', 'grep \|c\| /var/log/swss/sairedis.rec | wc -l']) + (exitcode, num) = dvs.runcmd(['sh', '-c', 'grep \|c\| /var/log/swss/sairedis.rec | wc -l']) assert num == '0\n' - num = dvs.runcmd(['sh', '-c', 'grep \|s\| /var/log/swss/sairedis.rec | wc -l']) + (exitcode, num) = dvs.runcmd(['sh', '-c', 'grep \|s\| /var/log/swss/sairedis.rec | wc -l']) assert num == '0\n' - num = dvs.runcmd(['sh', '-c', 'grep \|r\| /var/log/swss/sairedis.rec | wc -l']) + (exitcode, num) = dvs.runcmd(['sh', '-c', 'grep \|r\| /var/log/swss/sairedis.rec | wc -l']) assert num == '0\n' #new ip on server 5