bring back EventSubscriber

This commit is contained in:
Anton Kaliaev
2019-02-01 15:28:25 +04:00
parent 1be7e341b1
commit 4257407aea
9 changed files with 97 additions and 46 deletions

View File

@ -59,14 +59,12 @@ func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (type
const subscriber = "helpers"
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
evts := make(chan interface{}, 1)
// register for the next event of this type
sub, err := c.Subscribe(ctx, subscriber, types.QueryForEvent(evtTyp))
if err != nil {
return nil, errors.Wrap(err, "failed to subscribe")
}
// make sure to unregister after the test is over
defer c.UnsubscribeAll(ctx, subscriber)