Skip to content

Commit

Permalink
move httpserver check out of fixture
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Modpur <[email protected]>
  • Loading branch information
rmodpur authored and koivunej committed Nov 28, 2023
1 parent 5cf2b8d commit b461841
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 2 additions & 4 deletions test_runner/fixtures/neon_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ def neon_env_and_metrics_server(
httpserver: HTTPServer,
neon_env_builder: NeonEnvBuilder,
httpserver_listen_address,
) -> Iterator[Tuple[NeonEnv, SimpleQueue[Any]]]:
) -> Tuple[NeonEnv, HTTPServer, SimpleQueue[Any]]:
"""
Fixture to create a Neon environment and metrics server.
"""
Expand Down Expand Up @@ -1068,9 +1068,7 @@ def metrics_handler(request: Request) -> Response:
".*synthetic_size_worker: failed to calculate synthetic size for tenant .*: failed to calculate some logical_sizes"
)

yield (env, uploads)

httpserver.check()
return (env, httpserver, uploads)


@dataclass
Expand Down
15 changes: 11 additions & 4 deletions test_runner/regress/test_pageserver_metric_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
wait_for_last_flush_lsn,
)
from fixtures.types import TenantId, TimelineId
from pytest_httpserver import HTTPServer


def test_metric_collection(neon_env_and_metrics_server: Tuple[NeonEnv, SimpleQueue[Any]]):
(env, uploads) = neon_env_and_metrics_server
def test_metric_collection(
neon_env_and_metrics_server: Tuple[NeonEnv, HTTPServer, SimpleQueue[Any]]
):
(env, httpserver, uploads) = neon_env_and_metrics_server

tenant_id = env.initial_tenant
timeline_id = env.initial_timeline
Expand Down Expand Up @@ -107,11 +110,13 @@ def get_num_remote_ops(file_kind: str, op_kind: str) -> int:
(events, is_last) = events
v.ingest(events, is_last)

httpserver.check()


def test_metric_collection_cleans_up_tempfile(
neon_env_and_metrics_server: Tuple[NeonEnv, SimpleQueue[Any]]
neon_env_and_metrics_server: Tuple[NeonEnv, HTTPServer, SimpleQueue[Any]]
):
(env, uploads) = neon_env_and_metrics_server
(env, httpserver, uploads) = neon_env_and_metrics_server
pageserver_http = env.pageserver.http_client()

tenant_id = env.initial_tenant
Expand Down Expand Up @@ -183,6 +188,8 @@ def test_metric_collection_cleans_up_tempfile(
), "only initial tempfile should had been removed"
assert initially.other.issuperset(later.other), "no other files should had been removed"

httpserver.check()


@dataclass
class PrefixPartitionedFiles:
Expand Down

0 comments on commit b461841

Please sign in to comment.