[GH-ISSUE #436] [BUG] Asynq don't work when use redis version >=6.2.4 with auth enable(redis with username/password) #198

Closed
opened 2026-03-02 05:19:33 +03:00 by kerem · 2 comments
Owner

Originally created by @cspyb on GitHub (Apr 20, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/436

Originally assigned to: @hibiken on GitHub.

Describe the bug
Asynq don't work when use redis version >=6.2.4 with auth enable(redis with username/password)

To Reproduce
Steps to reproduce the behavior (Code snippets if applicable):

  1. Setup redis-server with version 6.2.4
  2. enable redis-server requirepass with username:"default", password: "password"
  3. change "asynq_test.go" func: setup
    r = redis.NewClient(&redis.Options{
    Addr: redisAddr,
    DB: redisDB,
    Username: "default",
    Password: "password",
    }
  4. change "aysnq_test.go" func: getRedisConnOpt:
    return RedisClientOpt{
    Addr: redisAddr,
    DB: redisDB,
    Username: "default",
    Password: "password",
    }
  5. perform whole unit testing(about 90+case)
    Expected behavior
    All test cases passed.

Result
Tests failed:6, passed:110
API server listening at: [::]:33145
=== RUN TestAggregator
aggregator_test.go:159: group older than the grace period should be aggregated: mismatch found in "asynq:{default}:pending"; (-want,+got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "mygroup",
- ID: "52d83522-cf25-4c1a-a947-7f3a9cb38d7e",
- Queue: "default",
- Retry: 3,
- Timeout: 1800,
- },
- },
+ nil,
)))
aggregator_test.go:159: group older than the max-delay should be aggregated: mismatch found in "asynq:{default}:pending"; (-want,+got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "mygroup",
- ID: "3abe0748-1c8b-4472-ab0e-03aa4326a30f",
- Queue: "default",
- Retry: 4,
- Timeout: 1800,
- },
- },
+ nil,
)))
aggregator_test.go:159: group reached the max-size should be aggregated: mismatch found in "asynq:{default}:pending"; (-want,+got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "mygroup",
- ID: "320dcfcf-2ce7-4efb-be7f-05e7f19815dd",
- Queue: "default",
- Retry: 5,
- Timeout: 1800,
- },
- },
+ nil,
)))
--- FAIL: TestAggregator (30.03s)

=== RUN TestParseRedisURI
--- PASS: TestParseRedisURI (0.00s)
=== RUN TestParseRedisURIErrors
--- PASS: TestParseRedisURIErrors (0.00s)
=== RUN TestClientEnqueueWithProcessAtOption
--- PASS: TestClientEnqueueWithProcessAtOption (31.19s)
=== RUN TestClientEnqueue
--- PASS: TestClientEnqueue (0.05s)
=== RUN TestClientEnqueueWithGroupOption
--- PASS: TestClientEnqueueWithGroupOption (0.01s)
=== RUN TestClientEnqueueWithTaskIDOption
--- PASS: TestClientEnqueueWithTaskIDOption (0.00s)
=== RUN TestClientEnqueueWithConflictingTaskID
--- PASS: TestClientEnqueueWithConflictingTaskID (0.00s)
=== RUN TestClientEnqueueWithProcessInOption
--- PASS: TestClientEnqueueWithProcessInOption (0.01s)
=== RUN TestClientEnqueueError
--- PASS: TestClientEnqueueError (0.00s)
=== RUN TestClientWithDefaultOptions
--- PASS: TestClientWithDefaultOptions (0.01s)
=== RUN TestClientEnqueueUnique
--- PASS: TestClientEnqueueUnique (0.01s)
=== RUN TestClientEnqueueUniqueWithProcessInOption
--- PASS: TestClientEnqueueUniqueWithProcessInOption (0.00s)
=== RUN TestClientEnqueueUniqueWithProcessAtOption
--- PASS: TestClientEnqueueUniqueWithProcessAtOption (0.00s)
=== RUN TestForwarder
forwarder_test.go:133: mismatch found in "asynq:{default}:pending" after running forwarder: (-want, +got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "reindex",
- ID: "70906aaa-9ee3-4acb-9b1a-db5ecb68c380",
- Queue: "default",
- Retry: 25,
- Timeout: 1800,
- },
- },
+ nil,
)))
forwarder_test.go:133: mismatch found in "asynq:{critical}:pending" after running forwarder: (-want, +got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "send_email",
- ID: "a6e73eae-bb63-44bd-9d7d-6d78bfdaf9df",
- Queue: "critical",
- Retry: 25,
- Timeout: 1800,
- },
- &{
- Type: "sync",
- ID: "b231e9cb-a574-440c-a4f8-7a9be8f918df",
- Queue: "critical",
- Retry: 25,
- Timeout: 1800,
- },
- },
+ nil,
)))
forwarder_test.go:133: mismatch found in "asynq:{default}:pending" after running forwarder: (-want, +got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "gen_thumbnail",
- ID: "64d01849-8d8f-4224-a0b6-14c2b1cb71ce",
- Queue: "default",
- Retry: 25,
- Timeout: 1800,
- },
- &{
- Type: "reindex",
- ID: "70906aaa-9ee3-4acb-9b1a-db5ecb68c380",
- Queue: "default",
- Retry: 25,
- Timeout: 1800,
- },
- },
+ nil,
)))
forwarder_test.go:133: mismatch found in "asynq:{critical}:pending" after running forwarder: (-want, +got)
[]*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage(
- {
- &{
- Type: "send_email",
- ID: "a6e73eae-bb63-44bd-9d7d-6d78bfdaf9df",
- Queue: "critical",
- Retry: 25,
- Timeout: 1800,
- },
- &{
- Type: "sync",
- ID: "b231e9cb-a574-440c-a4f8-7a9be8f918df",
- Queue: "critical",
- Retry: 25,
- Timeout: 1800,
- },
- },
+ nil,
)))
--- FAIL: TestForwarder (4.02s)

=== RUN TestHealthChecker
--- PASS: TestHealthChecker (2.00s)
=== RUN TestHealthCheckerWhenRedisDown
--- PASS: TestHealthCheckerWhenRedisDown (2.00s)
=== RUN TestHeartbeater
heartbeat_test.go:300: With single queue: (*RDB).ListServers returned 2 server info, want 1
heartbeat_test.go:216: With multiple queue: (*RDB).ListServers returned 2 server info, want 1
--- FAIL: TestHeartbeater (16.03s)

=== RUN TestHeartbeaterWithRedisDown
--- PASS: TestHeartbeaterWithRedisDown (2.00s)
=== RUN TestInspectorQueues
--- PASS: TestInspectorQueues (0.01s)
=== RUN TestInspectorDeleteQueue
--- PASS: TestInspectorDeleteQueue (0.02s)
=== RUN TestInspectorDeleteQueueErrorQueueNotEmpty
--- PASS: TestInspectorDeleteQueueErrorQueueNotEmpty (0.01s)
=== RUN TestInspectorDeleteQueueErrorQueueNotFound
--- PASS: TestInspectorDeleteQueueErrorQueueNotFound (0.01s)
=== RUN TestInspectorGetQueueInfo
--- PASS: TestInspectorGetQueueInfo (0.02s)
=== RUN TestInspectorHistory
--- PASS: TestInspectorHistory (0.05s)
=== RUN TestInspectorGetTaskInfo
--- PASS: TestInspectorGetTaskInfo (0.01s)
=== RUN TestInspectorGetTaskInfoError
--- PASS: TestInspectorGetTaskInfoError (0.01s)
=== RUN TestInspectorListPendingTasks
--- PASS: TestInspectorListPendingTasks (0.01s)
=== RUN TestInspectorListActiveTasks
--- PASS: TestInspectorListActiveTasks (0.01s)
=== RUN TestInspectorListScheduledTasks
--- PASS: TestInspectorListScheduledTasks (0.01s)
=== RUN TestInspectorListRetryTasks
--- PASS: TestInspectorListRetryTasks (0.01s)
=== RUN TestInspectorListArchivedTasks
--- PASS: TestInspectorListArchivedTasks (0.01s)
=== RUN TestInspectorListCompletedTasks
--- PASS: TestInspectorListCompletedTasks (0.01s)
=== RUN TestInspectorListAggregatingTasks
--- PASS: TestInspectorListAggregatingTasks (0.02s)
=== RUN TestInspectorListAggregatingTasks/default_queue_group1
--- PASS: TestInspectorListAggregatingTasks/default_queue_group1 (0.00s)
=== RUN TestInspectorListAggregatingTasks/custom_queue_group1
--- PASS: TestInspectorListAggregatingTasks/custom_queue_group1 (0.00s)
=== RUN TestInspectorListPagination
--- PASS: TestInspectorListPagination (0.13s)
=== RUN TestInspectorListTasksQueueNotFoundError
--- PASS: TestInspectorListTasksQueueNotFoundError (0.00s)
=== RUN TestInspectorDeleteAllPendingTasks
inspector_test.go:1383: DeleteAllPendingTasks("default") = 0, want 3
--- FAIL: TestInspectorDeleteAllPendingTasks (0.03s)

=== RUN TestInspectorDeleteAllScheduledTasks
--- PASS: TestInspectorDeleteAllScheduledTasks (0.02s)
=== RUN TestInspectorDeleteAllRetryTasks
--- PASS: TestInspectorDeleteAllRetryTasks (0.01s)
=== RUN TestInspectorDeleteAllArchivedTasks
--- PASS: TestInspectorDeleteAllArchivedTasks (0.02s)
=== RUN TestInspectorDeleteAllCompletedTasks
--- PASS: TestInspectorDeleteAllCompletedTasks (0.02s)
=== RUN TestInspectorArchiveAllPendingTasks
--- PASS: TestInspectorArchiveAllPendingTasks (0.03s)
=== RUN TestInspectorArchiveAllScheduledTasks
--- PASS: TestInspectorArchiveAllScheduledTasks (0.05s)
=== RUN TestInspectorArchiveAllRetryTasks
--- PASS: TestInspectorArchiveAllRetryTasks (0.04s)
=== RUN TestInspectorRunAllScheduledTasks
--- PASS: TestInspectorRunAllScheduledTasks (0.04s)
=== RUN TestInspectorRunAllRetryTasks
--- PASS: TestInspectorRunAllRetryTasks (0.04s)
=== RUN TestInspectorRunAllArchivedTasks
--- PASS: TestInspectorRunAllArchivedTasks (0.04s)
=== RUN TestInspectorDeleteTaskDeletesPendingTask
--- PASS: TestInspectorDeleteTaskDeletesPendingTask (0.02s)
=== RUN TestInspectorDeleteTaskDeletesScheduledTask
--- PASS: TestInspectorDeleteTaskDeletesScheduledTask (0.01s)
=== RUN TestInspectorDeleteTaskDeletesRetryTask
--- PASS: TestInspectorDeleteTaskDeletesRetryTask (0.01s)
=== RUN TestInspectorDeleteTaskDeletesArchivedTask
--- PASS: TestInspectorDeleteTaskDeletesArchivedTask (0.01s)
=== RUN TestInspectorDeleteTaskError
--- PASS: TestInspectorDeleteTaskError (0.02s)
=== RUN TestInspectorRunTaskRunsScheduledTask
--- PASS: TestInspectorRunTaskRunsScheduledTask (0.01s)
=== RUN TestInspectorRunTaskRunsRetryTask
--- PASS: TestInspectorRunTaskRunsRetryTask (0.01s)
=== RUN TestInspectorRunTaskRunsArchivedTask
--- PASS: TestInspectorRunTaskRunsArchivedTask (0.02s)
=== RUN TestInspectorRunTaskError
--- PASS: TestInspectorRunTaskError (0.03s)
=== RUN TestInspectorArchiveTaskArchivesPendingTask
--- PASS: TestInspectorArchiveTaskArchivesPendingTask (0.03s)
=== RUN TestInspectorArchiveTaskArchivesScheduledTask
--- PASS: TestInspectorArchiveTaskArchivesScheduledTask (0.01s)
=== RUN TestInspectorArchiveTaskArchivesRetryTask
--- PASS: TestInspectorArchiveTaskArchivesRetryTask (0.01s)
=== RUN TestInspectorArchiveTaskError
--- PASS: TestInspectorArchiveTaskError (0.02s)
=== RUN TestInspectorSchedulerEntries
--- PASS: TestInspectorSchedulerEntries (0.00s)
=== RUN TestParseOption
--- PASS: TestParseOption (0.00s)
=== RUN TestParseOption/MaxRetry(10)
--- PASS: TestParseOption/MaxRetry(10) (0.00s)
=== RUN TestParseOption/Queue("email")
--- PASS: TestParseOption/Queue("email") (0.00s)
=== RUN TestParseOption/Timeout(3m)
--- PASS: TestParseOption/Timeout(3m) (0.00s)
=== RUN TestParseOption/Deadline(Wed_Apr_20_17:45:39_CST_2022)
--- PASS: TestParseOption/Deadline(Wed_Apr_20_17:45:39_CST_2022) (0.00s)
=== RUN TestParseOption/Unique(1h)
--- PASS: TestParseOption/Unique(1h) (0.00s)
=== RUN TestParseOption/ProcessAt(Wed_Apr_20_17:45:39_CST_2022)
--- PASS: TestParseOption/ProcessAt(Wed_Apr_20_17:45:39_CST_2022) (0.00s)
=== RUN TestParseOption/ProcessIn(10m)
--- PASS: TestParseOption/ProcessIn(10m) (0.00s)
=== RUN TestParseOption/Retention(24h)
--- PASS: TestParseOption/Retention(24h) (0.00s)
=== RUN TestInspectorGroups
--- PASS: TestInspectorGroups (0.01s)
=== RUN TestInspectorGroups/default_queue_groups
--- PASS: TestInspectorGroups/default_queue_groups (0.00s)
=== RUN TestInspectorGroups/custom_queue_groups
--- PASS: TestInspectorGroups/custom_queue_groups (0.00s)
=== RUN TestJanitor
--- PASS: TestJanitor (2.01s)
=== RUN TestNewPeriodicTaskManager
--- PASS: TestNewPeriodicTaskManager (0.00s)
=== RUN TestNewPeriodicTaskManagerError
--- PASS: TestNewPeriodicTaskManagerError (0.00s)
=== RUN TestPeriodicTaskConfigHash
--- PASS: TestPeriodicTaskConfigHash (0.00s)
=== RUN TestPeriodicTaskManager
asynq: pid=337747 2022/04/20 08:45:41.567552 INFO: Successfully registered periodic task: cronspec="* * * * 1" task="task1", entryID=6056eded-d74a-4594-96ea-ac6abce2bb98
asynq: pid=337747 2022/04/20 08:45:41.567645 INFO: Successfully registered periodic task: cronspec="* * * * 2" task="task2", entryID=79c1aa17-a111-4e77-beaf-1c3f2ae7c6f7
asynq: pid=337747 2022/04/20 08:45:41.567656 INFO: Scheduler starting
asynq: pid=337747 2022/04/20 08:45:41.567674 INFO: Scheduler timezone is set to UTC
asynq: pid=337747 2022/04/20 08:45:44.568123 INFO: Successfully unregistered periodic task: entryID=79c1aa17-a111-4e77-beaf-1c3f2ae7c6f7
asynq: pid=337747 2022/04/20 08:45:44.568362 INFO: Successfully registered periodic task: cronspec="* * * * 3" task="task3", entryID=217ba874-1091-4660-8809-a20c81fbd84d
asynq: pid=337747 2022/04/20 08:45:50.568648 INFO: Successfully unregistered periodic task: entryID=6056eded-d74a-4594-96ea-ac6abce2bb98
asynq: pid=337747 2022/04/20 08:45:50.568743 INFO: Successfully unregistered periodic task: entryID=217ba874-1091-4660-8809-a20c81fbd84d
asynq: pid=337747 2022/04/20 08:45:53.570480 INFO: Scheduler shutting down
asynq: pid=337747 2022/04/20 08:45:53.571821 INFO: Scheduler stopped
--- PASS: TestPeriodicTaskManager (12.00s)
=== RUN TestProcessorSuccessWithSingleQueue
processor_test.go:141: "asynq:{default}:active" has 1 tasks, want 0
processor_test.go:147: mismatch found in processed tasks; (-want, +got)
[]*asynq.Task(Inverse(SortMsg, []*asynq.Task(
- {&{typename: "task1"}},
+ nil,
)))
--- FAIL: TestProcessorSuccessWithSingleQueue (4.02s)

=== RUN TestProcessorSuccessWithMultipleQueues
--- PASS: TestProcessorSuccessWithMultipleQueues (2.02s)
=== RUN TestProcessTasksWithLargeNumberInPayload
processor_test.go:259: data == 111111111111111111
--- PASS: TestProcessTasksWithLargeNumberInPayload (2.01s)
=== RUN TestProcessorRetry
--- PASS: TestProcessorRetry (6.04s)
=== RUN TestProcessorMarkAsComplete
--- PASS: TestProcessorMarkAsComplete (2.02s)
=== RUN TestProcessorWithExpiredLease
--- PASS: TestProcessorWithExpiredLease (4.01s)
=== RUN TestProcessorQueues
--- PASS: TestProcessorQueues (0.00s)
=== RUN TestProcessorWithStrictPriority
--- PASS: TestProcessorWithStrictPriority (1.03s)
=== RUN TestProcessorPerform
--- PASS: TestProcessorPerform (0.00s)
=== RUN TestGCD
--- PASS: TestGCD (0.00s)
=== RUN TestNormalizeQueues
--- PASS: TestNormalizeQueues (0.00s)
=== RUN TestProcessorComputeDeadline
asynq: pid=337747 2022/04/20 08:46:14.726854 ERROR: asynq: internal error: both timeout and deadline are not set for the task message:
--- PASS: TestProcessorComputeDeadline (0.00s)
=== RUN TestRecoverer
--- PASS: TestRecoverer (10.07s)
=== RUN TestSchedulerRegister
asynq: pid=337747 2022/04/20 08:46:24.803235 INFO: Scheduler starting
asynq: pid=337747 2022/04/20 08:46:24.803271 INFO: Scheduler timezone is set to UTC
asynq: pid=337747 2022/04/20 08:46:34.804190 INFO: Scheduler shutting down
asynq: pid=337747 2022/04/20 08:46:34.807907 INFO: Scheduler stopped
scheduler_test.go:74: mismatch found in queue "default": (-want,+got)
[]*base.TaskMessage(
- {
- &{Type: "task1", Queue: "default", Retry: 10, Timeout: 1800},
- &{Type: "task1", Queue: "default", Retry: 10, Timeout: 1800},
- &{Type: "task1", Queue: "default", Retry: 10, Timeout: 1800},
- },
+ nil,
)
--- FAIL: TestSchedulerRegister (10.01s)

=== RUN TestSchedulerWhenRedisDown
asynq: pid=337747 2022/04/20 08:46:34.809292 INFO: Scheduler starting
asynq: pid=337747 2022/04/20 08:46:34.809315 INFO: Scheduler timezone is set to UTC
asynq: pid=337747 2022/04/20 08:46:37.067942 ERROR: scheduler could not enqueue a task &{typename:test payload:[] opts:[] w:}: UNKNOWN: redis command error: SADD failed: dial tcp :9876: connect: connection refused
asynq: pid=337747 2022/04/20 08:46:39.882910 WARN: Scheduler could not write heartbeat data: UNKNOWN: redis command error: ZADD failed: dial tcp :9876: connect: connection refused
asynq: pid=337747 2022/04/20 08:46:40.111410 ERROR: scheduler could not enqueue a task &{typename:test payload:[] opts:[] w:}: UNKNOWN: redis command error: SADD failed: dial tcp :9876: connect: connection refused
asynq: pid=337747 2022/04/20 08:46:43.045308 ERROR: scheduler could not enqueue a task &{typename:test payload:[] opts:[] w:}: UNKNOWN: redis command error: SADD failed: dial tcp :9876: connect: connection refused
asynq: pid=337747 2022/04/20 08:46:44.810450 INFO: Scheduler shutting down
asynq: pid=337747 2022/04/20 08:46:44.908775 WARN: Scheduler could not write heartbeat data: UNKNOWN: redis command error: ZADD failed: dial tcp :9876: connect: connection refused
asynq: pid=337747 2022/04/20 08:46:45.101413 WARN: Could not clear scheduler history for entry "ff1328c3-4ab9-4327-a686-f562ae104873": UNKNOWN: redis command error: DEL failed: dial tcp :9876: connect: connection refused
asynq: pid=337747 2022/04/20 08:46:45.101465 INFO: Scheduler stopped
--- PASS: TestSchedulerWhenRedisDown (10.29s)
=== RUN TestSchedulerUnregister
asynq: pid=337747 2022/04/20 08:46:45.103930 INFO: Scheduler starting
asynq: pid=337747 2022/04/20 08:46:45.103968 INFO: Scheduler timezone is set to UTC
asynq: pid=337747 2022/04/20 08:46:55.104895 INFO: Scheduler shutting down
asynq: pid=337747 2022/04/20 08:46:55.107170 INFO: Scheduler stopped
--- PASS: TestSchedulerUnregister (10.01s)
=== RUN TestServeMux
--- PASS: TestServeMux (0.00s)
=== RUN TestServeMuxRegisterNilHandler
--- PASS: TestServeMuxRegisterNilHandler (0.00s)
=== RUN TestServeMuxRegisterEmptyPattern
--- PASS: TestServeMuxRegisterEmptyPattern (0.00s)
=== RUN TestServeMuxRegisterDuplicatePattern
--- PASS: TestServeMuxRegisterDuplicatePattern (0.00s)
=== RUN TestServeMuxNotFound
--- PASS: TestServeMuxNotFound (0.00s)
=== RUN TestServeMuxMiddlewares
--- PASS: TestServeMuxMiddlewares (0.00s)
=== RUN TestServer
--- PASS: TestServer (1.01s)
=== RUN TestServerRun
--- PASS: TestServerRun (2.00s)
=== RUN TestServerErrServerClosed
--- PASS: TestServerErrServerClosed (0.00s)
=== RUN TestServerErrNilHandler
--- PASS: TestServerErrNilHandler (0.00s)
=== RUN TestServerErrServerRunning
--- PASS: TestServerErrServerRunning (0.01s)
=== RUN TestServerWithRedisDown
--- PASS: TestServerWithRedisDown (3.00s)
=== RUN TestServerWithFlakyBroker
--- PASS: TestServerWithFlakyBroker (7.05s)
=== RUN TestLogLevel
--- PASS: TestLogLevel (0.00s)
=== RUN TestSubscriber
--- PASS: TestSubscriber (4.01s)
=== RUN TestSubscriberWithRedisDown
--- PASS: TestSubscriberWithRedisDown (5.00s)
=== RUN TestSyncer
--- PASS: TestSyncer (2.01s)
=== RUN TestSyncerRetry
--- PASS: TestSyncerRetry (3.00s)
=== RUN TestSyncerDropsStaleRequests
--- PASS: TestSyncerDropsStaleRequests (2.00s)
=== RUN ExampleParseRedisURI
--- PASS: ExampleParseRedisURI (0.00s)
FAIL

Debugger finished with exit code 0

TestAggregator

Environment (please complete the following information):

  • OS: [Linux ubuntu 20.04]
  • Version of asynq package [e.g. v0.23.0]
Originally created by @cspyb on GitHub (Apr 20, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/436 Originally assigned to: @hibiken on GitHub. **Describe the bug** Asynq don't work when use redis version >=6.2.4 with auth enable(redis with username/password) **To Reproduce** Steps to reproduce the behavior (Code snippets if applicable): 1. Setup redis-server with version 6.2.4 2. enable redis-server requirepass with username:"default", password: "password" 4. change "asynq_test.go" func: setup r = redis.NewClient(&redis.Options{ Addr: redisAddr, DB: redisDB, Username: "default", Password: "password", } 5. change "aysnq_test.go" func: getRedisConnOpt: return RedisClientOpt{ Addr: redisAddr, DB: redisDB, Username: "default", Password: "password", } 6. perform whole unit testing(about 90+case) **Expected behavior** All test cases passed. **Result** Tests failed:6, passed:110 API server listening at: [::]:33145 === RUN TestAggregator aggregator_test.go:159: group older than the grace period should be aggregated: mismatch found in "asynq:{default}:pending"; (-want,+got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "mygroup", - ID: "52d83522-cf25-4c1a-a947-7f3a9cb38d7e", - Queue: "default", - Retry: 3, - Timeout: 1800, - }, - }, + nil, ))) aggregator_test.go:159: group older than the max-delay should be aggregated: mismatch found in "asynq:{default}:pending"; (-want,+got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "mygroup", - ID: "3abe0748-1c8b-4472-ab0e-03aa4326a30f", - Queue: "default", - Retry: 4, - Timeout: 1800, - }, - }, + nil, ))) aggregator_test.go:159: group reached the max-size should be aggregated: mismatch found in "asynq:{default}:pending"; (-want,+got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "mygroup", - ID: "320dcfcf-2ce7-4efb-be7f-05e7f19815dd", - Queue: "default", - Retry: 5, - Timeout: 1800, - }, - }, + nil, ))) --- FAIL: TestAggregator (30.03s) === RUN TestParseRedisURI --- PASS: TestParseRedisURI (0.00s) === RUN TestParseRedisURIErrors --- PASS: TestParseRedisURIErrors (0.00s) === RUN TestClientEnqueueWithProcessAtOption --- PASS: TestClientEnqueueWithProcessAtOption (31.19s) === RUN TestClientEnqueue --- PASS: TestClientEnqueue (0.05s) === RUN TestClientEnqueueWithGroupOption --- PASS: TestClientEnqueueWithGroupOption (0.01s) === RUN TestClientEnqueueWithTaskIDOption --- PASS: TestClientEnqueueWithTaskIDOption (0.00s) === RUN TestClientEnqueueWithConflictingTaskID --- PASS: TestClientEnqueueWithConflictingTaskID (0.00s) === RUN TestClientEnqueueWithProcessInOption --- PASS: TestClientEnqueueWithProcessInOption (0.01s) === RUN TestClientEnqueueError --- PASS: TestClientEnqueueError (0.00s) === RUN TestClientWithDefaultOptions --- PASS: TestClientWithDefaultOptions (0.01s) === RUN TestClientEnqueueUnique --- PASS: TestClientEnqueueUnique (0.01s) === RUN TestClientEnqueueUniqueWithProcessInOption --- PASS: TestClientEnqueueUniqueWithProcessInOption (0.00s) === RUN TestClientEnqueueUniqueWithProcessAtOption --- PASS: TestClientEnqueueUniqueWithProcessAtOption (0.00s) === RUN TestForwarder forwarder_test.go:133: mismatch found in "asynq:{default}:pending" after running forwarder: (-want, +got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "reindex", - ID: "70906aaa-9ee3-4acb-9b1a-db5ecb68c380", - Queue: "default", - Retry: 25, - Timeout: 1800, - }, - }, + nil, ))) forwarder_test.go:133: mismatch found in "asynq:{critical}:pending" after running forwarder: (-want, +got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "send_email", - ID: "a6e73eae-bb63-44bd-9d7d-6d78bfdaf9df", - Queue: "critical", - Retry: 25, - Timeout: 1800, - }, - &{ - Type: "sync", - ID: "b231e9cb-a574-440c-a4f8-7a9be8f918df", - Queue: "critical", - Retry: 25, - Timeout: 1800, - }, - }, + nil, ))) forwarder_test.go:133: mismatch found in "asynq:{default}:pending" after running forwarder: (-want, +got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "gen_thumbnail", - ID: "64d01849-8d8f-4224-a0b6-14c2b1cb71ce", - Queue: "default", - Retry: 25, - Timeout: 1800, - }, - &{ - Type: "reindex", - ID: "70906aaa-9ee3-4acb-9b1a-db5ecb68c380", - Queue: "default", - Retry: 25, - Timeout: 1800, - }, - }, + nil, ))) forwarder_test.go:133: mismatch found in "asynq:{critical}:pending" after running forwarder: (-want, +got) []*base.TaskMessage(Inverse(SortTaskMessages, []*base.TaskMessage( - { - &{ - Type: "send_email", - ID: "a6e73eae-bb63-44bd-9d7d-6d78bfdaf9df", - Queue: "critical", - Retry: 25, - Timeout: 1800, - }, - &{ - Type: "sync", - ID: "b231e9cb-a574-440c-a4f8-7a9be8f918df", - Queue: "critical", - Retry: 25, - Timeout: 1800, - }, - }, + nil, ))) --- FAIL: TestForwarder (4.02s) === RUN TestHealthChecker --- PASS: TestHealthChecker (2.00s) === RUN TestHealthCheckerWhenRedisDown --- PASS: TestHealthCheckerWhenRedisDown (2.00s) === RUN TestHeartbeater heartbeat_test.go:300: With single queue: (*RDB).ListServers returned 2 server info, want 1 heartbeat_test.go:216: With multiple queue: (*RDB).ListServers returned 2 server info, want 1 --- FAIL: TestHeartbeater (16.03s) === RUN TestHeartbeaterWithRedisDown --- PASS: TestHeartbeaterWithRedisDown (2.00s) === RUN TestInspectorQueues --- PASS: TestInspectorQueues (0.01s) === RUN TestInspectorDeleteQueue --- PASS: TestInspectorDeleteQueue (0.02s) === RUN TestInspectorDeleteQueueErrorQueueNotEmpty --- PASS: TestInspectorDeleteQueueErrorQueueNotEmpty (0.01s) === RUN TestInspectorDeleteQueueErrorQueueNotFound --- PASS: TestInspectorDeleteQueueErrorQueueNotFound (0.01s) === RUN TestInspectorGetQueueInfo --- PASS: TestInspectorGetQueueInfo (0.02s) === RUN TestInspectorHistory --- PASS: TestInspectorHistory (0.05s) === RUN TestInspectorGetTaskInfo --- PASS: TestInspectorGetTaskInfo (0.01s) === RUN TestInspectorGetTaskInfoError --- PASS: TestInspectorGetTaskInfoError (0.01s) === RUN TestInspectorListPendingTasks --- PASS: TestInspectorListPendingTasks (0.01s) === RUN TestInspectorListActiveTasks --- PASS: TestInspectorListActiveTasks (0.01s) === RUN TestInspectorListScheduledTasks --- PASS: TestInspectorListScheduledTasks (0.01s) === RUN TestInspectorListRetryTasks --- PASS: TestInspectorListRetryTasks (0.01s) === RUN TestInspectorListArchivedTasks --- PASS: TestInspectorListArchivedTasks (0.01s) === RUN TestInspectorListCompletedTasks --- PASS: TestInspectorListCompletedTasks (0.01s) === RUN TestInspectorListAggregatingTasks --- PASS: TestInspectorListAggregatingTasks (0.02s) === RUN TestInspectorListAggregatingTasks/default_queue_group1 --- PASS: TestInspectorListAggregatingTasks/default_queue_group1 (0.00s) === RUN TestInspectorListAggregatingTasks/custom_queue_group1 --- PASS: TestInspectorListAggregatingTasks/custom_queue_group1 (0.00s) === RUN TestInspectorListPagination --- PASS: TestInspectorListPagination (0.13s) === RUN TestInspectorListTasksQueueNotFoundError --- PASS: TestInspectorListTasksQueueNotFoundError (0.00s) === RUN TestInspectorDeleteAllPendingTasks inspector_test.go:1383: DeleteAllPendingTasks("default") = 0, want 3 --- FAIL: TestInspectorDeleteAllPendingTasks (0.03s) === RUN TestInspectorDeleteAllScheduledTasks --- PASS: TestInspectorDeleteAllScheduledTasks (0.02s) === RUN TestInspectorDeleteAllRetryTasks --- PASS: TestInspectorDeleteAllRetryTasks (0.01s) === RUN TestInspectorDeleteAllArchivedTasks --- PASS: TestInspectorDeleteAllArchivedTasks (0.02s) === RUN TestInspectorDeleteAllCompletedTasks --- PASS: TestInspectorDeleteAllCompletedTasks (0.02s) === RUN TestInspectorArchiveAllPendingTasks --- PASS: TestInspectorArchiveAllPendingTasks (0.03s) === RUN TestInspectorArchiveAllScheduledTasks --- PASS: TestInspectorArchiveAllScheduledTasks (0.05s) === RUN TestInspectorArchiveAllRetryTasks --- PASS: TestInspectorArchiveAllRetryTasks (0.04s) === RUN TestInspectorRunAllScheduledTasks --- PASS: TestInspectorRunAllScheduledTasks (0.04s) === RUN TestInspectorRunAllRetryTasks --- PASS: TestInspectorRunAllRetryTasks (0.04s) === RUN TestInspectorRunAllArchivedTasks --- PASS: TestInspectorRunAllArchivedTasks (0.04s) === RUN TestInspectorDeleteTaskDeletesPendingTask --- PASS: TestInspectorDeleteTaskDeletesPendingTask (0.02s) === RUN TestInspectorDeleteTaskDeletesScheduledTask --- PASS: TestInspectorDeleteTaskDeletesScheduledTask (0.01s) === RUN TestInspectorDeleteTaskDeletesRetryTask --- PASS: TestInspectorDeleteTaskDeletesRetryTask (0.01s) === RUN TestInspectorDeleteTaskDeletesArchivedTask --- PASS: TestInspectorDeleteTaskDeletesArchivedTask (0.01s) === RUN TestInspectorDeleteTaskError --- PASS: TestInspectorDeleteTaskError (0.02s) === RUN TestInspectorRunTaskRunsScheduledTask --- PASS: TestInspectorRunTaskRunsScheduledTask (0.01s) === RUN TestInspectorRunTaskRunsRetryTask --- PASS: TestInspectorRunTaskRunsRetryTask (0.01s) === RUN TestInspectorRunTaskRunsArchivedTask --- PASS: TestInspectorRunTaskRunsArchivedTask (0.02s) === RUN TestInspectorRunTaskError --- PASS: TestInspectorRunTaskError (0.03s) === RUN TestInspectorArchiveTaskArchivesPendingTask --- PASS: TestInspectorArchiveTaskArchivesPendingTask (0.03s) === RUN TestInspectorArchiveTaskArchivesScheduledTask --- PASS: TestInspectorArchiveTaskArchivesScheduledTask (0.01s) === RUN TestInspectorArchiveTaskArchivesRetryTask --- PASS: TestInspectorArchiveTaskArchivesRetryTask (0.01s) === RUN TestInspectorArchiveTaskError --- PASS: TestInspectorArchiveTaskError (0.02s) === RUN TestInspectorSchedulerEntries --- PASS: TestInspectorSchedulerEntries (0.00s) === RUN TestParseOption --- PASS: TestParseOption (0.00s) === RUN TestParseOption/MaxRetry(10) --- PASS: TestParseOption/MaxRetry(10) (0.00s) === RUN TestParseOption/Queue("email") --- PASS: TestParseOption/Queue("email") (0.00s) === RUN TestParseOption/Timeout(3m) --- PASS: TestParseOption/Timeout(3m) (0.00s) === RUN TestParseOption/Deadline(Wed_Apr_20_17:45:39_CST_2022) --- PASS: TestParseOption/Deadline(Wed_Apr_20_17:45:39_CST_2022) (0.00s) === RUN TestParseOption/Unique(1h) --- PASS: TestParseOption/Unique(1h) (0.00s) === RUN TestParseOption/ProcessAt(Wed_Apr_20_17:45:39_CST_2022) --- PASS: TestParseOption/ProcessAt(Wed_Apr_20_17:45:39_CST_2022) (0.00s) === RUN TestParseOption/ProcessIn(10m) --- PASS: TestParseOption/ProcessIn(10m) (0.00s) === RUN TestParseOption/Retention(24h) --- PASS: TestParseOption/Retention(24h) (0.00s) === RUN TestInspectorGroups --- PASS: TestInspectorGroups (0.01s) === RUN TestInspectorGroups/default_queue_groups --- PASS: TestInspectorGroups/default_queue_groups (0.00s) === RUN TestInspectorGroups/custom_queue_groups --- PASS: TestInspectorGroups/custom_queue_groups (0.00s) === RUN TestJanitor --- PASS: TestJanitor (2.01s) === RUN TestNewPeriodicTaskManager --- PASS: TestNewPeriodicTaskManager (0.00s) === RUN TestNewPeriodicTaskManagerError --- PASS: TestNewPeriodicTaskManagerError (0.00s) === RUN TestPeriodicTaskConfigHash --- PASS: TestPeriodicTaskConfigHash (0.00s) === RUN TestPeriodicTaskManager asynq: pid=337747 2022/04/20 08:45:41.567552 INFO: Successfully registered periodic task: cronspec="* * * * 1" task="task1", entryID=6056eded-d74a-4594-96ea-ac6abce2bb98 asynq: pid=337747 2022/04/20 08:45:41.567645 INFO: Successfully registered periodic task: cronspec="* * * * 2" task="task2", entryID=79c1aa17-a111-4e77-beaf-1c3f2ae7c6f7 asynq: pid=337747 2022/04/20 08:45:41.567656 INFO: Scheduler starting asynq: pid=337747 2022/04/20 08:45:41.567674 INFO: Scheduler timezone is set to UTC asynq: pid=337747 2022/04/20 08:45:44.568123 INFO: Successfully unregistered periodic task: entryID=79c1aa17-a111-4e77-beaf-1c3f2ae7c6f7 asynq: pid=337747 2022/04/20 08:45:44.568362 INFO: Successfully registered periodic task: cronspec="* * * * 3" task="task3", entryID=217ba874-1091-4660-8809-a20c81fbd84d asynq: pid=337747 2022/04/20 08:45:50.568648 INFO: Successfully unregistered periodic task: entryID=6056eded-d74a-4594-96ea-ac6abce2bb98 asynq: pid=337747 2022/04/20 08:45:50.568743 INFO: Successfully unregistered periodic task: entryID=217ba874-1091-4660-8809-a20c81fbd84d asynq: pid=337747 2022/04/20 08:45:53.570480 INFO: Scheduler shutting down asynq: pid=337747 2022/04/20 08:45:53.571821 INFO: Scheduler stopped --- PASS: TestPeriodicTaskManager (12.00s) === RUN TestProcessorSuccessWithSingleQueue processor_test.go:141: "asynq:{default}:active" has 1 tasks, want 0 processor_test.go:147: mismatch found in processed tasks; (-want, +got) []*asynq.Task(Inverse(SortMsg, []*asynq.Task( - {&{typename: "task1"}}, + nil, ))) --- FAIL: TestProcessorSuccessWithSingleQueue (4.02s) === RUN TestProcessorSuccessWithMultipleQueues --- PASS: TestProcessorSuccessWithMultipleQueues (2.02s) === RUN TestProcessTasksWithLargeNumberInPayload processor_test.go:259: data == 111111111111111111 --- PASS: TestProcessTasksWithLargeNumberInPayload (2.01s) === RUN TestProcessorRetry --- PASS: TestProcessorRetry (6.04s) === RUN TestProcessorMarkAsComplete --- PASS: TestProcessorMarkAsComplete (2.02s) === RUN TestProcessorWithExpiredLease --- PASS: TestProcessorWithExpiredLease (4.01s) === RUN TestProcessorQueues --- PASS: TestProcessorQueues (0.00s) === RUN TestProcessorWithStrictPriority --- PASS: TestProcessorWithStrictPriority (1.03s) === RUN TestProcessorPerform --- PASS: TestProcessorPerform (0.00s) === RUN TestGCD --- PASS: TestGCD (0.00s) === RUN TestNormalizeQueues --- PASS: TestNormalizeQueues (0.00s) === RUN TestProcessorComputeDeadline asynq: pid=337747 2022/04/20 08:46:14.726854 ERROR: asynq: internal error: both timeout and deadline are not set for the task message: --- PASS: TestProcessorComputeDeadline (0.00s) === RUN TestRecoverer --- PASS: TestRecoverer (10.07s) === RUN TestSchedulerRegister asynq: pid=337747 2022/04/20 08:46:24.803235 INFO: Scheduler starting asynq: pid=337747 2022/04/20 08:46:24.803271 INFO: Scheduler timezone is set to UTC asynq: pid=337747 2022/04/20 08:46:34.804190 INFO: Scheduler shutting down asynq: pid=337747 2022/04/20 08:46:34.807907 INFO: Scheduler stopped scheduler_test.go:74: mismatch found in queue "default": (-want,+got) []*base.TaskMessage( - { - &{Type: "task1", Queue: "default", Retry: 10, Timeout: 1800}, - &{Type: "task1", Queue: "default", Retry: 10, Timeout: 1800}, - &{Type: "task1", Queue: "default", Retry: 10, Timeout: 1800}, - }, + nil, ) --- FAIL: TestSchedulerRegister (10.01s) === RUN TestSchedulerWhenRedisDown asynq: pid=337747 2022/04/20 08:46:34.809292 INFO: Scheduler starting asynq: pid=337747 2022/04/20 08:46:34.809315 INFO: Scheduler timezone is set to UTC asynq: pid=337747 2022/04/20 08:46:37.067942 ERROR: scheduler could not enqueue a task &{typename:test payload:[] opts:[] w:<nil>}: UNKNOWN: redis command error: SADD failed: dial tcp :9876: connect: connection refused asynq: pid=337747 2022/04/20 08:46:39.882910 WARN: Scheduler could not write heartbeat data: UNKNOWN: redis command error: ZADD failed: dial tcp :9876: connect: connection refused asynq: pid=337747 2022/04/20 08:46:40.111410 ERROR: scheduler could not enqueue a task &{typename:test payload:[] opts:[] w:<nil>}: UNKNOWN: redis command error: SADD failed: dial tcp :9876: connect: connection refused asynq: pid=337747 2022/04/20 08:46:43.045308 ERROR: scheduler could not enqueue a task &{typename:test payload:[] opts:[] w:<nil>}: UNKNOWN: redis command error: SADD failed: dial tcp :9876: connect: connection refused asynq: pid=337747 2022/04/20 08:46:44.810450 INFO: Scheduler shutting down asynq: pid=337747 2022/04/20 08:46:44.908775 WARN: Scheduler could not write heartbeat data: UNKNOWN: redis command error: ZADD failed: dial tcp :9876: connect: connection refused asynq: pid=337747 2022/04/20 08:46:45.101413 WARN: Could not clear scheduler history for entry "ff1328c3-4ab9-4327-a686-f562ae104873": UNKNOWN: redis command error: DEL failed: dial tcp :9876: connect: connection refused asynq: pid=337747 2022/04/20 08:46:45.101465 INFO: Scheduler stopped --- PASS: TestSchedulerWhenRedisDown (10.29s) === RUN TestSchedulerUnregister asynq: pid=337747 2022/04/20 08:46:45.103930 INFO: Scheduler starting asynq: pid=337747 2022/04/20 08:46:45.103968 INFO: Scheduler timezone is set to UTC asynq: pid=337747 2022/04/20 08:46:55.104895 INFO: Scheduler shutting down asynq: pid=337747 2022/04/20 08:46:55.107170 INFO: Scheduler stopped --- PASS: TestSchedulerUnregister (10.01s) === RUN TestServeMux --- PASS: TestServeMux (0.00s) === RUN TestServeMuxRegisterNilHandler --- PASS: TestServeMuxRegisterNilHandler (0.00s) === RUN TestServeMuxRegisterEmptyPattern --- PASS: TestServeMuxRegisterEmptyPattern (0.00s) === RUN TestServeMuxRegisterDuplicatePattern --- PASS: TestServeMuxRegisterDuplicatePattern (0.00s) === RUN TestServeMuxNotFound --- PASS: TestServeMuxNotFound (0.00s) === RUN TestServeMuxMiddlewares --- PASS: TestServeMuxMiddlewares (0.00s) === RUN TestServer --- PASS: TestServer (1.01s) === RUN TestServerRun --- PASS: TestServerRun (2.00s) === RUN TestServerErrServerClosed --- PASS: TestServerErrServerClosed (0.00s) === RUN TestServerErrNilHandler --- PASS: TestServerErrNilHandler (0.00s) === RUN TestServerErrServerRunning --- PASS: TestServerErrServerRunning (0.01s) === RUN TestServerWithRedisDown --- PASS: TestServerWithRedisDown (3.00s) === RUN TestServerWithFlakyBroker --- PASS: TestServerWithFlakyBroker (7.05s) === RUN TestLogLevel --- PASS: TestLogLevel (0.00s) === RUN TestSubscriber --- PASS: TestSubscriber (4.01s) === RUN TestSubscriberWithRedisDown --- PASS: TestSubscriberWithRedisDown (5.00s) === RUN TestSyncer --- PASS: TestSyncer (2.01s) === RUN TestSyncerRetry --- PASS: TestSyncerRetry (3.00s) === RUN TestSyncerDropsStaleRequests --- PASS: TestSyncerDropsStaleRequests (2.00s) === RUN ExampleParseRedisURI --- PASS: ExampleParseRedisURI (0.00s) FAIL Debugger finished with exit code 0 TestAggregator **Environment (please complete the following information):** - OS: [Linux ubuntu 20.04] - Version of `asynq` package [e.g. v0.23.0]
kerem 2026-03-02 05:19:33 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@hibiken commented on GitHub (Apr 22, 2022):

@cspyb Thank you for reporting this!

Is this issue mostly around test failures? Or are you having issues connecting to a Redis server with auth enabled?


If it's the former, I tried reproducing this on my machine by doing the following:

  1. Add the following line to redis.conf file requirepass foobared
  2. Start a redis server with the redis.conf file; Confirmed that the auth is enabled by running redis-cli AUTH default foobared
  3. Update test setup and getRedisConnOpt helper functions to provide the username and password
  4. Running the test; All test passed

Did I missing something? I'm not sure if it's due to some flaky tests (in which case, could you run the test multiple times to confirm the tests are flaky?)

<!-- gh-comment-id:1105873305 --> @hibiken commented on GitHub (Apr 22, 2022): @cspyb Thank you for reporting this! Is this issue mostly around test failures? Or are you having issues connecting to a Redis server with auth enabled? --- If it's the former, I tried reproducing this on my machine by doing the following: 1. Add the following line to redis.conf file `requirepass foobared` 2. Start a redis server with the redis.conf file; Confirmed that the auth is enabled by running `redis-cli AUTH default foobared` 3. Update test `setup` and `getRedisConnOpt` helper functions to provide the username and password 4. Running the test; **All test passed** Did I missing something? I'm not sure if it's due to some flaky tests (in which case, could you run the test multiple times to confirm the tests are flaky?)
Author
Owner

@hibiken commented on GitHub (May 6, 2022):

Closing (see https://github.com/hibiken/asynq/issues/438#issuecomment-1106029742)

<!-- gh-comment-id:1120080469 --> @hibiken commented on GitHub (May 6, 2022): Closing (see https://github.com/hibiken/asynq/issues/438#issuecomment-1106029742)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#198
No description provided.