(t *testing.T)
| 351 | } |
| 352 | |
| 353 | func TestLineageToLineageTransfer(t *testing.T) { |
| 354 | if testing.Short() { |
| 355 | t.Skip("Skipping lineage integration test in short mode") |
| 356 | } |
| 357 | |
| 358 | ctx := context.Background() |
| 359 | pollInterval := 200 * time.Millisecond |
| 360 | pollTimeout := 15 * time.Second |
| 361 | |
| 362 | cnf := &config.Configuration{ |
| 363 | Redis: config.RedisConfig{ |
| 364 | Dns: "localhost:6379", |
| 365 | }, |
| 366 | DataSource: config.DataSourceConfig{ |
| 367 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 368 | }, |
| 369 | Queue: config.QueueConfig{ |
| 370 | WebhookQueue: "webhook_queue_test", |
| 371 | IndexQueue: "index_queue_test", |
| 372 | TransactionQueue: "transaction_queue_test", |
| 373 | NumberOfQueues: 1, |
| 374 | }, |
| 375 | Server: config.ServerConfig{ |
| 376 | SecretKey: "test-secret", |
| 377 | }, |
| 378 | Transaction: config.TransactionConfig{ |
| 379 | BatchSize: 100, |
| 380 | MaxQueueSize: 1000, |
| 381 | LockDuration: time.Second * 30, |
| 382 | IndexQueuePrefix: "test_index", |
| 383 | }, |
| 384 | } |
| 385 | config.ConfigStore.Store(cnf) |
| 386 | |
| 387 | ds, err := database.NewDataSource(cnf) |
| 388 | require.NoError(t, err, "Failed to create datasource") |
| 389 | |
| 390 | ledgerforge, err := NewLedgerForge(ds) |
| 391 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 392 | |
| 393 | // Start the lineage outbox processor to process lineage entries asynchronously |
| 394 | processor := NewLineageOutboxProcessor(ledgerforge).WithPollInterval(100 * time.Millisecond) |
| 395 | processor.Start(ctx) |
| 396 | defer processor.Stop() |
| 397 | |
| 398 | suffix := fmt.Sprintf("%d", time.Now().UnixNano()) |
| 399 | |
| 400 | senderIdentity, err := ds.CreateIdentity(model.Identity{ |
| 401 | FirstName: fmt.Sprintf("Sender_%s", suffix), |
| 402 | LastName: "User", |
| 403 | Category: "individual", |
| 404 | }) |
| 405 | require.NoError(t, err) |
| 406 | |
| 407 | receiverIdentity, err := ds.CreateIdentity(model.Identity{ |
| 408 | FirstName: fmt.Sprintf("Receiver_%s", suffix), |
| 409 | LastName: "User", |
| 410 | Category: "individual", |
nothing calls this directly
no test coverage detected