Skip to content

Commit e7a2bbf

Browse files
committed
Change to atomic.Bool to avoid race in test.
1 parent c9b99eb commit e7a2bbf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/manager/runnable_group_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ var _ = Describe("runnables", func() {
115115
})
116116

117117
It("should execute the Warmup function when Warmup group is started", func() {
118-
warmupExecuted := false
118+
var warmupExecuted atomic.Bool
119119

120120
warmupRunnable := WarmupRunnableFunc{
121121
RunFunc: func(c context.Context) error {
122122
<-c.Done()
123123
return nil
124124
},
125125
WarmupFunc: func(c context.Context) error {
126-
warmupExecuted = true
126+
warmupExecuted.Store(true)
127127
return nil
128128
},
129129
}
@@ -138,7 +138,7 @@ var _ = Describe("runnables", func() {
138138
Expect(r.Warmup.Start(ctx)).To(Succeed())
139139

140140
// Verify warmup function was called
141-
Expect(warmupExecuted).To(BeTrue())
141+
Expect(warmupExecuted.Load()).To(BeTrue())
142142
})
143143

144144
It("should propagate errors from Warmup function to error channel", func() {

0 commit comments

Comments
 (0)