Skip to content

Commit e8ec711

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

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

hive.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/ethereum/hive/internal/libdocker"
1515
"github.com/ethereum/hive/internal/libhive"
16-
"gopkg.in/inconshreveable/log15.v2"
1716
)
1817

1918
func main() {
@@ -32,6 +31,7 @@ func main() {
3231
simLogLevel = flag.Int("sim.loglevel", 3, "Selects log `level` of client instances. Supports values 0-5.")
3332
simDevMode = flag.Bool("dev", false, "Only starts the simulator API endpoint (listening at 127.0.0.1:3000 by default) without starting any simulators.")
3433
simDevModeAPIEndpoint = flag.String("dev.addr", "127.0.0.1:3000", "Endpoint that the simulator API listens on")
34+
errorOnFailingTests = flag.Bool("exit.fail", true, "Exit with error code 1 if any test fails")
3535

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

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))
133+
if *errorOnFailingTests && failCount > 0 {
134+
switch failCount {
135+
case 0:
136+
case 1:
137+
fatal(errors.New("1 test failed"))
138+
default:
139+
fatal(fmt.Errorf("%d tests failed", failCount))
140+
}
139141
}
140142
}
141143

0 commit comments

Comments
 (0)