(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestEnqueueScheduledTransaction(t *testing.T) { |
| 71 | conf := &config.Configuration{ |
| 72 | Redis: config.RedisConfig{ |
| 73 | Dns: testRedisAddr(), |
| 74 | }, |
| 75 | Queue: config.QueueConfig{ |
| 76 | WebhookQueue: "webhook_queue", |
| 77 | NumberOfQueues: 1, |
| 78 | }, |
| 79 | } |
| 80 | config.ConfigStore.Store(conf) |
| 81 | |
| 82 | client := asynq.NewClient(asynq.RedisClientOpt{Addr: testRedisAddr()}) |
| 83 | inspector := asynq.NewInspector(asynq.RedisClientOpt{Addr: testRedisAddr()}) |
| 84 | |
| 85 | q := NewQueue(conf, client) |
| 86 | q.Inspector = inspector |
| 87 | |
| 88 | transaction := getTransactionMock(100, false) |
| 89 | |
| 90 | _, err := json.Marshal(transaction) |
| 91 | assert.NoError(t, err) |
| 92 | |
| 93 | err = q.Enqueue(context.Background(), &transaction) |
| 94 | assert.NoError(t, err) |
| 95 | |
| 96 | task, err := inspector.GetTaskInfo(conf.Queue.WebhookQueue, transaction.TransactionID) |
| 97 | if err != nil { |
| 98 | return |
| 99 | } |
| 100 | assert.Equal(t, "tx_123", task.ID) |
| 101 | } |
| 102 | |
| 103 | func TestQueueInflightCommitSkipsWhenDateIsZero(t *testing.T) { |
| 104 | conf := &config.Configuration{ |
nothing calls this directly
no test coverage detected