diff options
author | Valery Piashchynski <[email protected]> | 2020-02-28 12:59:56 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-28 12:59:56 +0300 |
commit | 116d338930665a374670ed571fa8a9e0078c43ad (patch) | |
tree | 7db612022df83111cc39885be78194240b6cbce7 /static_pool_test.go | |
parent | 73f0346ab726e03833b8c5fd04258769d08dd8d4 (diff) |
Test_StaticPool_AllocateTimeout update
Diffstat (limited to 'static_pool_test.go')
-rw-r--r-- | static_pool_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/static_pool_test.go b/static_pool_test.go index 59822186..565f4686 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -228,6 +228,7 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { } done := make(chan interface{}) + go func() { if p != nil { _, err := p.Exec(&Payload{Body: []byte("100")}) @@ -236,17 +237,17 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { } else { panic("Pool is nil") } - }() + // to ensure that worker is already busy + time.Sleep(time.Millisecond * 100) - // to ensure that worker is already busy - time.Sleep(time.Millisecond * 10) + _, err = p.Exec(&Payload{Body: []byte("10")}) + if err == nil { + t.Fatal("Test_StaticPool_AllocateTimeout exec should raise error") + } + assert.Contains(t, err.Error(), "worker timeout") + }() - _, err = p.Exec(&Payload{Body: []byte("10")}) - if err == nil { - t.Fatal("Test_StaticPool_AllocateTimeout exec should raise error") - } - assert.Contains(t, err.Error(), "worker timeout") <-done p.Destroy() |