From aadcb5fc17398b9f45c0a10197b543a06f03bd41 Mon Sep 17 00:00:00 2001 From: Patrick Dawkins Date: Thu, 24 Sep 2026 11:20:06 +0100 Subject: [PATCH] test(metrics): mock the observability entrypoint in TestMetricsLatest Since #118, the metrics commands discover the resources overview URL via GET {environment}/observability/ instead of the #observability-pipeline link. TestMetricsLatest (#165) still mocked the old link, so the CLI got a 404 and failed with "Observability API link not found". Co-Authored-By: Claude Opus 5.5 --- integration-tests/metrics_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/integration-tests/metrics_test.go b/integration-tests/metrics_test.go index b855e463..1d90b7de 100644 --- a/integration-tests/metrics_test.go +++ b/integration-tests/metrics_test.go @@ -31,7 +31,6 @@ func TestMetricsLatest(t *testing.T) { envPath := "/projects/" + projectID + "/environments/main" main := makeEnv(projectID, "main", "production", "active", nil) - main.Links["#observability-pipeline"] = mockapi.HALLink{HREF: apiServer.URL + envPath + "/observability"} main.SetCurrentDeployment(&mockapi.Deployment{ WebApps: map[string]mockapi.App{"app": {Name: "app", Type: "golang:1.23", Size: "AUTO"}}, Services: map[string]mockapi.App{"db": {Name: "db", Type: "mariadb:11.4", Size: "AUTO"}}, @@ -79,7 +78,13 @@ func TestMetricsLatest(t *testing.T) { defer mu.Unlock() data = d } - apiHandler.Get(envPath+"/observability/resources/overview", func(w http.ResponseWriter, _ *http.Request) { + overviewPath := envPath + "/observability/resources/overview" + apiHandler.Get(envPath+"/observability/", func(w http.ResponseWriter, _ *http.Request) { + _ = json.NewEncoder(w).Encode(map[string]any{ + "_links": mockapi.MakeHALLinks("resources_overview=" + apiServer.URL + overviewPath), + }) + }) + apiHandler.Get(overviewPath, func(w http.ResponseWriter, _ *http.Request) { mu.Lock() defer mu.Unlock() now = time.Now().UTC()