You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test_compare_snapshots unittest for "bgp_peers" fail occasionally. The bgp_peers snapshot have multiple levels which we don't support in snapshot comparison currently. When comparison snapshots it randomly finds out the lowest level of the dictionary and when snapshot have multiple levels provided properties isn't found and comparison shows diff for all the dictionary instead of only the requested properties.
Current behavior
Need to run unittest multiple times since it randomly gets into different levels of the dict.
> pytest -k test_compare_snapshots
def test_compare_snapshots(self, reports, expected_result):
snapshot_compare = SnapshotCompare(snap1, snap2)
result = snapshot_compare.compare_snapshots(reports)
> assert not DeepDiff(
result, expected_result, ignore_order=True
) # assert == doesnt work for nested objects and unordered lists
E AssertionError: assert not {'dictionary_item_removed': [root['bgp_peers']['changed']['changed_raw']['default_Peer-Group1_Peer1']['changed']['chan...out'], root['bgp_peers']['changed']['changed_raw']['default_Peer-Group1_Peer1']['changed']['changed_raw']['holdtime']]}
E + where {'dictionary_item_removed': [root['bgp_peers']['changed']['changed_raw']['default_Peer-Group1_Peer1']['changed']['chan...out'], root['bgp_peers']['changed']['changed_raw']['default_Peer-Group1_Peer1']['changed']['changed_raw']['holdtime']]} = DeepDiff({'bgp_peers': {'added': {'added_keys': [], 'passed': True}, 'changed': {'changed_raw': {'default_Peer-Group1_Peer1': {...passed': True}, 'passed': False}}, 'passed': False}, 'missing': {'missing_keys': [], 'passed': True}, 'passed': False}}, {'bgp_peers': {'added': {'added_keys': [], 'passed': True}, 'changed': {'changed_raw': {'default_Peer-Group1_Peer1': {...passed': True}, 'passed': False}}, 'passed': False}, 'missing': {'missing_keys': [], 'passed': True}, 'passed': False}}, ignore_order=True)
tests/test_snapshot_compare.py:477: AssertionError
============================================================================================= short test summary info =============================================================================================
FAILED tests/test_snapshot_compare.py::TestSnapshotCompare::test_compare_snapshots[reports4-expected_result4] - AssertionError: assert not {'dictionary_item_removed': [root['bgp_peers']['changed']['changed_raw']['default_Peer-Group1_Peer1']['changed']['chan...out'], root['bgp_peers']['changed']['changed_raw']['defaul...=================================================================================== 1 failed, 6 passed, 280 deselected in 0.25s ===================================================================================
Describe the bug
test_compare_snapshots
unittest for "bgp_peers" fail occasionally. The bgp_peers snapshot have multiple levels which we don't support in snapshot comparison currently. When comparison snapshots it randomly finds out the lowest level of the dictionary and when snapshot have multiple levels provided properties isn't found and comparison shows diff for all the dictionary instead of only the requested properties.Current behavior
Need to run unittest multiple times since it randomly gets into different levels of the dict.
> pytest -k test_compare_snapshots
Possible solution
Related to issue #108 - which will be fixed.
The text was updated successfully, but these errors were encountered: