github.com/stellar/stellar-etl@v1.0.1-0.20240312145900-4874b6bf2b89/cmd/export_orderbooks_test.go (about) 1 package cmd 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestExportOrderbooks(t *testing.T) { 9 tests := []cliTest{ 10 { 11 name: "unbounded range with no config", 12 args: []string{"export_orderbooks", "-x", coreExecutablePath, "-s", "100000"}, 13 golden: "", 14 wantErr: fmt.Errorf("stellar-core needs a config file path when exporting ledgers continuously (endNum = 0)"), 15 }, 16 { 17 name: "0 batch size", 18 args: []string{"export_orderbooks", "-b", "0", "-x", coreExecutablePath, "-c", coreConfigPath, "-s", "100000", "-e", "164000"}, 19 golden: "", 20 wantErr: fmt.Errorf("batch-size (0) must be greater than 0"), 21 }, 22 { 23 name: "orderbook from single ledger", 24 args: []string{"export_orderbooks", "-x", coreExecutablePath, "-c", coreConfigPath, "-s", "5000000", "-e", "5000000", "-o", gotTestDir(t, "single/")}, 25 golden: "single_ledger.golden", 26 sortForComparison: true, 27 wantErr: nil, 28 }, 29 { 30 name: "orderbooks from large range", 31 args: []string{"export_orderbooks", "-x", coreExecutablePath, "-c", coreConfigPath, "-s", "6000000", "-e", "6001000", "-o", gotTestDir(t, "range/")}, 32 golden: "large_range_orderbooks.golden", 33 sortForComparison: true, 34 wantErr: nil, 35 }, 36 } 37 38 for _, test := range tests { 39 runCLITest(t, test, "testdata/orderbooks/") 40 } 41 }