Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6556fc

Browse files
authored
test(coderd/workspaceapps/apptest): fix lastusedat assertion for all test (#20827)
The test flake can be verified by setting `ReportInterval` to a reallylow value, like `100 * time.Millisecond`.We now set it to a really high value to avoid triggering flush without manually calling the function in test. This can easily happen because the default value is 30s and we run tests in parallel. The assertiontypically happens such that:[use workspace] -> [fetch previous last used] -> [flush]-> [fetch new last used]When this edge case is triggered:[use workspace] -> [report interval flush]-> [fetch previous last used] -> [flush] -> [fetch new last used]In this case, both the previous and new last used will be the same,breaking the test assertion.Fixescoder/internal#960Fixescoder/internal#975
1 parent8e22cd7 commitf6556fc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎coderd/workspaceapps/apptest/setup.go‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,22 @@ func setupProxyTestWithFactory(t *testing.T, factory DeploymentFactory, opts *De
195195
ifopts.DisableSubdomainApps {
196196
opts.AppHost=""
197197
}
198+
ifopts.StatsCollectorOptions.ReportInterval==0 {
199+
// Set to a really high value to avoid triggering flush without manually
200+
// calling the function in test. This can easily happen because the
201+
// default value is 30s and we run tests in parallel. The assertion
202+
// typically happens such that:
203+
//
204+
// [use workspace] -> [fetch previous last used] -> [flush] -> [fetch new last used]
205+
//
206+
// When this edge case is triggered:
207+
//
208+
// [use workspace] -> [report interval flush] -> [fetch previous last used] -> [flush] -> [fetch new last used]
209+
//
210+
// In this case, both the previous and new last used will be the same,
211+
// breaking the test assertion.
212+
opts.StatsCollectorOptions.ReportInterval=9001*time.Hour
213+
}
198214

199215
deployment:=factory(t,opts)
200216

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp