Skip to content

Commit

Permalink
test_runner: fix endpoints cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Jul 4, 2024
1 parent e159030 commit 00d1dbd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test_runner/fixtures/neon_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ def __exit__(
# if the test threw an exception, don't check for errors
# as a failing assertion would cause the cleanup below to fail
ps_assert_metric_no_errors=(exc_type is None),
# do not fail on endpoint errors to allow the rest of cleanup to proceed
fail_on_endpoint_errors=False,
)
cleanup_error = None

Expand Down Expand Up @@ -1214,11 +1216,11 @@ def start(self, timeout_in_seconds: Optional[int] = None):
for f in futs:
f.result()

def stop(self, immediate=False, ps_assert_metric_no_errors=False):
def stop(self, immediate=False, ps_assert_metric_no_errors=False, fail_on_endpoint_errors=True):
"""
After this method returns, there should be no child processes running.
"""
self.endpoints.stop_all()
self.endpoints.stop_all(fail_on_endpoint_errors)

# Stop storage controller before pageservers: we don't want it to spuriously
# detect a pageserver "failure" during test teardown
Expand Down Expand Up @@ -3899,9 +3901,17 @@ def create(
pageserver_id=pageserver_id,
)

def stop_all(self) -> "EndpointFactory":
def stop_all(self, fail_on_error=True) -> "EndpointFactory":
exception = None
for ep in self.endpoints:
ep.stop()
try:
ep.stop()
except Exception as e:
log.error(f"Failed to stop endpoint {ep.endpoint_id}: {e}")
exception = e

if fail_on_error and exception is not None:
raise exception

return self

Expand Down

0 comments on commit 00d1dbd

Please sign in to comment.