From f26bb7e4315c6bdf804afd4cde14568d54fa0cab Mon Sep 17 00:00:00 2001 From: Amisha Singla Date: Tue, 26 Nov 2024 16:59:12 -0600 Subject: [PATCH] add arg for using parent dir --- cmd/command_utils.go | 6 +++++- cmd/export_assets_test.go | 2 +- cmd/export_contract_events_test.go | 2 +- cmd/export_effects_test.go | 2 +- cmd/export_ledger_entry_changes_test.go | 2 +- cmd/export_ledger_transaction_test.go | 2 +- cmd/export_ledgers_test.go | 2 +- cmd/export_operations_test.go | 2 +- cmd/export_trades_test.go | 2 +- cmd/export_transactions_test.go | 2 +- cmd/get_ledger_range_from_times_test.go | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cmd/command_utils.go b/cmd/command_utils.go index 24ca3f7..c53028b 100644 --- a/cmd/command_utils.go +++ b/cmd/command_utils.go @@ -208,7 +208,7 @@ func indexOf(l []string, s string) int { return -1 } -func RunCLITest(t *testing.T, test CliTest, GoldenFolder string, executableName string) { +func RunCLITest(t *testing.T, test CliTest, GoldenFolder string, executableName string, useParentDir bool) { if executableName == "" { executableName = "stellar-etl" } @@ -217,6 +217,10 @@ func RunCLITest(t *testing.T, test CliTest, GoldenFolder string, executableName dir, err := os.Getwd() assert.NoError(t, err) + if useParentDir { + dir = filepath.Dir(dir) + } + idxOfOutputArg := indexOf(test.Args, "-o") var testOutput []byte var outLocation string diff --git a/cmd/export_assets_test.go b/cmd/export_assets_test.go index c082dfc..77ca713 100644 --- a/cmd/export_assets_test.go +++ b/cmd/export_assets_test.go @@ -33,6 +33,6 @@ func TestExportAssets(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/assets/", "") + RunCLITest(t, test, "testdata/assets/", "", false) } } diff --git a/cmd/export_contract_events_test.go b/cmd/export_contract_events_test.go index 658e93f..7f88b48 100644 --- a/cmd/export_contract_events_test.go +++ b/cmd/export_contract_events_test.go @@ -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/", "", false) } } diff --git a/cmd/export_effects_test.go b/cmd/export_effects_test.go index 8c2af2c..840d5aa 100644 --- a/cmd/export_effects_test.go +++ b/cmd/export_effects_test.go @@ -33,6 +33,6 @@ func TestExportEffects(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/effects/", "") + RunCLITest(t, test, "testdata/effects/", "", false) } } diff --git a/cmd/export_ledger_entry_changes_test.go b/cmd/export_ledger_entry_changes_test.go index 89f6aad..2ce64b2 100644 --- a/cmd/export_ledger_entry_changes_test.go +++ b/cmd/export_ledger_entry_changes_test.go @@ -96,6 +96,6 @@ func TestExportChanges(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/changes/", "") + RunCLITest(t, test, "testdata/changes/", "", false) } } diff --git a/cmd/export_ledger_transaction_test.go b/cmd/export_ledger_transaction_test.go index 2a38328..b54870e 100644 --- a/cmd/export_ledger_transaction_test.go +++ b/cmd/export_ledger_transaction_test.go @@ -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/", "", false) } } diff --git a/cmd/export_ledgers_test.go b/cmd/export_ledgers_test.go index a466f21..f586ed7 100644 --- a/cmd/export_ledgers_test.go +++ b/cmd/export_ledgers_test.go @@ -73,6 +73,6 @@ func TestExportLedger(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/ledgers/", "") + RunCLITest(t, test, "testdata/ledgers/", "", false) } } diff --git a/cmd/export_operations_test.go b/cmd/export_operations_test.go index b1b1eab..586923e 100644 --- a/cmd/export_operations_test.go +++ b/cmd/export_operations_test.go @@ -33,6 +33,6 @@ func TestExportOperations(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/operations/", "") + RunCLITest(t, test, "testdata/operations/", "", false) } } diff --git a/cmd/export_trades_test.go b/cmd/export_trades_test.go index 8071edb..be1a8c4 100644 --- a/cmd/export_trades_test.go +++ b/cmd/export_trades_test.go @@ -33,6 +33,6 @@ func TestExportTrades(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/trades/", "") + RunCLITest(t, test, "testdata/trades/", "", false) } } diff --git a/cmd/export_transactions_test.go b/cmd/export_transactions_test.go index 5c8bd14..911fffe 100644 --- a/cmd/export_transactions_test.go +++ b/cmd/export_transactions_test.go @@ -33,6 +33,6 @@ func TestExportTransactions(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/transactions/", "") + RunCLITest(t, test, "testdata/transactions/", "", false) } } diff --git a/cmd/get_ledger_range_from_times_test.go b/cmd/get_ledger_range_from_times_test.go index 10895c6..0e24f4b 100644 --- a/cmd/get_ledger_range_from_times_test.go +++ b/cmd/get_ledger_range_from_times_test.go @@ -83,6 +83,6 @@ func TestConvertTimes(t *testing.T) { } for _, test := range tests { - RunCLITest(t, test, "testdata/ranges/", "") + RunCLITest(t, test, "testdata/ranges/", "", false) } }