Skip to content

Commit 8ed4f48

Browse files
committed
[receiver/podmanreceiver] Migrate assert.Eventually to assert.EventuallyWithT in TestEventLoopHandles and TestEventLoopHandlesError
1 parent ee093fb commit 8ed4f48

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

receiver/podmanreceiver/podman_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ func TestEventLoopHandlesError(t *testing.T) {
136136
go cli.containerEventLoop(ctx)
137137
defer cancel()
138138

139-
assert.Eventually(t, func() bool {
139+
assert.EventuallyWithT(t, func(tt *assert.CollectT) {
140140
for _, l := range logs.All() {
141-
assert.Contains(t, l.Message, "Error watching podman container events")
142-
assert.Contains(t, l.ContextMap()["error"], "EOF")
141+
assert.Contains(tt, l.Message, "Error watching podman container events")
142+
assert.Contains(tt, l.ContextMap()["error"], "EOF")
143143
}
144-
return len(logs.All()) > 0
144+
assert.NotEmpty(tt, logs.All())
145145
}, 1*time.Second, 1*time.Millisecond, "failed to find desired error logs.")
146146

147147
finished := make(chan struct{})
@@ -182,18 +182,18 @@ func TestEventLoopHandles(t *testing.T) {
182182

183183
eventChan <- event{ID: "c1", Status: "start"}
184184

185-
assert.Eventually(t, func() bool {
185+
assert.EventuallyWithT(t, func(tt *assert.CollectT) {
186186
cli.containersLock.Lock()
187187
defer cli.containersLock.Unlock()
188-
return assert.Len(t, cli.containers, 1)
188+
assert.Len(tt, cli.containers, 1)
189189
}, 1*time.Second, 1*time.Millisecond, "failed to update containers list.")
190190

191191
eventChan <- event{ID: "c1", Status: "died"}
192192

193-
assert.Eventually(t, func() bool {
193+
assert.EventuallyWithT(t, func(tt *assert.CollectT) {
194194
cli.containersLock.Lock()
195195
defer cli.containersLock.Unlock()
196-
return assert.Empty(t, cli.containers)
196+
assert.Empty(tt, cli.containers)
197197
}, 1*time.Second, 1*time.Millisecond, "failed to update containers list.")
198198
}
199199

0 commit comments

Comments
 (0)