From 30888a24d9b6f5c9be812088002ac2383b230cf1 Mon Sep 17 00:00:00 2001 From: Dmitry Rodionov Date: Fri, 18 Aug 2023 20:49:11 +0300 Subject: [PATCH] Avoid flakiness in test_timeline_delete_fail_before_local_delete (#5032) The problem was that timeline detail can return timelines in not only active state. And by the time request comes timeline deletion can still be in progress if we're unlucky (test execution happened to be slower for some reason) Reference for failed test run https://neon-github-public-dev.s3.amazonaws.com/reports/pr-5022/5891420105/index.html#suites/f588e0a787c49e67b29490359c589fae/dab036e9bd673274 The error was `Exception: detail succeeded (it should return 404)` reported by @koivunej --- pageserver/src/http/routes.rs | 1 - test_runner/regress/test_timeline_delete.py | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs index 1e8dada85e..450eb8072f 100644 --- a/pageserver/src/http/routes.rs +++ b/pageserver/src/http/routes.rs @@ -517,7 +517,6 @@ async fn timeline_delete_handler( .instrument(info_span!("timeline_delete", %tenant_id, %timeline_id)) .await?; - // FIXME: needs to be an error for console to retry it. Ideally Accepted should be used and retried until 404. json_response(StatusCode::ACCEPTED, ()) } diff --git a/test_runner/regress/test_timeline_delete.py b/test_runner/regress/test_timeline_delete.py index 3647442da3..e641065c43 100644 --- a/test_runner/regress/test_timeline_delete.py +++ b/test_runner/regress/test_timeline_delete.py @@ -488,15 +488,7 @@ def test_timeline_delete_fail_before_local_delete(neon_env_builder: NeonEnvBuild # Wait for tenant to finish loading. wait_until_tenant_active(ps_http, tenant_id=env.initial_tenant, iterations=10, period=1) - try: - data = ps_http.timeline_detail(env.initial_tenant, leaf_timeline_id) - log.debug(f"detail {data}") - except PageserverApiException as e: - log.debug(e) - if e.status_code != 404: - raise - else: - raise Exception("detail succeeded (it should return 404)") + wait_timeline_detail_404(ps_http, env.initial_tenant, leaf_timeline_id, iterations=4) assert ( not leaf_timeline_path.exists()