-
Notifications
You must be signed in to change notification settings - Fork 52
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
Handle class setup failures preventing previously failed methods from retrying #177
Changes from all commits
ff93732
5b6a767
965163e
8164379
6ea8f14
0ce11ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -51,7 +51,7 @@ abstract class AbstractPluginFuncTest extends Specification { | |||||
} | ||||||
|
||||||
String markerFileExistsCheck(String id = "id") { | ||||||
"Files.exists(Paths.get(\"build/marker.file.${StringEscapeUtils.escapeJava(id)}\"))" | ||||||
"""Files.exists(Paths.get("build/marker.file.${StringEscapeUtils.escapeJava(id)}"))""" | ||||||
} | ||||||
|
||||||
String flakyAssertClass() { | ||||||
|
@@ -78,6 +78,24 @@ abstract class AbstractPluginFuncTest extends Specification { | |||||
throw new java.io.UncheckedIOException(e); | ||||||
} | ||||||
} | ||||||
|
||||||
public static void flakyAssertPassFailPass(String id) { | ||||||
Path marker = Paths.get("build/marker.file." + id); | ||||||
try { | ||||||
if (Files.exists(marker)) { | ||||||
int counter = Integer.parseInt(new String(Files.readAllBytes(marker))); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably need the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, it is a plain Java class written alongside test classes. |
||||||
++counter; | ||||||
Files.write(marker, Integer.toString(counter).getBytes()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❗ This is a Java class that we create in the build workspace to simplify creation of test classes, so this won't work. |
||||||
if (counter == 1) { | ||||||
throw new RuntimeException("fail me!"); | ||||||
} | ||||||
} else { | ||||||
Files.write(marker, "0".getBytes()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||||||
} | ||||||
} catch (java.io.IOException e) { | ||||||
throw new java.io.UncheckedIOException(e); | ||||||
} | ||||||
} | ||||||
} | ||||||
""" | ||||||
} | ||||||
|
@@ -129,7 +147,11 @@ abstract class AbstractPluginFuncTest extends Specification { | |||||
} | ||||||
|
||||||
static String flakyAssert(String id = "id", int failures = 1) { | ||||||
return "acme.FlakyAssert.flakyAssert(\"${StringEscapeUtils.escapeJava(id)}\", $failures);" | ||||||
return """acme.FlakyAssert.flakyAssert("${StringEscapeUtils.escapeJava(id)}", $failures);""" | ||||||
} | ||||||
|
||||||
static String flakyAssertPassFailPass(String id = "id") { | ||||||
return """acme.FlakyAssert.flakyAssertPassFailPass("${StringEscapeUtils.escapeJava(id)}");""" | ||||||
} | ||||||
|
||||||
@SuppressWarnings("GroovyAssignabilityCheck") | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same