Skip to content

Conversation

@olamy
Copy link
Member

@olamy olamy commented Nov 17, 2025

Part of #237

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@olamy olamy requested a review from a team as a code owner November 17, 2025 06:43
@olamy
Copy link
Member Author

olamy commented Nov 17, 2025

I have only added the datas as I'm not sure how to do this with the UI.
Well TBH my first intention is to have those datas available for the mcp server plugin :)

private String errorStackTrace;
private String errorDetails;
private Map<String, String> properties;
private FlakyFailure[] flakyFailures;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason these are an array rather than a list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reasons, using List is creating some empty elements in xml and fail TestResultTest#bigResultReadWrite

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you are using records, I think. XStream does not support them well. x-stream/xstream#345 If you switch to final classes (yes it is irritating) then you should be able to make this a List<FlakyFailure> and XStream should produce (semi-)attractive and functional XML.

Just be sure the concrete type is ArrayList! Do not try to use List.of(), Collections.unmodifiableList, etc. in the field itself. You can always clone lists in a getter and/or setter or use an unmodifiable collection in a getter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was more about returning an empty liist which create an empty element in the xml and so was breaking the test TestResultTest#bigResultReadWrite
Now by using List but returning null instead of empty list the test is passing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, just check the format carefully to make sure the records work here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test is reading correct values from parsed files.
So I suppose it's fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just double-check the XML format on disk by inspection.

Signed-off-by: Olivier Lamy <[email protected]>
@olamy olamy requested review from jglick, timja and uhafner November 18, 2025 00:17
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think fine as a start, not too useful for most people without the UI but that can be added on top, what do others think?

this.parent = parent;
}

public @CheckForNull List<FlakyFailure> getFlakyFailures() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @CheckForNull is not required now.

I wonder, why the field itself still is nullable? All those ugly if (x != null) guards could be eliminated by working with an empty collection. You can add a readResolve method to ensure that the field is set in old serializations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because this

[ERROR] Tests run: 18, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.579 s <<< FAILURE! -- in hudson.tasks.junit.TestResultTest
[ERROR] hudson.tasks.junit.TestResultTest.bigResultReadWrite -- Time elapsed: 0.298 s <<< FAILURE!
org.opentest4j.AssertionFailedError: Forgot to implement XML parsing for something? ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:158)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:139)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:69)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:41)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:228)
	at hudson.tasks.junit.TestResultTest.bigResultReadWrite(TestResultTest.java:464)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   TestResultTest.bigResultReadWrite:464 Forgot to implement XML parsing for something? ==> expected: <true> but was: <false>

so it looks parsing files needs to be done with XMLStreamReader as well,
Hopefully I don't have to do with SAX.. (at least I hope :))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting test, it is totally unclear what the test is doing. Would be helpful when the variables would use meaningful names...

Without using XmlUnit it is hard too see what is wrong in the document.

@olamy olamy marked this pull request as draft November 18, 2025 09:33
@olamy
Copy link
Member Author

olamy commented Nov 18, 2025

back to draft to implement all possible xml parsers :)

@timja
Copy link
Member

timja commented Nov 19, 2025

FYI there seems to be some way to show flakiness as this screenshot has it: #766

@papajulio
Copy link

@timja that's this plugin https://plugins.jenkins.io/test-stability/

Signed-off-by: Olivier Lamy <[email protected]>
@olamy olamy marked this pull request as ready for review November 21, 2025 09:06
Signed-off-by: Olivier Lamy <[email protected]>
@olamy
Copy link
Member Author

olamy commented Nov 21, 2025

FYI there seems to be some way to show flakiness as this screenshot has it: #766

this plugin is not taking into account the fact that surefire may eventually rerun test multiple times before getting a success (which means it's flaky :))

@olamy olamy requested review from timja and uhafner November 21, 2025 12:13
Copy link
Member

@uhafner uhafner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a maintainer of the plugin so I don't want to create too much overhead for you.

So only a non-binding comment (as another Jenkins plugin developer):
I am wondering why the same code is used for flakyFailures and rerunFailures. Even the entities are identical. Wouldn't it simplify everything when the values are stored in an entity Failure? One is created for the flakyFailures element and one for the rerunFailures element?

Signed-off-by: Olivier Lamy <[email protected]>
@olamy
Copy link
Member Author

olamy commented Nov 22, 2025

@uhafner yes good point. I have refactored a bit to simplify. back to record and use a single entity.

.getProperties()
.size());

Diff fileDiff = DiffBuilder.compare(f.getFile())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well we can keep to use only the simple String diff option.
but this one gives more details when failing

@olamy olamy requested a review from uhafner November 22, 2025 01:38
@olamy
Copy link
Member Author

olamy commented Nov 22, 2025

@timja back to review and ready

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@timja timja merged commit 491ff05 into jenkinsci:master Nov 23, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants