Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions tests/test_testgres_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,35 @@ def test_start2(self, node_svc: PostgresNodeService):
def test_failure_during_slow_start(self, node_svc: PostgresNodeService):
assert isinstance(node_svc, PostgresNodeService)

C_MAX_ATTEMPTS = 3

nAttempt = 0

while True:
assert nAttempt <= C_MAX_ATTEMPTS

if nAttempt == C_MAX_ATTEMPTS:
logging.warning("Test did not fail during wait stage.")
break

nAttempt += 1

logging.info("------------------ ATTEMPT {}".format(
nAttempt,
))

if self.helper_step_of_failure_during_slow_start(node_svc):
break

continue
return

def helper_step_of_failure_during_slow_start(
self,
node_svc: PostgresNodeService,
) -> bool:
assert isinstance(node_svc, PostgresNodeService)

with __class__.helper__get_node(node_svc) as node:
node.init()
assert not node.is_started
Expand Down Expand Up @@ -497,12 +526,20 @@ def test_failure_during_slow_start(self, node_svc: PostgresNodeService):

TestServices.PrintExceptionOK(x.value)

assert x.value.__context__ is None
assert type(x.value) is QueryTimeoutException

assert not node.is_started
assert node.status() == NodeStatus.Stopped
return
pass

assert x is not None
assert isinstance(x.value, Exception)
assert x.value.__context__ is None

if type(x.value) is StartNodeException:
assert x.value.description == "Cannot detect postmaster pid."
return False

assert type(x.value) is QueryTimeoutException
return True

def test_restart(self, node_svc: PostgresNodeService):
assert isinstance(node_svc, PostgresNodeService)
Expand Down
Loading