Skip to content

Commit 2637f55

Browse files
authored
chore: de-flake TestWorkspaceAgent_Metadata (#7036)
1 parent c68ab7d commit 2637f55

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

coderd/workspaceagents_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,13 @@ func TestWorkspaceAgent_Metadata(t *testing.T) {
13531353
var update []codersdk.WorkspaceAgentMetadata
13541354

13551355
check := func(want codersdk.WorkspaceAgentMetadataResult, got codersdk.WorkspaceAgentMetadata) {
1356-
require.WithinDuration(t, want.CollectedAt, got.Result.CollectedAt, time.Second)
1356+
require.Greater(t, got.Result.CollectedAt, want.CollectedAt)
1357+
1358+
ageImpliedNow := got.Result.CollectedAt.Add(time.Duration(got.Result.Age) * time.Second)
1359+
// We use a long WithinDuration to tolerate slow CI, but we're still making sure
1360+
// that Age is within the ballpark.
13571361
require.WithinDuration(
1358-
t, time.Now(), got.Result.CollectedAt.Add(time.Duration(got.Result.Age)*time.Second), time.Second,
1362+
t, time.Now(), ageImpliedNow, time.Second*10,
13591363
)
13601364
require.Equal(t, want.Value, got.Result.Value)
13611365
require.Equal(t, want.Error, got.Result.Error)

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