Skip to content

Commit 58b65a1

Browse files
committed
try to fix potential race in test
1 parent 0b002ec commit 58b65a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

agent/agentcontainers/api_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ func TestAPI(t *testing.T) {
737737
ID: "container-id",
738738
FriendlyName: "container-name",
739739
Running: true,
740-
CreatedAt: time.Now(),
740+
CreatedAt: time.Now().Add(-1 * time.Minute),
741741
Labels: map[string]string{
742742
agentcontainers.DevcontainerLocalFolderLabel: "/home/coder/project",
743743
agentcontainers.DevcontainerConfigFileLabel: "/home/coder/project/.devcontainer/devcontainer.json",
@@ -771,6 +771,8 @@ func TestAPI(t *testing.T) {
771771

772772
ctx := testutil.Context(t, testutil.WaitShort)
773773

774+
clk.Set(time.Now()).MustWait(ctx)
775+
774776
// Simulate a file modification event to make the devcontainer dirty.
775777
watcher.sendEventWaitNextCalled(ctx, fsnotify.Event{
776778
Name: "/home/coder/project/.devcontainer/devcontainer.json",

0 commit comments

Comments
 (0)