Skip to content

Commit ae7fca9

Browse files
chore: use Cian's suggestion
1 parent 46fa216 commit ae7fca9

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

coderd/autobuild/lifecycle_executor_test.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,20 @@ func TestMultipleLifecycleExecutors(t *testing.T) {
8181
var (
8282
sched = mustSchedule(t, "CRON_TZ=UTC 0 * * * *")
8383
// Create our first client
84-
tickChA = make(chan time.Time)
84+
tickCh = make(chan time.Time, 2)
8585
statsChA = make(chan autobuild.Stats)
8686
clientA = coderdtest.New(t, &coderdtest.Options{
8787
IncludeProvisionerDaemon: true,
88-
AutobuildTicker: tickChA,
88+
AutobuildTicker: tickCh,
8989
AutobuildStats: statsChA,
9090
Database: db,
9191
Pubsub: ps,
9292
})
9393
// ... And then our second client
94-
tickChB = make(chan time.Time)
9594
statsChB = make(chan autobuild.Stats)
9695
_ = coderdtest.New(t, &coderdtest.Options{
9796
IncludeProvisionerDaemon: true,
98-
AutobuildTicker: tickChB,
97+
AutobuildTicker: tickCh,
9998
AutobuildStats: statsChB,
10099
Database: db,
101100
Pubsub: ps,
@@ -111,13 +110,11 @@ func TestMultipleLifecycleExecutors(t *testing.T) {
111110

112111
// Get both clients to perform a lifecycle execution tick
113112
next := sched.Next(workspace.LatestBuild.CreatedAt)
113+
114114
go func() {
115-
tickChA <- next
116-
close(tickChA)
117-
}()
118-
go func() {
119-
tickChB <- next
120-
close(tickChB)
115+
tickCh <- next
116+
tickCh <- next
117+
close(tickCh)
121118
}()
122119

123120
// Now we want to check the stats for both clients

0 commit comments

Comments
 (0)