Skip to content

Commit 8923ce5

Browse files
authored
fix: fix flake in TestAppHealth_Healthy (#13607)
1 parent 02ffff1 commit 8923ce5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

agent/apphealth_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,16 @@ func TestAppHealth_Healthy(t *testing.T) {
5656
Health: codersdk.WorkspaceAppHealthInitializing,
5757
},
5858
}
59-
checks := make(map[string]int)
59+
checks2 := 0
60+
checks3 := 0
6061
handlers := []http.Handler{
6162
nil,
6263
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
63-
checks["app2"]++
64+
checks2++
6465
httpapi.Write(r.Context(), w, http.StatusOK, nil)
6566
}),
6667
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
67-
checks["app3"]++
68+
checks3++
6869
httpapi.Write(r.Context(), w, http.StatusOK, nil)
6970
}),
7071
}
@@ -109,8 +110,8 @@ func TestAppHealth_Healthy(t *testing.T) {
109110
require.Equal(t, codersdk.WorkspaceAppHealthHealthy, apps[2].Health)
110111

111112
// ensure we aren't spamming
112-
require.Equal(t, 2, checks["app2"])
113-
require.Equal(t, 1, checks["app3"])
113+
require.Equal(t, 2, checks2)
114+
require.Equal(t, 1, checks3)
114115
}
115116

116117
func TestAppHealth_500(t *testing.T) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy