mirror of
https://github.com/coder/coder.git
synced 2025-07-21 01:28:49 +00:00
test: use static port for Prometheus (#14972)
Fixes: https://github.com/coder/internal/issues/92
This commit is contained in:
@ -59,10 +59,11 @@ func Test_ProxyServer_Headers(t *testing.T) {
|
|||||||
assert.EqualValues(t, 1, atomic.LoadInt64(&called))
|
assert.EqualValues(t, 1, atomic.LoadInt64(&called))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:paralleltest,tparallel // Test uses a static port.
|
||||||
func TestWorkspaceProxy_Server_PrometheusEnabled(t *testing.T) {
|
func TestWorkspaceProxy_Server_PrometheusEnabled(t *testing.T) {
|
||||||
t.Parallel()
|
// 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 := testutil.RandomPort(t)
|
prometheusPort := 32002
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
Reference in New Issue
Block a user