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

Commit862b1ff

Browse files
committed
hack: wait for connections to fully close
1 parent1f9012e commit862b1ff

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎coderd/workspaceapps/apptest/apptest.go‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,12 +1566,14 @@ func testReconnectingPTY(ctx context.Context, t *testing.T, client *codersdk.Cli
15661566
}
15671567

15681568
// Accessing an app should update the workspace's LastUsedAt.
1569+
// Despite our efforts with the flush channel, this is inherently racy.
1570+
// Retry a few times to ensure that the stats collection pipeline has flushed.
15691571
funcassertWorkspaceLastUsedAtUpdated(t testing.TB,details*Details) {
15701572
t.Helper()
15711573

1574+
<-time.After(testutil.IntervalMedium)
15721575
details.FlushStats()
1573-
// Despite our efforts with the flush channel, this is inherently racy.
1574-
// Retry a few times to ensure that the stats collection pipeline has flushed.
1576+
<-time.After(testutil.IntervalMedium)
15751577
require.Eventually(t,func()bool {
15761578
ws,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
15771579
assert.NoError(t,err)
@@ -1580,13 +1582,14 @@ func assertWorkspaceLastUsedAtUpdated(t testing.TB, details *Details) {
15801582
}
15811583

15821584
// Except when it sometimes shouldn't (e.g. no access)
1585+
// Despite our efforts with the flush channel, this is inherently racy.
1586+
// Wait for a short time to ensure that the stats collection pipeline has flushed.
15831587
funcassertWorkspaceLastUsedAtNotUpdated(t testing.TB,details*Details) {
15841588
t.Helper()
15851589

1590+
<-time.After(testutil.IntervalMedium)// wait for connections to close
15861591
details.FlushStats()
1587-
// Despite our efforts with the flush channel, this is inherently racy.
1588-
// Wait for a short time to ensure that the stats collection pipeline has flushed.
1589-
<-time.After(testutil.IntervalSlow)
1592+
<-time.After(testutil.IntervalMedium)
15901593
ws,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
15911594
require.NoError(t,err)
15921595
require.Equal(t,ws.LastUsedAt,details.Workspace.LastUsedAt,"workspace LastUsedAt updated when it should not have been")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp