Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retries Fix and Enhancement #2279

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions jvm/core/src/main/scala/org/scalatest/Retries.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package org.scalatest

import org.scalatest.concurrent.SleepHelper
import org.scalatest.concurrent.SleepHelper
import org.scalatest.concurrent.SleepHelper
import time.Span

Expand Down Expand Up @@ -345,11 +343,15 @@ trait Retries {
val firstOutcome = blk
firstOutcome match {
case Failed(ex) =>
if (delay != Span.Zero)
SleepHelper.sleep(delay.millisPart, delay.nanosPart)
blk match {
case Succeeded => Canceled(Resources.testFlickered, ex)
case other => firstOutcome
}
case Canceled(ex) =>
if (delay != Span.Zero)
SleepHelper.sleep(delay.millisPart, delay.nanosPart)
blk match {
case Succeeded => Succeeded
case failed: Failed => failed // Never hide a failure.
Expand Down Expand Up @@ -567,7 +569,7 @@ trait Retries {
firstOutcome match {
case Failed(ex) =>
if (delay != Span.Zero)
SleepHelper.sleep(delay.millisPart)
SleepHelper.sleep(delay.millisPart, delay.nanosPart)
blk match {
case Succeeded => Canceled(Resources.testFlickered, ex)
case other => firstOutcome
Expand Down Expand Up @@ -782,8 +784,7 @@ trait Retries {
firstOutcome match {
case Canceled(ex) =>
if (delay != Span.Zero)
SleepHelper.sleep(delay.millisPart)
SleepHelper.sleep(delay.millisPart)
SleepHelper.sleep(delay.millisPart, delay.nanosPart)
blk match {
case Succeeded => Succeeded
case failed: Failed => failed // Never hide a failure.
Expand Down