From 7b197727ba90af1d7e38d375e3d27f76d9ffb866 Mon Sep 17 00:00:00 2001 From: Amisha Singla Date: Tue, 26 Nov 2024 13:14:20 -0600 Subject: [PATCH] export cmd utils --- cmd/export_assets_test.go | 4 ++-- cmd/export_contract_events_test.go | 4 ++-- cmd/export_effects_test.go | 4 ++-- cmd/export_ledger_entry_changes_test.go | 4 ++-- cmd/export_ledger_transaction_test.go | 4 ++-- cmd/export_ledgers_test.go | 8 ++++---- cmd/export_operations_test.go | 4 ++-- cmd/export_trades_test.go | 4 ++-- cmd/export_transactions_test.go | 4 ++-- cmd/get_ledger_range_from_times_test.go | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/cmd/export_assets_test.go b/cmd/export_assets_test.go index 73ba6e3e..60fb870b 100644 --- a/cmd/export_assets_test.go +++ b/cmd/export_assets_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportAssets(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "assets from one ledger", args: []string{"export_assets", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "one_ledger_assets.txt")}, @@ -33,6 +33,6 @@ func TestExportAssets(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/assets/") + RunCLITest(t, test, "testdata/assets/") } } diff --git a/cmd/export_contract_events_test.go b/cmd/export_contract_events_test.go index 29674bd4..cfc091a6 100644 --- a/cmd/export_contract_events_test.go +++ b/cmd/export_contract_events_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportContractEvents(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "contract events from multiple ledger", args: []string{"export_contract_events", "-s", "52271338", "-e", "52271350", "-o", gotTestDir(t, "large_range_ledger_txs.txt")}, @@ -15,6 +15,6 @@ func TestExportContractEvents(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/contract_events/") + RunCLITest(t, test, "testdata/contract_events/") } } diff --git a/cmd/export_effects_test.go b/cmd/export_effects_test.go index 78a75ed7..671794d4 100644 --- a/cmd/export_effects_test.go +++ b/cmd/export_effects_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportEffects(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "effects from one ledger", args: []string{"export_effects", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "one_ledger_effects.txt")}, @@ -33,6 +33,6 @@ func TestExportEffects(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/effects/") + RunCLITest(t, test, "testdata/effects/") } } diff --git a/cmd/export_ledger_entry_changes_test.go b/cmd/export_ledger_entry_changes_test.go index a341b29c..24e108dd 100644 --- a/cmd/export_ledger_entry_changes_test.go +++ b/cmd/export_ledger_entry_changes_test.go @@ -10,7 +10,7 @@ const coreConfigPath = "/etl/docker/stellar-core.cfg" func TestExportChanges(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "unbounded range with no config", args: []string{"export_ledger_entry_changes", "-x", coreExecutablePath, "-s", "100000"}, @@ -96,6 +96,6 @@ func TestExportChanges(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/changes/") + RunCLITest(t, test, "testdata/changes/") } } diff --git a/cmd/export_ledger_transaction_test.go b/cmd/export_ledger_transaction_test.go index d87bc596..c0217e28 100644 --- a/cmd/export_ledger_transaction_test.go +++ b/cmd/export_ledger_transaction_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportLedgerTransaction(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "Transactions from one ledger", args: []string{"export_ledger_transaction", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "ledger_transactions.txt")}, @@ -15,6 +15,6 @@ func TestExportLedgerTransaction(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/ledger_transactions/") + RunCLITest(t, test, "testdata/ledger_transactions/") } } diff --git a/cmd/export_ledgers_test.go b/cmd/export_ledgers_test.go index 9b759185..3524cccc 100644 --- a/cmd/export_ledgers_test.go +++ b/cmd/export_ledgers_test.go @@ -21,7 +21,7 @@ var executableName = "stellar-etl" var update = flag.Bool("update", false, "update the golden files of this test") var gotFolder = "testdata/got/" -type cliTest struct { +type CliTest struct { name string args []string golden string @@ -52,7 +52,7 @@ func gotTestDir(t *testing.T, filename string) string { } func TestExportLedger(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "end before start", args: []string{"export_ledgers", "-s", "100", "-e", "50"}, @@ -98,7 +98,7 @@ func TestExportLedger(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/ledgers/") + RunCLITest(t, test, "testdata/ledgers/") } } @@ -117,7 +117,7 @@ func sortByName(files []os.DirEntry) { }) } -func runCLITest(t *testing.T, test cliTest, goldenFolder string) { +func RunCLITest(t *testing.T, test CliTest, goldenFolder string) { flag.Parse() t.Run(test.name, func(t *testing.T) { dir, err := os.Getwd() diff --git a/cmd/export_operations_test.go b/cmd/export_operations_test.go index d6fdcf06..bd810d06 100644 --- a/cmd/export_operations_test.go +++ b/cmd/export_operations_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportOperations(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "operations from one ledger", args: []string{"export_operations", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "one_ledger_ops.txt")}, @@ -33,6 +33,6 @@ func TestExportOperations(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/operations/") + RunCLITest(t, test, "testdata/operations/") } } diff --git a/cmd/export_trades_test.go b/cmd/export_trades_test.go index 14dce90d..3110f05c 100644 --- a/cmd/export_trades_test.go +++ b/cmd/export_trades_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportTrades(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "trades from one ledger", args: []string{"export_trades", "-s", "28770265", "-e", "28770265", "-o", gotTestDir(t, "one_ledger_trades.txt")}, @@ -33,6 +33,6 @@ func TestExportTrades(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/trades/") + RunCLITest(t, test, "testdata/trades/") } } diff --git a/cmd/export_transactions_test.go b/cmd/export_transactions_test.go index 30f976ba..1cd8416d 100644 --- a/cmd/export_transactions_test.go +++ b/cmd/export_transactions_test.go @@ -5,7 +5,7 @@ import ( ) func TestExportTransactions(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "transactions from one ledger", args: []string{"export_transactions", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "one_ledger_txs.txt")}, @@ -33,6 +33,6 @@ func TestExportTransactions(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/transactions/") + RunCLITest(t, test, "testdata/transactions/") } } diff --git a/cmd/get_ledger_range_from_times_test.go b/cmd/get_ledger_range_from_times_test.go index 35c51931..45b1bc48 100644 --- a/cmd/get_ledger_range_from_times_test.go +++ b/cmd/get_ledger_range_from_times_test.go @@ -6,7 +6,7 @@ import ( ) func TestConvertTimes(t *testing.T) { - tests := []cliTest{ + tests := []CliTest{ { name: "wrong date format", args: []string{"get_ledger_range_from_times", "-s", "2016 01 01 4:33", "-e", "2020 03 04 12:32"}, @@ -83,6 +83,6 @@ func TestConvertTimes(t *testing.T) { } for _, test := range tests { - runCLITest(t, test, "testdata/ranges/") + RunCLITest(t, test, "testdata/ranges/") } }