MCPcopy Index your code
hub / github.com/devaccuracy/ledgerforge / TestInflightTransactionFlowWithSkipQueue

Function TestInflightTransactionFlowWithSkipQueue

transaction_test.go:959–1057  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

957}
958
959func TestInflightTransactionFlowWithSkipQueue(t *testing.T) {
960 // Skip in short mode
961 if testing.Short() {
962 t.Skip("Skipping queue flow test in short mode")
963 }
964
965 ctx := context.Background()
966 cnf := &config.Configuration{
967 Redis: config.RedisConfig{
968 Dns: "localhost:6379",
969 },
970 DataSource: config.DataSourceConfig{
971 Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable",
972 },
973 Queue: config.QueueConfig{
974 WebhookQueue: "webhook_queue_test",
975 IndexQueue: "index_queue_test",
976 TransactionQueue: "transaction_queue_test",
977 NumberOfQueues: 1,
978 },
979 Server: config.ServerConfig{
980 SecretKey: "test-secret",
981 },
982 Transaction: config.TransactionConfig{
983 BatchSize: 100,
984 MaxQueueSize: 1000,
985 LockDuration: time.Second * 30,
986 IndexQueuePrefix: "test_index",
987 },
988 }
989 config.ConfigStore.Store(cnf)
990
991 ds, err := database.NewDataSource(cnf)
992 require.NoError(t, err, "Failed to create datasource")
993
994 ledgerforge, err := NewLedgerForge(ds)
995 require.NoError(t, err, "Failed to create LedgerForge instance")
996
997 txnRef := "txn_" + model.GenerateUUIDWithSuffix("test")
998
999 // Create test balances
1000 sourceBalance := &model.Balance{
1001 Currency: "USD",
1002 LedgerID: "general_ledger_id",
1003 }
1004 destBalance := &model.Balance{
1005 Currency: "USD",
1006 LedgerID: "general_ledger_id",
1007 }
1008
1009 source, err := ds.CreateBalance(*sourceBalance)
1010 require.NoError(t, err, "Failed to create source balance")
1011
1012 dest, err := ds.CreateBalance(*destBalance)
1013 require.NoError(t, err, "Failed to create destination balance")
1014
1015 // Create transaction with skip_queue set to true
1016 txn := &model.Transaction{

Callers

nothing calls this directly

Calls 7

QueueTransactionMethod · 0.95
NewDataSourceFunction · 0.92
GenerateUUIDWithSuffixFunction · 0.92
NewLedgerForgeFunction · 0.85
CreateBalanceMethod · 0.65
GetBalanceByIDLiteMethod · 0.65
GetTransactionByRefMethod · 0.65

Tested by

no test coverage detected