(t *testing.T)
| 4092 | } |
| 4093 | |
| 4094 | func TestVoidWorkerFullFlow(t *testing.T) { |
| 4095 | // Skip in short mode |
| 4096 | if testing.Short() { |
| 4097 | t.Skip("Skipping void worker test in short mode") |
| 4098 | } |
| 4099 | |
| 4100 | ctx := context.Background() |
| 4101 | cnf := &config.Configuration{ |
| 4102 | Redis: config.RedisConfig{ |
| 4103 | Dns: "localhost:6379", |
| 4104 | }, |
| 4105 | DataSource: config.DataSourceConfig{ |
| 4106 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 4107 | }, |
| 4108 | Queue: config.QueueConfig{ |
| 4109 | WebhookQueue: "webhook_queue_test", |
| 4110 | IndexQueue: "index_queue_test", |
| 4111 | TransactionQueue: "transaction_queue_test", |
| 4112 | NumberOfQueues: 1, |
| 4113 | }, |
| 4114 | Server: config.ServerConfig{ |
| 4115 | SecretKey: "test-secret", |
| 4116 | }, |
| 4117 | Transaction: config.TransactionConfig{ |
| 4118 | BatchSize: 100, |
| 4119 | MaxQueueSize: 1000, |
| 4120 | LockDuration: time.Second * 30, |
| 4121 | IndexQueuePrefix: "test_index", |
| 4122 | }, |
| 4123 | } |
| 4124 | config.ConfigStore.Store(cnf) |
| 4125 | |
| 4126 | ds, err := database.NewDataSource(cnf) |
| 4127 | require.NoError(t, err, "Failed to create datasource") |
| 4128 | |
| 4129 | ledgerforge, err := NewLedgerForge(ds) |
| 4130 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 4131 | |
| 4132 | // Create test balances with initial amounts of zero |
| 4133 | sourceBalance := &model.Balance{ |
| 4134 | Currency: "USD", |
| 4135 | LedgerID: "general_ledger_id", |
| 4136 | } |
| 4137 | destBalance := &model.Balance{ |
| 4138 | Currency: "USD", |
| 4139 | LedgerID: "general_ledger_id", |
| 4140 | } |
| 4141 | |
| 4142 | source, err := ds.CreateBalance(*sourceBalance) |
| 4143 | require.NoError(t, err, "Failed to create source balance") |
| 4144 | |
| 4145 | dest, err := ds.CreateBalance(*destBalance) |
| 4146 | require.NoError(t, err, "Failed to create destination balance") |
| 4147 | |
| 4148 | // Step 1: Create an inflight transaction with skip_queue set to true |
| 4149 | txnRef := "txn_" + model.GenerateUUIDWithSuffix("void_flow_test") |
| 4150 | txn := &model.Transaction{ |
| 4151 | Reference: txnRef, |
nothing calls this directly
no test coverage detected