File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
org/apache/openwhisk/common Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ trait RunCliCmd extends Matchers {
96
96
/** Retries cmd on network error exit. */
97
97
private def retry (i : Int , N : Int , cmd : () => RunResult ): RunResult = {
98
98
val rr = cmd()
99
- if (rr.exitCode == NETWORK_ERROR_EXIT && i < N ) {
99
+ if (rr.exitCode != SUCCESS_EXIT && i < N ) {
100
100
Thread .sleep(1 .second.toMillis)
101
101
println(s " command will retry to due to network error: $rr" )
102
102
retry(i + 1 , N , cmd)
Original file line number Diff line number Diff line change @@ -74,16 +74,16 @@ class RunCliCmdTests extends FlatSpec with RunCliCmd with BeforeAndAfterEach {
74
74
cmdCount shouldBe 1
75
75
}
76
76
77
- it should " not retry commands if failure is not retriable " in {
78
- Seq (MISUSE_EXIT , ERROR_EXIT , SUCCESS_EXIT ).foreach { code =>
77
+ it should " retry commands if any failure is happen " in {
78
+ Seq (MISUSE_EXIT , ERROR_EXIT ).foreach { code =>
79
79
cmdCount = 0
80
80
81
81
rr = Some (TestRunResult (code))
82
82
noException shouldBe thrownBy {
83
83
cli(Seq .empty, expectedExitCode = DONTCARE_EXIT , retriesOnNetworkError = 3 )
84
84
}
85
85
86
- cmdCount shouldBe 1
86
+ cmdCount shouldBe 4
87
87
}
88
88
}
89
89
You can’t perform that action at this time.
0 commit comments