From 9acf6acd76f1ea704d4037740b85fcca1c1fcd09 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 4 Oct 2024 13:17:18 +0200 Subject: [PATCH] test: use static port for Prometheus (#14972) Fixes: https://github.com/coder/internal/issues/92 --- enterprise/cli/proxyserver_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/enterprise/cli/proxyserver_test.go b/enterprise/cli/proxyserver_test.go index 1af78b4b13..ae01f6ac9d 100644 --- a/enterprise/cli/proxyserver_test.go +++ b/enterprise/cli/proxyserver_test.go @@ -59,10 +59,11 @@ func Test_ProxyServer_Headers(t *testing.T) { assert.EqualValues(t, 1, atomic.LoadInt64(&called)) } +//nolint:paralleltest,tparallel // Test uses a static port. func TestWorkspaceProxy_Server_PrometheusEnabled(t *testing.T) { - t.Parallel() - - prometheusPort := testutil.RandomPort(t) + // Ephemeral ports have a tendency to conflict and fail with `bind: address already in use` error. + // This workaround forces a static port for Prometheus that hopefully won't be used by other tests. + prometheusPort := 32002 var wg sync.WaitGroup wg.Add(1)