MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestLineageToLineageTransfer

Function TestLineageToLineageTransfer

lineage_integration_test.go:353–564  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

351}
352
353func 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",

Callers

nothing calls this directly

Calls 14

QueueTransactionMethod · 0.95
GetBalanceLineageMethod · 0.95
GetTransactionLineageMethod · 0.95
NewDataSourceFunction · 0.92
NewLedgerForgeFunction · 0.85
pollForLineageMappingsFunction · 0.85
pollForBalanceFunction · 0.85
WithPollIntervalMethod · 0.80
CreateIdentityMethod · 0.65
CreateBalanceMethod · 0.65

Tested by

no test coverage detected