Skip to content

Commit 0963fc5

Browse files
committed
Strip out seed from reproduce method name
When -Dtests.iters is used the test seed is appended to the method name by randomized runner. That in turn causes the reproduce line to contain the seed as part of the method name, which makes the reproduce line unuseable. This commit strips off any additional part of the method name before printing.
1 parent 8206411 commit 0963fc5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

server/src/test/java/org/elasticsearch/common/settings/SettingsTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public void testReplacePropertiesPlaceholderSystemProperty() {
6161
.replacePropertyPlaceholders()
6262
.build();
6363
assertThat(settings.get("setting1"), equalTo(value));
64+
fail("foo");
6465
}
6566

6667
public void testReplacePropertiesPlaceholderSystemVariablesHaveNoEffect() {

test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ public void testFailure(Failure failure) throws Exception {
7777
}
7878
b.append(failure.getDescription().getClassName());
7979

80-
final String methodName = failure.getDescription().getMethodName();
80+
String methodName = failure.getDescription().getMethodName();
8181
if (methodName != null) {
82+
// Method names only have spaces if used with -Dtests.iters where the seed is appended.
83+
// Here we strip out anything from the first space, leaving the real method name intact.
84+
methodName = methodName.split(" ")[0];
8285
// fallback to system property filter when tests contain "."
8386
if (methodName.contains(".") || isBwcTest) {
8487
b.append("\" -Dtests.method=\"");

0 commit comments

Comments
 (0)