Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e8ebb9

Browse files
authored
fix: fix flaky TestWorkspaceProxy_Server_PrometheusEnabled (coder#12645)
1 parent 2cd5fbc commit 0e8ebb9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

enterprise/cli/proxyserver_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cli_test
33
import (
44
"bufio"
55
"context"
6-
"errors"
76
"fmt"
87
"net/http"
98
"net/http/httptest"
@@ -76,7 +75,8 @@ func TestWorkspaceProxy_Server_PrometheusEnabled(t *testing.T) {
7675
_, _ = w.Write([]byte(`{"app_security_key": "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789123456"}`))
7776
return
7877
}
79-
if r.URL.Path == "/api/v2/workspaceproxies/me/coordinate" {
78+
if r.URL.Path == "/api/v2/workspaceproxies/me/coordinate" ||
79+
r.URL.Path == "/api/v2/buildinfo" {
8080
// Slow down proxy registration, so that test runner can check if Prometheus endpoint is exposed.
8181
wg.Wait()
8282

@@ -107,8 +107,7 @@ func TestWorkspaceProxy_Server_PrometheusEnabled(t *testing.T) {
107107

108108
// Start "wsproxy server" command
109109
clitest.StartWithAssert(t, inv, func(t *testing.T, err error) {
110-
assert.Error(t, err)
111-
assert.False(t, errors.Is(err, context.Canceled), "error was expected, but context was canceled")
110+
// actually no assertions are needed as the test verifies only Prometheus endpoint
112111
})
113112
pty.ExpectMatchContext(ctx, "Started HTTP listener at")
114113

0 commit comments

Comments
 (0)