Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuvubk committed Aug 21, 2024
1 parent 5b815ef commit 0758a91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/systemtests/snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
)

const nodeDir = "./testnet/node0/simdv2"
var nodeDir = fmt.Sprintf("./testnet/node0/%s", sut.execBinary)

func TestSnapshots(t *testing.T) {
sut.ResetChain(t)
Expand All @@ -32,25 +32,25 @@ func TestSnapshots(t *testing.T) {
time.Sleep(time.Second)

// export snapshot at height 5
res := cli.RunWithArgs("store", "export", "--height=5", fmt.Sprintf("--home=%s", nodeDir))
res := cli.RunCommandWithArgs("store", "export", "--height=5", fmt.Sprintf("--home=%s", nodeDir))
require.Contains(t, res, "Snapshot created at height 5")
require.DirExists(t, fmt.Sprintf("%s/data/snapshots/5/3", nodeDir))

// Check snapshots list
res = cli.RunWithArgs("store", "list", fmt.Sprintf("--home=%s", nodeDir))
res = cli.RunCommandWithArgs("store", "list", fmt.Sprintf("--home=%s", nodeDir))
require.Contains(t, res, "height: 5")

// Dump snapshot
res = cli.RunWithArgs("store", "dump", "5", "3", fmt.Sprintf("--home=%s", nodeDir), "--output=./testnet/node0/simdv2/5-3.tar.gz")
res = cli.RunCommandWithArgs("store", "dump", "5", "3", fmt.Sprintf("--home=%s", nodeDir), "--output=./testnet/node0/simdv2/5-3.tar.gz")
// Check if output file exist
require.FileExists(t, fmt.Sprintf("%s/5-3.tar.gz", nodeDir))

// Delete snapshots
res = cli.RunWithArgs("store", "delete", "5", "3", fmt.Sprintf("--home=%s", nodeDir))
res = cli.RunCommandWithArgs("store", "delete", "5", "3", fmt.Sprintf("--home=%s", nodeDir))
require.NoDirExists(t, fmt.Sprintf("%s/data/snapshots/5/3", nodeDir))

// Load snapshot from file
res = cli.RunWithArgs("store", "load", fmt.Sprintf("%s/5-3.tar.gz", nodeDir), fmt.Sprintf("--home=%s", nodeDir))
res = cli.RunCommandWithArgs("store", "load", fmt.Sprintf("%s/5-3.tar.gz", nodeDir), fmt.Sprintf("--home=%s", nodeDir))
require.DirExists(t, fmt.Sprintf("%s/data/snapshots/5/3", nodeDir))

// Restore from snapshots
Expand All @@ -61,7 +61,7 @@ func TestSnapshots(t *testing.T) {
err = os.RemoveAll(fmt.Sprintf("%s/data/ss", nodeDir))
require.NoError(t, err)

res = cli.RunWithArgs("store", "restore", "5", "3", fmt.Sprintf("--home=%s", nodeDir))
res = cli.RunCommandWithArgs("store", "restore", "5", "3", fmt.Sprintf("--home=%s", nodeDir))
require.DirExists(t, fmt.Sprintf("%s/data/application.db", nodeDir))
require.DirExists(t, fmt.Sprintf("%s/data/ss", nodeDir))

Expand All @@ -88,7 +88,7 @@ func TestPrune(t *testing.T) {
time.Sleep(time.Second)

// prune
res := cli.RunWithArgs("store", "prune", "--keep-recent=1", fmt.Sprintf("--home=%s", nodeDir))
res := cli.RunCommandWithArgs("store", "prune", "--keep-recent=1", fmt.Sprintf("--home=%s", nodeDir))
require.Contains(t, res, "successfully pruned the application root multi stores")

// Start the node
Expand Down
1 change: 1 addition & 0 deletions tests/systemtests/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ func (s *SystemUnderTest) StopSingleNode() error {

// StartSingleNode start running a validator node with dir input
func (s *SystemUnderTest) StartSingleNode(t *testing.T, dir string) {
t.Helper()
cmd := exec.Command( //nolint:gosec // used by tests only
locateExecutable(s.execBinary),
[]string{"start", "--log_level=info", "--log_no_color"}...,
Expand Down

0 comments on commit 0758a91

Please sign in to comment.