Fix solution

This commit is contained in:
Fedor Korotkiy 2020-03-29 21:32:26 +03:00
parent 0d619cfdf1
commit 49a330e852

View file

@ -43,7 +43,7 @@ func TestPubSub_nonBlockPublish(t *testing.T) {
wg.Add(11) wg.Add(11)
_, err := p.Subscribe("non-bock-topic", func(msg interface{}) { _, err := p.Subscribe("non-bock-topic", func(msg interface{}) {
time.Sleep(1 * time.Second) time.Sleep(10 * time.Millisecond)
wg.Done() wg.Done()
}) })
require.NoError(t, err) require.NoError(t, err)
@ -58,7 +58,7 @@ func TestPubSub_nonBlockPublish(t *testing.T) {
}() }()
select { select {
case <-time.After(1 * time.Second): case <-time.After(10 * time.Second):
t.Fatal("publish method must not be blocked") t.Fatal("publish method must not be blocked")
case <-done: case <-done:
// ok // ok
@ -319,7 +319,7 @@ func TestPubSub_closeWaitsMessageDelivery(t *testing.T) {
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
_, err := p.Subscribe("q", func(msg interface{}) { _, err := p.Subscribe("q", func(msg interface{}) {
time.Sleep(100*time.Millisecond) time.Sleep(100 * time.Millisecond)
wg.Done() wg.Done()
}) })
require.NoError(t, err) require.NoError(t, err)