Skip to content

Commit 2ff763f

Browse files
authored
Fix test_warm_reboot issues blocking PR merge (sonic-net#2309)
* Two fixes: sleep after stop and check values in routes
1 parent 05d19ea commit 2ff763f

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

tests/conftest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ def stop_swss(self):
658658
for pname in self.swssd:
659659
cmd += "supervisorctl stop {}; ".format(pname)
660660
self.runcmd(['sh', '-c', cmd])
661+
time.sleep(5)
661662

662663
# deps: warm_reboot
663664
def start_zebra(self):
@@ -669,7 +670,7 @@ def start_zebra(self):
669670
# deps: warm_reboot
670671
def stop_zebra(self):
671672
self.runcmd(['sh', '-c', 'pkill -9 zebra'])
672-
time.sleep(1)
673+
time.sleep(5)
673674

674675
# deps: warm_reboot
675676
def start_fpmsyncd(self):

tests/test_warm_reboot.py

+19-9
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,14 @@ def how_many_entries_exist(db, table):
118118

119119
def stop_neighsyncd(dvs):
120120
dvs.runcmd(['sh', '-c', 'pkill -x neighsyncd'])
121+
time.sleep(1)
121122

122123
def start_neighsyncd(dvs):
123124
dvs.runcmd(['sh', '-c', 'supervisorctl start neighsyncd'])
124125

125126
def stop_restore_neighbors(dvs):
126127
dvs.runcmd(['sh', '-c', 'pkill -x restore_neighbors'])
128+
time.sleep(1)
127129

128130
def start_restore_neighbors(dvs):
129131
dvs.runcmd(['sh', '-c', 'supervisorctl start restore_neighbors'])
@@ -307,6 +309,7 @@ def test_PortSyncdWarmRestart(self, dvs, testlog):
307309

308310
# restart portsyncd
309311
dvs.runcmd(['sh', '-c', 'pkill -x portsyncd'])
312+
time.sleep(1)
310313

311314
pubsub = dvs.SubscribeAsicDbObject("SAI_OBJECT_TYPE")
312315
dvs.runcmd(['sh', '-c', 'supervisorctl start portsyncd'])
@@ -343,7 +346,6 @@ def test_PortSyncdWarmRestart(self, dvs, testlog):
343346
intf_tbl._del("Ethernet20")
344347
time.sleep(2)
345348

346-
347349
def test_VlanMgrdWarmRestart(self, dvs, testlog):
348350

349351
conf_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
@@ -427,6 +429,7 @@ def test_VlanMgrdWarmRestart(self, dvs, testlog):
427429
restore_count = swss_get_RestoreCount(dvs, state_db)
428430

429431
dvs.runcmd(['sh', '-c', 'pkill -x vlanmgrd'])
432+
time.sleep(1)
430433

431434
pubsub = dvs.SubscribeAsicDbObject("SAI_OBJECT_TYPE")
432435

@@ -1075,7 +1078,6 @@ def test_swss_port_state_syncup(self, dvs, testlog):
10751078
#
10761079
################################################################################
10771080

1078-
10791081
def test_routing_WarmRestart(self, dvs, testlog):
10801082

10811083
appl_db = swsscommon.DBConnector(swsscommon.APPL_DB, dvs.redis_sock, 0)
@@ -1261,7 +1263,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
12611263
rt_key = json.loads(addobjs[0]['key'])
12621264
rt_val = json.loads(addobjs[0]['vals'])
12631265
assert rt_key == "192.168.100.0/24"
1264-
assert rt_val == {"ifname": "Ethernet0", "nexthop": "111.0.0.2"}
1266+
assert rt_val.get("ifname") == "Ethernet0"
1267+
assert rt_val.get("nexthop") == "111.0.0.2"
12651268

12661269
# Verify the changed prefix is seen in sairedis
12671270
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -1333,7 +1336,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
13331336
rt_key = json.loads(addobjs[0]['key'])
13341337
rt_val = json.loads(addobjs[0]['vals'])
13351338
assert rt_key == "192.168.200.0/24"
1336-
assert rt_val == {"ifname": "Ethernet0,Ethernet4,Ethernet8", "nexthop": "111.0.0.2,122.0.0.2,133.0.0.2"}
1339+
assert rt_val.get("ifname") == "Ethernet0,Ethernet4,Ethernet8"
1340+
assert rt_val.get("nexthop") == "111.0.0.2,122.0.0.2,133.0.0.2"
13371341

13381342
# Verify the changed prefix is seen in sairedis
13391343
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -1406,7 +1410,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
14061410
rt_key = json.loads(addobjs[0]['key'])
14071411
rt_val = json.loads(addobjs[0]['vals'])
14081412
assert rt_key == "192.168.1.3"
1409-
assert rt_val == {"ifname": "Ethernet0,Ethernet4,Ethernet8", "nexthop": "111.0.0.2,122.0.0.2,133.0.0.2"}
1413+
assert rt_val.get("ifname") == "Ethernet0,Ethernet4,Ethernet8"
1414+
assert rt_val.get("nexthop") == "111.0.0.2,122.0.0.2,133.0.0.2"
14101415

14111416
# Verify the changed prefix is seen in sairedis
14121417
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -1444,7 +1449,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
14441449
rt_key = json.loads(addobjs[0]['key'])
14451450
rt_val = json.loads(addobjs[0]['vals'])
14461451
assert rt_key == "192.168.1.3"
1447-
assert rt_val == {"ifname": "Ethernet0,Ethernet4", "nexthop": "111.0.0.2,122.0.0.2"}
1452+
assert rt_val.get("ifname") == "Ethernet0,Ethernet4"
1453+
assert rt_val.get("nexthop") == "111.0.0.2,122.0.0.2"
14481454

14491455
# Verify the changed prefix is seen in sairedis
14501456
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -1481,7 +1487,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
14811487
rt_key = json.loads(addobjs[0]['key'])
14821488
rt_val = json.loads(addobjs[0]['vals'])
14831489
assert rt_key == "fc00:4:4::1"
1484-
assert rt_val == {"ifname": "Ethernet0", "nexthop": "1110::2"}
1490+
assert rt_val.get("ifname") == "Ethernet0"
1491+
assert rt_val.get("nexthop") == "1110::2"
14851492

14861493
# Verify the changed prefix is seen in sairedis
14871494
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -1579,7 +1586,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
15791586
rt_key = json.loads(addobjs[0]['key'])
15801587
rt_val = json.loads(addobjs[0]['vals'])
15811588
assert rt_key == "192.168.100.0/24"
1582-
assert rt_val == {"ifname": "Ethernet0", "nexthop": "111.0.0.2"}
1589+
assert rt_val.get("ifname") == "Ethernet0"
1590+
assert rt_val.get("nexthop") == "111.0.0.2"
15831591

15841592
# Verify the changed prefix is seen in sairedis
15851593
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -1691,7 +1699,8 @@ def test_routing_WarmRestart(self, dvs, testlog):
16911699
rt_key = json.loads(addobjs[0]['key'])
16921700
rt_val = json.loads(addobjs[0]['vals'])
16931701
assert rt_key == "192.168.100.0/24"
1694-
assert rt_val == {"ifname": "Ethernet4", "nexthop": "122.0.0.2"}
1702+
assert rt_val.get("ifname") == "Ethernet4"
1703+
assert rt_val.get("nexthop") == "122.0.0.2"
16951704

16961705
# Verify the changed prefix is seen in sairedis
16971706
(addobjs, delobjs) = dvs.GetSubscribedAsicDbObjects(pubsubAsicDB)
@@ -2172,6 +2181,7 @@ def test_VrfMgrdWarmRestart(self, dvs, testlog):
21722181
(exitcode, vrf_before) = dvs.runcmd(['sh', '-c', "ip link show | grep Vrf"])
21732182

21742183
dvs.runcmd(['sh', '-c', 'pkill -x vrfmgrd'])
2184+
time.sleep(1)
21752185

21762186
pubsub = dvs.SubscribeAsicDbObject("SAI_OBJECT_TYPE")
21772187

0 commit comments

Comments
 (0)