Skip to content

Commit 8748c28

Browse files
committed
feat(exit): allow flag to disable exit code 1 on failing tests
1 parent b925865 commit 8748c28

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

hive.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func main() {
3232
simLogLevel = flag.Int("sim.loglevel", 3, "Selects log `level` of client instances. Supports values 0-5.")
3333
simDevMode = flag.Bool("dev", false, "Only starts the simulator API endpoint (listening at 127.0.0.1:3000 by default) without starting any simulators.")
3434
simDevModeAPIEndpoint = flag.String("dev.addr", "127.0.0.1:3000", "Endpoint that the simulator API listens on")
35+
errorOnFailingTests = flag.Bool("exit.fail", true, "Exit with error code 1 if any test fails")
3536

3637
clients = flag.String("client", "go-ethereum", "Comma separated `list` of clients to use. Client names in the list may be given as\n"+
3738
"just the client name, or a client_branch specifier. If a branch name is supplied,\n"+
@@ -130,12 +131,14 @@ func main() {
130131
log15.Info(fmt.Sprintf("simulation %s finished", sim), "suites", result.Suites, "tests", result.Tests, "failed", result.TestsFailed)
131132
}
132133

133-
switch failCount {
134-
case 0:
135-
case 1:
136-
fatal(errors.New("1 test failed"))
137-
default:
138-
fatal(fmt.Errorf("%d tests failed", failCount))
134+
if *errorOnFailingTests && failCount > 0 {
135+
switch failCount {
136+
case 0:
137+
case 1:
138+
fatal(errors.New("1 test failed"))
139+
default:
140+
fatal(fmt.Errorf("%d tests failed", failCount))
141+
}
139142
}
140143
}
141144

0 commit comments

Comments
 (0)