Skip to content

Commit

Permalink
export cmd utils
Browse files Browse the repository at this point in the history
  • Loading branch information
amishas157 committed Nov 26, 2024
1 parent 204d343 commit 7b19772
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions cmd/export_assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand Down 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/")
}
}
4 changes: 2 additions & 2 deletions cmd/export_contract_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand All @@ -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/")
}
}
4 changes: 2 additions & 2 deletions cmd/export_effects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand Down 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/")
}
}
4 changes: 2 additions & 2 deletions cmd/export_ledger_entry_changes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down 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/")
}
}
4 changes: 2 additions & 2 deletions cmd/export_ledger_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand All @@ -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/")
}
}
8 changes: 4 additions & 4 deletions cmd/export_ledgers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"},
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestExportLedger(t *testing.T) {
}

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

Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions cmd/export_operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand Down 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/")
}
}
4 changes: 2 additions & 2 deletions cmd/export_trades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand Down 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/")
}
}
4 changes: 2 additions & 2 deletions cmd/export_transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")},
Expand Down 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/")
}
}
4 changes: 2 additions & 2 deletions cmd/get_ledger_range_from_times_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down 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/")
}
}

0 comments on commit 7b19772

Please sign in to comment.