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

Function TestQueueTransactionFlow

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

Source from the content-addressed store, hash-verified

738}
739
740func TestQueueTransactionFlow(t *testing.T) {
741 // Skip in short mode as this is a long-running test
742 if testing.Short() {
743 t.Skip("Skipping queue flow test in short mode")
744 }
745
746 // Initialize test context
747 ctx := context.Background()
748
749 // Setup real test configuration
750 cnf := &config.Configuration{
751 Redis: config.RedisConfig{
752 Dns: "localhost:6379",
753 },
754 DataSource: config.DataSourceConfig{
755 Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable",
756 },
757 Queue: config.QueueConfig{
758 WebhookQueue: "webhook_queue_test",
759 IndexQueue: "index_queue_test",
760 TransactionQueue: "transaction_queue_test",
761 NumberOfQueues: 1,
762 },
763 Server: config.ServerConfig{
764 SecretKey: "test-secret",
765 },
766 Transaction: config.TransactionConfig{
767 BatchSize: 100,
768 MaxQueueSize: 1000,
769 LockDuration: time.Second * 30,
770 IndexQueuePrefix: "test_index",
771 },
772 }
773 config.ConfigStore.Store(cnf)
774
775 // Create real datasource for integration test
776 ds, err := database.NewDataSource(cnf)
777 require.NoError(t, err, "Failed to create datasource")
778
779 // Create real LedgerForge instance
780 ledgerforge, err := NewLedgerForge(ds)
781 require.NoError(t, err, "Failed to create LedgerForge instance")
782
783 txnRef := "txn_" + model.GenerateUUIDWithSuffix("test")
784
785 // Create source balance
786 sourceBalance := &model.Balance{
787 Currency: "USD",
788 LedgerID: "general_ledger_id",
789 }
790
791 // Create destination balance
792 destBalance := &model.Balance{
793 Currency: "USD",
794 LedgerID: "general_ledger_id",
795 }
796
797 // Create balances in database

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected