(t *testing.T)
| 1190 | } |
| 1191 | |
| 1192 | func TestLineageInflightVoid(t *testing.T) { |
| 1193 | if testing.Short() { |
| 1194 | t.Skip("Skipping lineage integration test in short mode") |
| 1195 | } |
| 1196 | |
| 1197 | ctx := context.Background() |
| 1198 | |
| 1199 | cnf := &config.Configuration{ |
| 1200 | Redis: config.RedisConfig{ |
| 1201 | Dns: "localhost:6379", |
| 1202 | }, |
| 1203 | DataSource: config.DataSourceConfig{ |
| 1204 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 1205 | }, |
| 1206 | Queue: config.QueueConfig{ |
| 1207 | WebhookQueue: "webhook_queue_test", |
| 1208 | IndexQueue: "index_queue_test", |
| 1209 | TransactionQueue: "transaction_queue_test", |
| 1210 | NumberOfQueues: 1, |
| 1211 | }, |
| 1212 | Server: config.ServerConfig{ |
| 1213 | SecretKey: "test-secret", |
| 1214 | }, |
| 1215 | Transaction: config.TransactionConfig{ |
| 1216 | BatchSize: 100, |
| 1217 | MaxQueueSize: 1000, |
| 1218 | LockDuration: time.Second * 30, |
| 1219 | IndexQueuePrefix: "test_index", |
| 1220 | }, |
| 1221 | } |
| 1222 | config.ConfigStore.Store(cnf) |
| 1223 | |
| 1224 | ds, err := database.NewDataSource(cnf) |
| 1225 | require.NoError(t, err, "Failed to create datasource") |
| 1226 | |
| 1227 | ledgerforge, err := NewLedgerForge(ds) |
| 1228 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 1229 | |
| 1230 | // Start the lineage outbox processor to process lineage entries asynchronously |
| 1231 | processor := NewLineageOutboxProcessor(ledgerforge).WithPollInterval(100 * time.Millisecond) |
| 1232 | processor.Start(ctx) |
| 1233 | defer processor.Stop() |
| 1234 | |
| 1235 | suffix := fmt.Sprintf("%d", time.Now().UnixNano()) |
| 1236 | |
| 1237 | identity, err := ds.CreateIdentity(model.Identity{ |
| 1238 | FirstName: fmt.Sprintf("Void_%s", suffix), |
| 1239 | LastName: "Test", |
| 1240 | Category: "individual", |
| 1241 | }) |
| 1242 | require.NoError(t, err) |
| 1243 | |
| 1244 | balance, err := ds.CreateBalance(model.Balance{ |
| 1245 | Currency: "USD", |
| 1246 | LedgerID: GeneralLedgerID, |
| 1247 | IdentityID: identity.IdentityID, |
| 1248 | TrackFundLineage: true, |
| 1249 | AllocationStrategy: "FIFO", |
nothing calls this directly
no test coverage detected