From 1442355a5276ea831f290b3e332a008f64a53e4b Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Fri, 30 Oct 2026 08:30:49 +0100 Subject: [PATCH] =?UTF-8?q?test:=20the=20postgres=20harness=20no=20longer?= =?UTF-8?q?=20provisions=20at=20the=20live=20stage=20Pr=C3=BCfwerk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pruefwerk-agent-stage logged 'platform token rejected: failed to decode JWT header' in bursts of five provisions and one targets read, each time the registry's tests ran (CI and local). The migrations seed the real provision URLs (0005: pruefwerk-stage), a test config's env 'dev' reads as 'stage', so every postgres test that provisioned a tenant called the live endpoint with the Keycloak mock's non-JWT token and got 401. The postgres harness clears provision_urls after migrating, as the memory store has none; tests that need one set it themselves. Checked: a full local run with postgres left no request in Prüfwerk's traces. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4 --- internal/server/server_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/server/server_test.go b/internal/server/server_test.go index 2ba470f..197321d 100644 --- a/internal/server/server_test.go +++ b/internal/server/server_test.go @@ -116,6 +116,14 @@ func newPostgresHarness(t *testing.T) *testHarness { if err := m.Up(); err != nil && err.Error() != "no change" { t.Fatalf("migrate: %v", err) } + // The migrations seed the real product URLs (0005: Prüfwerk's stage + // provision endpoint), and a test config's env "dev" reads as "stage": + // without this, every test that provisions a tenant called the live + // pruefwerk-stage with the mock's non-JWT token (401s in its log). The + // memory store has no provision URLs either; tests that need one set it. + if _, err := db.ExecContext(ctx, `UPDATE products SET provision_urls = '{}'`); err != nil { + t.Fatalf("clear provision URLs: %v", err) + } _, _ = m.Close() _ = db.Close()