Skip to content

Commit b11fab0

Browse files
augusdnmssonicbld
authored andcommitted
Fix customMsg from unexpected fanity failure (sonic-net#14792)
New feature delivered recently, add customMsg for sanity check failures, was causing unexpected sanity_check results. This was due to premature cache key reset of pre_sanity_check_failed and post_sanity_check_failed. Removed those two keys from getting reset before sessionfinish to resolve the issue Important cache keys, used to determine session exit status: pre_sanity_check_failed & post_sanity_check_failed => These combination of keys will return exit status 10, 11, 12 10 = PRE_SANITY_CHECK_FAILED_RC 11 = POST_SANITY_CHECK_FAILED_RC 12 = SANITY_CHECK_FAILED_RC duthosts_fixture_failed => If this is true, we return exit status code 15 15 = DUTHOSTS_FIXTURE_FAILED_RC Description of PR Summary: New feature delivered recently, add customMsg for sanity check failures, was causing unexpected sanity_check results. This was due to premature cache key reset of pre_sanity_check_failed and post_sanity_check_failed. Removed those two keys from getting reset before sessionfinish to resolve the issue Type of change Bug fix Testbed and Framework(new/improvement) Test case(new/improvement) Back port request 202012 202205 202305 202311 202405 Approach What is the motivation for this PR? How did you do it? Remove premature cache reset of pre_sanity_check_failed and post_sanity_check_failed, before it reaches sessionfinish How did you verify/test it? Manually tested, simulating pre_sanity_checked_failed and post_sanity_check_failed, to observe expected exit satus codes from 10,11, and 12. Exit status code can be retrieved and displayed, using 'echo $?' eg: image co-authorized by: [email protected]
1 parent fbfef99 commit b11fab0

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

tests/common/plugins/sanity_check/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@
1919
SUPPORTED_CHECKS = checks.CHECK_ITEMS
2020
DUT_CHEK_LIST = ['core_dump_check_pass', 'config_db_check_pass']
2121
CACHE_LIST = ['core_dump_check_pass', 'config_db_check_pass',
22-
'pre_sanity_check_failed', 'post_sanity_check_failed',
2322
'pre_sanity_recovered', 'post_sanity_recovered']
2423

2524

26-
def reset_cache_list(request):
27-
for item in CACHE_LIST:
28-
request.config.cache.set(item, None)
29-
30-
3125
def pytest_sessionfinish(session, exitstatus):
3226

3327
pre_sanity_failed = session.config.cache.get("pre_sanity_check_failed", None)
@@ -170,8 +164,6 @@ def log_custom_msg(request):
170164
logger.debug("customMsgDict: {}".format(customMsgDict))
171165
item.user_properties.append(('CustomMsg', json.dumps(customMsgDict)))
172166

173-
reset_cache_list(request)
174-
175167

176168
@pytest.fixture(scope="module")
177169
def sanity_check_full(localhost, duthosts, request, fanouthosts, nbrhosts, tbinfo):

0 commit comments

Comments
 (0)