Skip to content

Commit

Permalink
Even more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
yitsushi committed Oct 20, 2021
1 parent 7583cf4 commit c21b635
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions infrastructure/containerd/event_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,11 @@ func TestEventService_Integration(t *testing.T) {

for idx, subscriber := range subscribers {
t.Logf("start subscriber (%d) is ready to receive events", idx+1)
recvd, err := watch(&subscriber, len(testEvents))
recvd, err := watch(t, &subscriber, len(testEvents))
t.Logf("subscriber (%d) is done", idx+1)

assert.NoError(t, err)
assert.Len(t, recvd, 2)

// if len(recvd) == len(testEvents) {
// subscriber.cancel()
// }
}
}

Expand All @@ -85,20 +81,24 @@ func cancelWrapper(t *testing.T, id int, cancel context.CancelFunc) func() {
}
}

func watch(subscriber *testSubscriber, maxEvents int) ([]interface{}, error) {
func watch(t *testing.T, subscriber *testSubscriber, maxEvents int) ([]interface{}, error) {
recvd := []interface{}{}

var err error

for {
select {
case env := <-subscriber.eventCh:
t.Logf("subscriber.eventCh received: %+v", env)

if env != nil {
recvd = append(recvd, env.Event)
} else {
break
}
case err = <-subscriber.eventErrCh:
t.Logf("subscriber.eventErrCh received: %v", err)

break
}

Expand Down

0 comments on commit c21b635

Please sign in to comment.