tests: pubsub: fix racy tests.
Merge pull request #150 from stephenplusplus/test-pubsub

tests: pubsub: fix racy tests.