]> git.puffer.fish Git - matthieu/frr.git/commit
tests: Fix JSON diff for nested lists
authorGalaxyGorilla <sascha@netdef.org>
Fri, 22 May 2020 21:18:46 +0000 (21:18 +0000)
committerGalaxyGorilla <sascha@netdef.org>
Fri, 22 May 2020 22:29:35 +0000 (22:29 +0000)
commitb3100f6ce7b17302c03c7c8e411ab5b6c970a875
tree873a7e6adc627fd0ce261fd1c96351f35834b70b
parentcb47b207f520ce9450f7b15fc4818b867cbc0c54
tests: Fix JSON diff for nested lists

The involved piece of code is supposed to find a 'closest' match for two
JSON structures using another JSON diff. However, it can happen that
during that new diff the JSON structures are altered (elements from a
list are deleted when 'found'). This is in general ok when the deleted
element is part of the JSON structure which 'matches', but when it later
turns out that some other element of the structure doesn't fit, then the
whole structure should be recovered. This is now realized by using a
deepcopy for the besaid new JSON diff such that the original is only
altered (e.g. deleted) when the diff is clean.

Signed-off-by: GalaxyGorilla <sascha@netdef.org>
tests/topotests/lib/test/test_json.py
tests/topotests/lib/topotest.py