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

Function TestQueueTransactionFlowWithSkipQueue

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

Source from the content-addressed store, hash-verified

858}
859
860func TestQueueTransactionFlowWithSkipQueue(t *testing.T) {
861 // Skip in short mode
862 if testing.Short() {
863 t.Skip("Skipping queue flow test in short mode")
864 }
865
866 ctx := context.Background()
867 cnf := &config.Configuration{
868 Redis: config.RedisConfig{
869 Dns: "localhost:6379",
870 },
871 DataSource: config.DataSourceConfig{
872 Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable",
873 },
874 Queue: config.QueueConfig{
875 WebhookQueue: "webhook_queue_test",
876 IndexQueue: "index_queue_test",
877 TransactionQueue: "transaction_queue_test",
878 NumberOfQueues: 1,
879 },
880 Server: config.ServerConfig{
881 SecretKey: "test-secret",
882 },
883 Transaction: config.TransactionConfig{
884 BatchSize: 100,
885 MaxQueueSize: 1000,
886 LockDuration: time.Second * 30,
887 IndexQueuePrefix: "test_index",
888 },
889 }
890 config.ConfigStore.Store(cnf)
891
892 ds, err := database.NewDataSource(cnf)
893 require.NoError(t, err, "Failed to create datasource")
894
895 ledgerforge, err := NewLedgerForge(ds)
896 require.NoError(t, err, "Failed to create LedgerForge instance")
897
898 txnRef := "txn_" + model.GenerateUUIDWithSuffix("test")
899
900 // Create test balances
901 sourceBalance := &model.Balance{
902 Currency: "USD",
903 LedgerID: "general_ledger_id",
904 }
905 destBalance := &model.Balance{
906 Currency: "USD",
907 LedgerID: "general_ledger_id",
908 }
909
910 source, err := ds.CreateBalance(*sourceBalance)
911 require.NoError(t, err, "Failed to create source balance")
912
913 dest, err := ds.CreateBalance(*destBalance)
914 require.NoError(t, err, "Failed to create destination balance")
915
916 // Create transaction with skip_queue set to true
917 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