forked from Jesse0Michael/rmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_util.go
41 lines (36 loc) · 903 Bytes
/
test_util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package rmq
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func eventuallyReady(t *testing.T, queue Queue, expectedReady int64) {
t.Helper()
assert.Eventually(t, func() bool {
count, err := queue.readyCount()
if err != nil {
return false
}
return count == expectedReady
}, 10*time.Second, 2*time.Millisecond)
}
func eventuallyUnacked(t *testing.T, queue Queue, expectedUnacked int64) {
t.Helper()
assert.Eventually(t, func() bool {
count, err := queue.unackedCount()
if err != nil {
return false
}
return count == expectedUnacked
}, 10*time.Second, 2*time.Millisecond)
}
func eventuallyRejected(t *testing.T, queue Queue, expectedRejected int64) {
t.Helper()
assert.Eventually(t, func() bool {
count, err := queue.rejectedCount()
if err != nil {
return false
}
return count == expectedRejected
}, 10*time.Second, 2*time.Millisecond)
}