From 8d7fa802f4bf52d9ffe67913b3a705ca34aba5ec Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Thu, 5 Dec 2024 10:31:43 +0000 Subject: [PATCH] code cleanup --- compute_tools/src/http/api.rs | 16 +++++++++------- compute_tools/src/installed_extensions.rs | 13 +++++++++---- test_runner/regress/test_installed_extensions.py | 4 ++++ 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/compute_tools/src/http/api.rs b/compute_tools/src/http/api.rs index 8273f47db6..5e28a7c044 100644 --- a/compute_tools/src/http/api.rs +++ b/compute_tools/src/http/api.rs @@ -311,7 +311,15 @@ async fn routes(req: Request, compute: &Arc) -> Response { info!("serving /installed_extensions HEAD request"); let status = compute.get_status(); @@ -326,12 +334,6 @@ async fn routes(req: Request, compute: &Arc) -> Response Result Result = Lazy::new(|| { }); pub fn collect() -> Vec { + // TODO Add a mutex here to ensure that the metric is not updated while we are collecting it INSTALLED_EXTENSIONS.collect() } diff --git a/test_runner/regress/test_installed_extensions.py b/test_runner/regress/test_installed_extensions.py index 05d2fb79af..5568aed968 100644 --- a/test_runner/regress/test_installed_extensions.py +++ b/test_runner/regress/test_installed_extensions.py @@ -154,6 +154,10 @@ def test_installed_extensions(neon_simple_env: NeonEnv): assert sample.value == 1 +# WIP Test metric live update +# TODO: cleamup the test and stabilize it. +# Now there is a race, because there is a gap between the extension creation and the metric collection. +# This is fine for the real world, as we don't need to be 100% real time, but not convenient for the test. def test_installed_extensions_metric_live_update(neon_simple_env: NeonEnv): """basic test for the endpoint that returns the list of installed extensions"""