Skip to content
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

fix flaky test idHasMultiplePrefixesAndSuffixesSameOrder #1991

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ljmcr
Copy link

@ljmcr ljmcr commented Oct 16, 2024

The flaky test idHasMultiplePrefixesAndSuffixesSameOrder was founded and detected using NonDex by running:
mvn -pl drools-model/drools-model-codegen edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.springframework.data.couchbase.core.mapping.MappingCouchbaseConverterTests#idHasMultiplePrefixesAndSuffixesSameOrder
In the test method, all prefix and suffix are added in the same order, which can cause entity.id to vary across different runs. I propose setting the entity.id to a fixed value to align with the test's intended behavior. Given that there is also a comment suggesting that the entire test may be disallowed, I would appreciate any feedback on how to best address this issue.

Copy link
Collaborator

@mikereiche mikereiche left a comment

Choose a reason for hiding this comment

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

The flaky test idHasMultiplePrefixesAndSuffixesSameOrder

How is it flaky? It always passes with the correct result.

prefix and suffix are added in the same order, which can cause entity.id to vary across different runs

putting them in the same order is what makes entity.id always "333.abc.222"

@@ -1184,10 +1184,12 @@ class Entity {
@IdSuffix(order = 1) public String suffix = "222";
}
Entity entity = new Entity();
entity.id = entity.prefix + '.' + entity.prefix1 + '.' + entity.someId + '.' + entity.suffix + '.' + entity.suffix1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test is for the construction of converted.getId() by the converter. When entity.id is already it us used instead of constructing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants