(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestEnqueueWithAsynqClientEnqueueError(t *testing.T) { |
| 147 | conf := &config.Configuration{ |
| 148 | Redis: config.RedisConfig{ |
| 149 | Dns: testRedisAddr(), |
| 150 | }, |
| 151 | Queue: config.QueueConfig{ |
| 152 | WebhookQueue: "webhook_queue", |
| 153 | NumberOfQueues: 1, |
| 154 | }, |
| 155 | } |
| 156 | |
| 157 | client := asynq.NewClient(asynq.RedisClientOpt{Addr: testRedisAddr()}) |
| 158 | inspector := asynq.NewInspector(asynq.RedisClientOpt{Addr: testRedisAddr()}) |
| 159 | |
| 160 | q := NewQueue(conf, client) |
| 161 | q.Inspector = inspector |
| 162 | |
| 163 | transaction := getTransactionMock(100, false) |
| 164 | |
| 165 | _, err := json.Marshal(transaction) |
| 166 | assert.NoError(t, err) |
| 167 | |
| 168 | err = q.Enqueue(context.Background(), &transaction) |
| 169 | assert.NoError(t, err) |
| 170 | |
| 171 | task, err := inspector.GetTaskInfo(conf.Queue.WebhookQueue, "tx_1235") |
| 172 | if err != nil { |
| 173 | return |
| 174 | } |
| 175 | |
| 176 | assert.Equal(t, "tx_123", task.ID) |
| 177 | } |
nothing calls this directly
no test coverage detected