github.com/stellar/stellar-etl@v1.0.1-0.20240312145900-4874b6bf2b89/cmd/export_ledger_entry_changes_test.go (about)

     1  package cmd
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  const coreExecutablePath = "../stellar-core/src/stellar-core"
     9  const coreConfigPath = "./docker/stellar-core.cfg"
    10  
    11  func TestExportChanges(t *testing.T) {
    12  
    13  	tests := []cliTest{
    14  		{
    15  			name:    "unbounded range with no config",
    16  			args:    []string{"export_ledger_entry_changes", "-x", coreExecutablePath, "-s", "100000"},
    17  			golden:  "",
    18  			wantErr: fmt.Errorf("stellar-core needs a config file path when exporting ledgers continuously (endNum = 0)"),
    19  		},
    20  		{
    21  			name:    "0 batch size",
    22  			args:    []string{"export_ledger_entry_changes", "-b", "0", "-x", coreExecutablePath, "-c", coreConfigPath, "-s", "100000", "-e", "164000"},
    23  			golden:  "",
    24  			wantErr: fmt.Errorf("batch-size (0) must be greater than 0"),
    25  		},
    26  		{
    27  			name:    "changes from single ledger",
    28  			args:    []string{"export_ledger_entry_changes", "-x", coreExecutablePath, "-c", coreConfigPath, "-s", "140116", "-e", "140116", "-o", gotTestDir(t, "single/")},
    29  			golden:  "single_ledger.golden",
    30  			wantErr: nil,
    31  		},
    32  		{
    33  			name:    "changes from large range",
    34  			args:    []string{"export_ledger_entry_changes", "-x", coreExecutablePath, "-c", coreConfigPath, "-s", "100000", "-e", "164000", "-o", gotTestDir(t, "large_range_changes/")},
    35  			golden:  "large_range_changes.golden",
    36  			wantErr: nil,
    37  		},
    38  	}
    39  
    40  	for _, test := range tests {
    41  		runCLITest(t, test, "testdata/changes/")
    42  	}
    43  }