Skip to content

Commit b7b55e6

Browse files
authored
Add extra logs when retrying flaky tests (#3433)
1 parent c646f9e commit b7b55e6

File tree

1 file changed

+8
-2
lines changed
  • modules/integration/src/test/scala/scala/cli/integration

1 file changed

+8
-2
lines changed

modules/integration/src/test/scala/scala/cli/integration/TestUtil.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,17 @@ object TestUtil {
133133
try run
134134
catch {
135135
case t: Throwable =>
136-
if (count >= maxAttempts)
136+
if (count >= maxAttempts) {
137+
System.err.println(s"$maxAttempts attempts failed, caught $t. Giving up.")
137138
throw new Exception(t)
139+
}
138140
else {
139-
System.err.println(s"Caught $t, trying again in $waitDuration")
141+
val remainingAttempts = maxAttempts - count
142+
System.err.println(
143+
s"Caught $t, $remainingAttempts attempts remaining, trying again in $waitDuration"
144+
)
140145
Thread.sleep(waitDuration.toMillis)
146+
System.err.println(s"Trying attempt $count out of $maxAttempts...")
141147
helper(count + 1)
142148
}
143149
}

0 commit comments

Comments
 (0)