(t *testing.T)
| 4601 | } |
| 4602 | |
| 4603 | func TestQueueTransactionFlowAsyncPolled(t *testing.T) { |
| 4604 | // Skip in short mode |
| 4605 | if testing.Short() { |
| 4606 | t.Skip("Skipping queue flow test in short mode") |
| 4607 | } |
| 4608 | |
| 4609 | ctx := context.Background() |
| 4610 | cnf := &config.Configuration{ |
| 4611 | Redis: config.RedisConfig{ |
| 4612 | Dns: "localhost:6379", // Ensure Redis is running for queue tests |
| 4613 | }, |
| 4614 | DataSource: config.DataSourceConfig{ |
| 4615 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", // Ensure Postgres is running |
| 4616 | }, |
| 4617 | Queue: config.QueueConfig{ // Ensure queue names are unique if tests run in parallel |
| 4618 | WebhookQueue: "webhook_queue_test_async_polled", |
| 4619 | IndexQueue: "index_queue_test_async_polled", |
| 4620 | TransactionQueue: "transaction_queue_test_async_polled", // Base name for transaction queue |
| 4621 | NumberOfQueues: 1, // Test with one queue for simplicity |
| 4622 | InflightExpiryQueue: "inflight_expiry_queue_test_async_polled", |
| 4623 | }, |
| 4624 | Server: config.ServerConfig{ |
| 4625 | SecretKey: "test-secret-async-polled", |
| 4626 | }, |
| 4627 | Transaction: config.TransactionConfig{ |
| 4628 | BatchSize: 100, |
| 4629 | MaxQueueSize: 1000, |
| 4630 | LockDuration: time.Second * 30, |
| 4631 | IndexQueuePrefix: "test_index_async_polled", |
| 4632 | }, |
| 4633 | } |
| 4634 | config.ConfigStore.Store(cnf) |
| 4635 | |
| 4636 | ds, err := database.NewDataSource(cnf) |
| 4637 | require.NoError(t, err, "Failed to create datasource") |
| 4638 | |
| 4639 | ledgerforgeInstance, err := NewLedgerForge(ds) |
| 4640 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 4641 | |
| 4642 | // Construct the specific transaction queue name |
| 4643 | transactionQueueName := fmt.Sprintf("%s_%d", cnf.Queue.TransactionQueue, 1) |
| 4644 | |
| 4645 | // Start the test Asynq worker |
| 4646 | cleanupWorker := startTestAsynqWorker(t, cnf, ledgerforgeInstance, transactionQueueName) |
| 4647 | defer cleanupWorker() |
| 4648 | |
| 4649 | txnRef := "txn_" + model.GenerateUUIDWithSuffix("test_async_polled") |
| 4650 | |
| 4651 | sourceBalance := &model.Balance{ |
| 4652 | Currency: "USD", |
| 4653 | LedgerID: "general_ledger_id", |
| 4654 | } |
| 4655 | destBalance := &model.Balance{ |
| 4656 | Currency: "USD", |
| 4657 | LedgerID: "general_ledger_id", |
| 4658 | } |
| 4659 | |
| 4660 | source, err := ds.CreateBalance(*sourceBalance) |
nothing calls this directly
no test coverage detected