Skip to content

Commit

Permalink
feat: add support for other gnoland command
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <[email protected]>
  • Loading branch information
gfanton committed Nov 7, 2024
1 parent da85956 commit 4bef04a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions gno.land/pkg/integration/testscript_gnoland.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,13 @@ func SetupGnolandTestscript(t *testing.T, p *testscript.Params) error {

func gnolandCmd(t *testing.T, nodes map[string]*testNode, gnolandBin, gnoRootDir, gnoHomeDir string) func(ts *testscript.TestScript, neg bool, args []string) {
return func(ts *testscript.TestScript, neg bool, args []string) {
if len(args) == 0 {
tsValidateError(ts, "gnoland", neg, fmt.Errorf("syntax: gnoland [start|stop|restart]"))
return
}

logger := ts.Value(envKeyLogger).(*slog.Logger)
sid := getNodeSID(ts)

var cmd string
cmd, args = args[0], args[1:]
cmd, cmdargs := "", []string{}
if len(args) > 0 {
cmd, cmdargs = args[0], args[1:]
}

var err error
switch cmd {
Expand All @@ -168,7 +165,7 @@ func gnolandCmd(t *testing.T, nodes map[string]*testNode, gnolandBin, gnoRootDir

fs := flag.NewFlagSet("start", flag.ContinueOnError)
nonVal := fs.Bool("non-validator", false, "set up node as a non-validator")
if err := fs.Parse(args); err != nil {
if err := fs.Parse(cmdargs); err != nil {
ts.Fatalf("unable to parse `gnoland start` flags: %s", err)
}

Expand Down Expand Up @@ -238,15 +235,13 @@ func gnolandCmd(t *testing.T, nodes map[string]*testNode, gnolandBin, gnoRootDir
ts.Setenv("RPC_ADDR", "")
fmt.Fprintln(ts.Stdout(), "node stopped successfully")
}
case "genesis", "secrets", "config":
default:
err := ts.Exec(gnolandBin, args...)
if err != nil {
ts.Logf("gno command error: %+v", err)
}

tsValidateError(ts, "gnoland "+cmd, neg, err)
default:
err = fmt.Errorf("not allowed or invalid gnoland subcommand: %q", cmd)
}

tsValidateError(ts, "gnoland "+cmd, neg, err)
Expand Down

0 comments on commit 4bef04a

Please sign in to comment.