mirror of
https://github.com/hibiken/asynq.git
synced 2025-04-20 15:50:20 +08:00
fix test
This commit is contained in:
parent
2bace4cce4
commit
8d2955efc1
@ -18,11 +18,12 @@ import (
|
|||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/google/go-cmp/cmp/cmpopts"
|
"github.com/google/go-cmp/cmp/cmpopts"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/errors"
|
"github.com/hibiken/asynq/internal/errors"
|
||||||
h "github.com/hibiken/asynq/internal/testutil"
|
h "github.com/hibiken/asynq/internal/testutil"
|
||||||
"github.com/hibiken/asynq/internal/timeutil"
|
"github.com/hibiken/asynq/internal/timeutil"
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// variables used for package testing.
|
// variables used for package testing.
|
||||||
@ -553,8 +554,14 @@ func TestDequeueWithQueueConcurrency(t *testing.T) {
|
|||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
h.FlushDB(t, r.client) // clean up db before each test case
|
h.FlushDB(t, r.client) // clean up db before each test case
|
||||||
h.SeedAllPendingQueues(t, r.client, tc.pending)
|
h.SeedAllPendingQueues(t, r.client, tc.pending)
|
||||||
|
r.queueConcurrency.Range(func(key, value interface{}) bool {
|
||||||
|
r.queueConcurrency.Delete(key)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
for queue, n := range tc.queueConcurrency {
|
||||||
|
r.queueConcurrency.Store(queue, n)
|
||||||
|
}
|
||||||
|
|
||||||
r.queueConcurrency = tc.queueConcurrency
|
|
||||||
gotMsgs := make([]*base.TaskMessage, 0, len(msgs))
|
gotMsgs := make([]*base.TaskMessage, 0, len(msgs))
|
||||||
for i := 0; i < len(msgs); i++ {
|
for i := 0; i < len(msgs); i++ {
|
||||||
msg, _, err := r.Dequeue(tc.qnames...)
|
msg, _, err := r.Dequeue(tc.qnames...)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user