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 c213973 commit a9d577c
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 @@ -150,16 +150,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) {

Check failure on line 151 in gno.land/pkg/integration/testscript_gnoland.go

View workflow job for this annotation

GitHub Actions / Run Main / Go Linter / lint

test helper function should start from t.Helper() (thelper)
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 @@ -174,7 +171,7 @@ func gnolandCmd(t *testing.T, nodes map[string]*testNode, gnolandBin, gnoRootDir
// directly or use the config command for this.
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 @@ -244,15 +241,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 a9d577c

Please sign in to comment.