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
There are some cases when comparison logic in Test_SonicYang.test_xlate_rev_xlate could end up in unexpected failures. Example:
deftest_xlate_rev_xlate(self, sonic_yang_data):
# In this test, xlation and revXlation is tested with latest Sonic# YANG model.test_file=sonic_yang_data['test_file']
syc=sonic_yang_data['syc']
jIn=self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON')
jIn=json.loads(jIn)
numTables=len(jIn)
syc.loadData(jIn, debug=True)
# check all tables are loaded and no tables is without Yang Modelsassertlen(syc.jIn) ==numTablesassertlen(syc.tablesWithOutYang) ==0syc.getData(debug=True)
ifsyc.jInandsyc.jIn==syc.revXlateJson:
print("Xlate and Rev Xlate Passed")
else:
print("Xlate and Rev Xlate failed")
# print for better debugging, in case of failure.print("syc.jIn: {}".format({t:syc.jIn[t].keys() \
fortinsyc.jIn.keys()}))
print("syc.revXlateJson: {}".format({t:syc.revXlateJson[t].keys() \
fortinsyc.revXlateJson.keys()}))
# make it failassertFalse==Truereturn
The current implementation assumes simple dict comparison:
ifsyc.jInandsyc.jIn==syc.revXlateJson:
print("Xlate and Rev Xlate Passed")
This will end up in failures when input sample config data has inappropriate values formatting: Input:
Description
There are some cases when comparison logic in
Test_SonicYang.test_xlate_rev_xlate
could end up in unexpected failures.Example:
The current implementation assumes simple
dict
comparison:This will end up in failures when input sample config data has inappropriate values formatting:
Input:
Output:
Such issues are hard to debug.
Suggest using
deepdiff
to get more user friendly results.Steps to reproduce the issue:
FFFF::
Describe the results you received:
Describe the results you expected:
Output of
show version
:Output of
show techsupport
:Additional information you deem important (e.g. issue happens only occasionally):
The text was updated successfully, but these errors were encountered: