Skip to content

Commit 56067c4

Browse files
authored
Fix flaky test reporter failing with long failure message (#14141)
1 parent b1b2d73 commit 56067c4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test-report/src/main/java/io/opentelemetry/instrumentation/testreport/FlakyTestReporter.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ private void report(String accessKey, String buildScanUrl, String jobUrl) throws
277277
row.add(flakyTest.testName);
278278
row.add(buildScanUrl);
279279
row.add(jobUrl);
280-
row.add(flakyTest.message);
280+
// there is a limit of 50000 characters in a single cell
281+
row.add(abbreviate(flakyTest.message, 10000));
281282
data.add(row);
282283
}
283284

@@ -291,6 +292,14 @@ private void report(String accessKey, String buildScanUrl, String jobUrl) throws
291292
.execute();
292293
}
293294

295+
private static String abbreviate(String text, int maxLength) {
296+
if (text.length() > maxLength) {
297+
return text.substring(0, maxLength - 3) + "...";
298+
}
299+
300+
return text;
301+
}
302+
294303
public static void main(String... args) throws Exception {
295304
String path = System.getProperty("scanPath");
296305
if (path == null) {

0 commit comments

Comments
 (0)