-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Cleanup CRD generator tests #6663
base: main
Are you sure you want to change the base?
Cleanup CRD generator tests #6663
Conversation
916860c
to
2c13e8d
Compare
There was a test failure in the Windows Build / Java 17 Maven EDIT: Another failure that seems to be unrelated: 2024-11-25T21:11:21.6203975Z [ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.939 s <<< FAILURE! -- in io.fabric8.openshift.client.impl.OpenShiftConfigTest
2024-11-25T21:11:21.6208738Z [ERROR] io.fabric8.openshift.client.impl.OpenShiftConfigTest.shouldInstantiateClientUsingSerializeDeserialize -- Time elapsed: 8.464 s <<< FAILURE!
2024-11-25T21:11:21.6210624Z org.opentest4j.AssertionFailedError: expected: <null> but was: <default>
2024-11-25T21:11:21.6211908Z at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
2024-11-25T21:11:21.6213448Z at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
2024-11-25T21:11:21.6214825Z at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
2024-11-25T21:11:21.6215953Z at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
2024-11-25T21:11:21.6217128Z at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
2024-11-25T21:11:21.6218286Z at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1145)
2024-11-25T21:11:21.6220001Z at io.fabric8.openshift.client.impl.OpenShiftConfigTest.shouldInstantiateClientUsingSerializeDeserialize(OpenShiftConfigTest.java:90)
2024-11-25T21:11:21.6221855Z at java.base/java.lang.reflect.Method.invoke(Method.java:580)
2024-11-25T21:11:21.6222803Z at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
2024-11-25T21:11:21.6223725Z at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) https://github.com/fabric8io/kubernetes-client/actions/runs/12018627620/job/33503520990?pr=6663 EDIT: Another failure that looks unrelated |
95ddc58
to
e6520bb
Compare
e9b0b12
to
575d4a2
Compare
Yes. |
575d4a2
to
d69e378
Compare
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.
Hi @Donnerbart
Thanks for looking into this.
A few comments I can already provide before digging into the actual review.
The changelog entry is not needed since this is just a test refactor and is not actually something relevant for the end users.
Multiple assertThat statements should be avoided.
I've seen this especially in your changes to the GeneratorTest where in most cases the multiple assertThat statements plus statisfies calls could be easily merged into a single statement.
d69e378
to
ffdd4f9
Compare
Signed-off-by: David Sondermann <[email protected]>
Signed-off-by: David Sondermann <[email protected]>
ffdd4f9
to
27fcdac
Compare
Signed-off-by: David Sondermann <[email protected]>
27fcdac
to
8537603
Compare
I've removed the changelog entry (just saw a similar one in a previous release). @manusa Could you give me one concrete example how you would like the asserts to look like? I'm struggeling a bit with the deep nested structures and the many How do you want to assert if you have to dive into multiple "branches" of the same object like in |
Quality Gate passedIssues Measures |
Hi @Donnerbart,
In general, if it's tricky to create an assertion with a single AssertJ statement it's a clear symptom that the test is checking too many things and should probably be split into multiple cases.
|
Also, considering the complexity of the Test suite, it might be better to create multiple PRs instead of a single one with all the changes at once. |
Description
Cleanup CRD generator tests to current code style, e.g.
final var
for local variablesList.of()
andMap.of()
for empty and singleton collectionsOptional::isPresent
checks in this case)Type of change
test, version modification, documentation, etc.)
Checklist