diff options
author | Valery Piashchynski <[email protected]> | 2020-02-27 23:35:12 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-27 23:35:12 +0300 |
commit | 460075733def8bc46af867af4991ca5dff94a982 (patch) | |
tree | b00a6d49646f65dafd48d0fac8001c70c50f2410 | |
parent | f11a2c4cdbacf2a6757607e551c75c190268ce97 (diff) |
Slightly refactor Test_StaticPool_AllocateTimeout test
-rw-r--r-- | static_pool_test.go | 17 | ||||
-rw-r--r-- | worker_test.go | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/static_pool_test.go b/static_pool_test.go index ccf69596..b264fa64 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -222,17 +222,22 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { DestroyTimeout: time.Second, }, ) - - assert.NotNil(t, p) - assert.NoError(t, err) + if err != nil { + t.Fatal(err) + } done := make(chan interface{}) go func() { - _, err := p.Exec(&Payload{Body: []byte("100")}) - assert.NoError(t, err) - close(done) + if p != nil { + _, err := p.Exec(&Payload{Body: []byte("100")}) + assert.NoError(t, err) + close(done) + } else { + t.Fatal("Pool is nil") + } }() + // to ensure that worker is already busy time.Sleep(time.Millisecond * 10) diff --git a/worker_test.go b/worker_test.go index e8cbef90..c22b1db2 100644 --- a/worker_test.go +++ b/worker_test.go @@ -169,7 +169,7 @@ func Test_Broken(t *testing.T) { defer func() { err := w.Stop() - assert.Error(t, err) + assert.NoError(t, err) }() res, err := w.Exec(&Payload{Body: []byte("hello")}) |