@@ -190,15 +190,13 @@ func TestWorkspaceDetails(t *testing.T) {
190
190
for _ , tc := range []struct {
191
191
Name string
192
192
Database func () database.Store
193
- ExpectedSeries int
194
- ExpectedStatuses map [codersdk.ProvisionerJobStatus ]int
195
193
ExpectedWorkspaces int
194
+ ExpectedStatuses map [codersdk.ProvisionerJobStatus ]int
196
195
}{{
197
196
Name : "None" ,
198
197
Database : func () database.Store {
199
198
return dbmem .New ()
200
199
},
201
- ExpectedSeries : 0 ,
202
200
ExpectedWorkspaces : 0 ,
203
201
}, {
204
202
Name : "Multiple" ,
@@ -214,7 +212,6 @@ func TestWorkspaceDetails(t *testing.T) {
214
212
insertRunning (t , db )
215
213
return db
216
214
},
217
- ExpectedSeries : 7 ,
218
215
ExpectedWorkspaces : 7 ,
219
216
ExpectedStatuses : map [codersdk.ProvisionerJobStatus ]int {
220
217
codersdk .ProvisionerJobCanceled : 1 ,
@@ -234,10 +231,10 @@ func TestWorkspaceDetails(t *testing.T) {
234
231
require .Eventually (t , func () bool {
235
232
metrics , err := registry .Gather ()
236
233
assert .NoError (t , err )
234
+
237
235
stMap := map [codersdk.ProvisionerJobStatus ]int {}
238
- wMap := map [string ]struct {}{}
239
236
for _ , m := range metrics {
240
- if m .GetName () != "coderd_api_workspace_detail " {
237
+ if m .GetName () != "coderd_workspace_latest_build_status " {
241
238
continue
242
239
}
243
240
@@ -247,12 +244,9 @@ func TestWorkspaceDetails(t *testing.T) {
247
244
continue
248
245
}
249
246
250
- switch l .GetName () {
251
- case "status" :
247
+ if l .GetName () == "status" {
252
248
status := codersdk .ProvisionerJobStatus (l .GetValue ())
253
249
stMap [status ] += int (metric .Gauge .GetValue ())
254
- case "workspace_name" :
255
- wMap [l .GetValue ()] = struct {}{}
256
250
}
257
251
}
258
252
}
@@ -267,9 +261,8 @@ func TestWorkspaceDetails(t *testing.T) {
267
261
stSum += count
268
262
}
269
263
270
- t .Logf ("status series = %d, expected == %d" , stSum , tc .ExpectedSeries )
271
- t .Logf ("workspace series = %d, expected == %d" , len (wMap ), tc .ExpectedWorkspaces )
272
- return stSum == tc .ExpectedSeries && len (wMap ) == tc .ExpectedWorkspaces
264
+ t .Logf ("status series = %d, expected == %d" , stSum , tc .ExpectedWorkspaces )
265
+ return stSum == tc .ExpectedWorkspaces
273
266
}, testutil .WaitShort , testutil .IntervalFast )
274
267
})
275
268
}
0 commit comments