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

Commit8343b8e

Browse files
committed
GREEN: fix final unit test
1 parent1af266f commit8343b8e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎coderd/autobuild/executor/lifecycle_executor_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ func TestExecutorAutostartMultipleOK(t *testing.T) {
456456
t.Parallel()
457457

458458
var (
459+
sched=mustSchedule(t,"CRON_TZ=UTC 0 * * * *")
459460
tickCh=make(chan time.Time)
460461
tickCh2=make(chan time.Time)
461462
statsCh1=make(chan executor.Stats)
@@ -471,15 +472,17 @@ func TestExecutorAutostartMultipleOK(t *testing.T) {
471472
AutobuildStats:statsCh2,
472473
})
473474
// Given: we have a user with a workspace that has autostart enabled (default)
474-
workspace=mustProvisionWorkspace(t,client)
475+
workspace=mustProvisionWorkspace(t,client,func(cwr*codersdk.CreateWorkspaceRequest) {
476+
cwr.AutostartSchedule=ptr.Ref(sched.String())
477+
})
475478
)
476479
// Given: workspace is stopped
477480
workspace=mustTransitionWorkspace(t,client,workspace.ID,database.WorkspaceTransitionStart,database.WorkspaceTransitionStop)
478481

479-
// When: the autobuild executor ticks
482+
// When: the autobuild executor ticks past the scheduled time
480483
gofunc() {
481-
tickCh<-time.Now().UTC().Add(time.Minute)
482-
tickCh2<-time.Now().UTC().Add(time.Minute)
484+
tickCh<-sched.Next(workspace.LatestBuild.CreatedAt)
485+
tickCh2<-sched.Next(workspace.LatestBuild.CreatedAt)
483486
close(tickCh)
484487
close(tickCh2)
485488
}()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp