Skip to content

Commit 35e79bc

Browse files
committed
add a test for reporting html first served
1 parent 0828c1d commit 35e79bc

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

cli/server_test.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ func TestServer(t *testing.T) {
964964
server := httptest.NewServer(r)
965965
defer server.Close()
966966

967-
inv, _ := clitest.New(t,
967+
inv, cfg := clitest.New(t,
968968
"server",
969969
"--in-memory",
970970
"--http-address", ":0",
@@ -977,6 +977,26 @@ func TestServer(t *testing.T) {
977977

978978
<-deployment
979979
<-snapshot
980+
981+
accessURL := waitAccessURL(t, cfg)
982+
983+
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitMedium)
984+
defer cancel()
985+
client := codersdk.New(accessURL)
986+
body, err := client.Request(ctx, http.MethodGet, "/", nil)
987+
require.NoError(t, err)
988+
require.NoError(t, body.Body.Close())
989+
990+
snap := <-snapshot
991+
require.Condition(t, func() bool {
992+
htmlFirstServedFound := false
993+
for _, item := range snap.TelemetryItems {
994+
if item.Key == string(telemetry.TelemetryItemKeyHTMLFirstServedAt) {
995+
htmlFirstServedFound = true
996+
}
997+
}
998+
return htmlFirstServedFound
999+
}, "no html_first_served telemetry item")
9801000
})
9811001
t.Run("Prometheus", func(t *testing.T) {
9821002
t.Parallel()

0 commit comments

Comments
 (0)