Skip to content

Commit

Permalink
Make multiple queue test less finicky
Browse files Browse the repository at this point in the history
  • Loading branch information
acaloiaro committed Sep 22, 2023
1 parent 040c0de commit 6a368e0
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions backends/postgres/postgres_backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,27 @@ func TestBasicJobMultipleQueue(t *testing.T) {
t.Error(err)
}

jid, e := nq.Enqueue(ctx, &jobs.Job{
Queue: queue,
Payload: map[string]interface{}{
"message": fmt.Sprintf("hello world: %d", internal.RandInt(10000000000)),
},
})
if e != nil || jid == jobs.DuplicateJobID {
t.Error(e)
}
go func() {
jid, e := nq.Enqueue(ctx, &jobs.Job{
Queue: queue,
Payload: map[string]interface{}{
"message": fmt.Sprintf("hello world: %d", internal.RandInt(10000000000)),
},
})
if e != nil || jid == jobs.DuplicateJobID {
t.Error(e)
}

jid2, e := nq.Enqueue(ctx, &jobs.Job{
Queue: queue2,
Payload: map[string]interface{}{
"message": fmt.Sprintf("hello world: %d", internal.RandInt(10000000000)),
},
})
if e != nil || jid2 == jobs.DuplicateJobID {
t.Error(e)
}
jid2, e := nq.Enqueue(ctx, &jobs.Job{
Queue: queue2,
Payload: map[string]interface{}{
"message": fmt.Sprintf("hello world: %d", internal.RandInt(10000000000)),
},
})
if e != nil || jid2 == jobs.DuplicateJobID {
t.Error(e)
}
}()

results_loop:
for {
Expand Down

0 comments on commit 6a368e0

Please sign in to comment.