Skip to content

Commit

Permalink
add ingore object type to CountSubscribedObjects
Browse files Browse the repository at this point in the history
Signed-off-by: Guohan Lu <gulv@microsoft.com>
  • Loading branch information
lguohan committed Oct 22, 2018
1 parent 5e2c1de commit d76a560
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,18 @@ def SubscribeAsicDbObject(self, objpfx):
pubsub.psubscribe("__keyspace@1__:ASIC_STATE:%s*" % objpfx)
return pubsub

def CountSubscribedObjects(self, pubsub, timeout=10):
def CountSubscribedObjects(self, pubsub, ignore=None, timeout=10):
nadd = 0
ndel = 0
idle = 0
while True and idle < timeout:
message = pubsub.get_message()
if message:
print message
if ignore:
fds = message['channel'].split(':')
if fds[2] in ignore:
continue
if message['data'] == 'hset':
nadd += 1
elif message['data'] == 'del':
Expand Down
2 changes: 1 addition & 1 deletion tests/test_warm_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def test_VlanMgrdWarmRestart(dvs):
(exitcode, bv_after) = dvs.runcmd("bridge vlan")
assert bv_after == bv_before

(nadd, ndel) = dvs.CountSubscribedObjects(pubsub)
(nadd, ndel) = dvs.CountSubscribedObjects(pubsub, ignore=["SAI_OBJECT_TYPE_FDB_ENTRY"])
assert nadd == 0
assert ndel == 0

Expand Down

0 comments on commit d76a560

Please sign in to comment.