Skip to content

Commit d709e68

Browse files
committed
test the stat output in apptest
1 parent 1705138 commit d709e68

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

coderd/workspaceapps/apptest/apptest.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,14 +1435,20 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
14351435
require.NoError(t, err)
14361436
require.Equal(t, http.StatusOK, resp.StatusCode)
14371437

1438+
var stats []workspaceapps.StatsReport
14381439
require.Eventually(t, func() bool {
14391440
// Keep flushing until we get a non-empty stats report.
14401441
flushDone := make(chan struct{}, 1)
14411442
flush <- flushDone
14421443
<-flushDone
14431444

1444-
return len(reporter.stats()) > 0
1445+
stats = reporter.stats()
1446+
return len(stats) > 0
14451447
}, testutil.WaitLong, testutil.IntervalFast, "stats not reported")
1448+
1449+
assert.Equal(t, workspaceapps.AccessMethodPath, stats[0].AccessMethod)
1450+
assert.Equal(t, "test-app-owner", stats[0].SlugOrPort)
1451+
assert.Equal(t, 1, stats[0].Requests)
14461452
})
14471453
}
14481454

0 commit comments

Comments
 (0)