Skip to content

Commit

Permalink
add arg for using parent dir
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Nov 26, 2024
1 parent 39e63e4 commit f26bb7e
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 11 deletions.
6 changes: 5 additions & 1 deletion cmd/command_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/export_assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestExportAssets(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/assets/", "")
RunCLITest(t, test, "testdata/assets/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/export_contract_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion cmd/export_effects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestExportEffects(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/effects/", "")
RunCLITest(t, test, "testdata/effects/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/export_ledger_entry_changes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ func TestExportChanges(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/changes/", "")
RunCLITest(t, test, "testdata/changes/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/export_ledger_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
2 changes: 1 addition & 1 deletion cmd/export_ledgers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ func TestExportLedger(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/ledgers/", "")
RunCLITest(t, test, "testdata/ledgers/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/export_operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestExportOperations(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/operations/", "")
RunCLITest(t, test, "testdata/operations/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/export_trades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestExportTrades(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/trades/", "")
RunCLITest(t, test, "testdata/trades/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/export_transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ func TestExportTransactions(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/transactions/", "")
RunCLITest(t, test, "testdata/transactions/", "", false)
}
}
2 changes: 1 addition & 1 deletion cmd/get_ledger_range_from_times_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ func TestConvertTimes(t *testing.T) {
}

for _, test := range tests {
RunCLITest(t, test, "testdata/ranges/", "")
RunCLITest(t, test, "testdata/ranges/", "", false)
}
}

0 comments on commit f26bb7e

Please # to comment.