Skip to content

Commit f37d21f

Browse files
authored
Fix flaky test (#5079)
* fix flakiness * revert whitespace change * add comments
1 parent 3b433a4 commit f37d21f

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/pytests/test_json.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,17 @@ def test_JSON_RDB_load_fail_without_JSON_module(env: Env):
617617
env.envRunner.modulePath.pop() # Assumes Search module is the first and JSON module is the second
618618
env.envRunner.moduleArgs.pop()
619619
env.envRunner.masterCmdArgs = env.envRunner.createCmdArgs('master')
620-
env.start() # Restart without JSON module. Attempt to load RDB
621-
env.assertFalse(env.isUp()) # Server is down with no assertion error (MOD-7587)
620+
# Restart without JSON module. Attempt to load RDB - should fail.
621+
# RLTest may or may not fail to start the server with an exception
622+
try:
623+
env.start()
624+
except Exception as e:
625+
expected_msg = 'Redis server is dead'
626+
env.assertContains(expected_msg, str(e))
627+
if expected_msg not in str(e):
628+
raise e
629+
finally:
630+
env.assertFalse(env.isUp()) # Server is down with no assertion error (MOD-7587)
622631

623632
@skip(msan=True, no_json=True)
624633
def testIndexSeparation(env):

0 commit comments

Comments
 (0)