Skip to content

Commit c256bfd

Browse files
authored
chore: Add testing default flow (#8)
* chore: Add testing default flow Signed-off-by: Bo-Yi Wu <[email protected]> * update Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 1085eca commit c256bfd

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

nsq/nsq_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ import (
1111

1212
var host = "nsq"
1313

14+
func TestDefaultFlow(t *testing.T) {
15+
m := &Job{
16+
Body: []byte("foo"),
17+
}
18+
w := NewWorker(
19+
WithAddr(host+":4150"),
20+
WithTopic("test"),
21+
)
22+
q, err := queue.NewQueue(
23+
queue.WithWorker(w),
24+
queue.WithWorkerCount(2),
25+
)
26+
assert.NoError(t, err)
27+
q.Start()
28+
time.Sleep(100 * time.Millisecond)
29+
assert.NoError(t, q.Queue(m))
30+
m.Body = []byte("new message")
31+
assert.NoError(t, q.Queue(m))
32+
q.Shutdown()
33+
q.Wait()
34+
}
35+
1436
func TestShutdown(t *testing.T) {
1537
w := NewWorker(
1638
WithAddr(host+":4150"),

0 commit comments

Comments
 (0)