There are multiple non-deterministic tests (found with NonDex tool) across different test classes in spring-data-cassandra.
Description
These tests listed below fail intermittently due to reliance on iteration order of calls to:
ReflectionUtils.doWithFields() → Class.getDeclaredFields()
Therefore all the tests can fail with different order of fields in database statements. For example:
expected: "INSERT INTO person (id,number,list,map,set_col,first_name) VALUES ('foo',NULL,NULL,NULL,NULL,NULL)"
but was: "INSERT INTO person (id,number,first_name,set_col,list,map) VALUES ('foo',NULL,NULL,NULL,NULL,NULL)"
at org.springframework.data.cassandra.core.StatementFactoryUnitTests.shouldCreateSetInsertNulls(StatementFactoryUnitTests.java:481)
Even with the "ONE" mode in NonDex, which shuffles only for the first invocation of the data strucuture, most tests below still fails.
Related PR
I previously submitted a PR addressing one such case: #1618. That PR was later resolved with an equivalent change by the maintainers.
Proposal
Since the same root cause affects several other tests, if given permission, I would like to submit a new PR to fix all related flaky tests in a consistent way, most likely by relaxing regex in assertion for each test (similar to the PR i submitted). If preferred, I can split the fixes into multiple smaller PRs for each class.
Please let me know whether you’d like me to fix them or not.
Reproduction of Failure
openjdk version "17.0.16" 2025-07-15
OpenJDK Runtime Environment (build 17.0.16+8-Ubuntu-0ubuntu124.04.1)
OpenJDK 64-Bit Server VM (build 17.0.16+8-Ubuntu-0ubuntu124.04.1, mixed mode, sharing
Apache Maven 3.9.11
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <argLine>-Xverify:none</argLine>
mvn -pl spring-data-cassandra edu.illinois:nondex-maven-plugin:2.1.7:nondex \
-Dtest=org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentTupleEntityUnitTests#shouldReportMissingAnnotations \
-Djacoco.skip -Drat.skip -Dpmd.skip -Denforcer.skip
Other Failed Tests
The flaky tests found with NonDex:
- org.springframework.data.cassandra.core.CassandraTemplateUnitTests:
- insertShouldInsertEntity
- insertShouldConsiderEntityAfterCallback
- insertShouldInsertVersionedEntity
- insertShouldInsertVersionedEntityAfterCallback
- insertShouldInsertWithNulls
- updateShouldUpdateVersionedEntity
- updateShouldUpdateEntity
- updateShouldUpdateEntityWithLwt
- updateShouldUpdateEntityWithOptions
- insertShouldInsertWithOptionsEntity
- org.springframework.data.cassandra.core.StatementFactoryUnitTests
- shouldCreateSetInsertNulls
- shouldCreateSetUpdateFromObjectWithEmptyCollections
- shouldCreateSetUpdateFromObject
- shouldUpdateCqlVector
- shouldRenderMappedFields
- org.springframework.data.cassandra.core.ReactiveCassandraTemplateUnitTests
- updateShouldUpdateVersionedEntity
- insertShouldInsertEntity
- insertShouldInsertVersionedEntity
- org.springframework.data.cassandra.core.mapping.CassandraPersistentEntityOrderPropertiesUnitTests
- org.springframework.data.cassandra.core.AsyncCassandraTemplateUnitTests
- insertShouldInsertEntity
- insertShouldInsertVersionedEntity
- updateShouldUpdateVersionedEntity
- insertShouldConsiderEntityAfterCallback
- org.springframework.data.cassandra.observability.ObservationStatementUnitTests
There are multiple non-deterministic tests (found with NonDex tool) across different test classes in spring-data-cassandra.
Description
These tests listed below fail intermittently due to reliance on iteration order of calls to:
Therefore all the tests can fail with different order of fields in database statements. For example:
Even with the "ONE" mode in NonDex, which shuffles only for the first invocation of the data strucuture, most tests below still fails.
Related PR
I previously submitted a PR addressing one such case: #1618. That PR was later resolved with an equivalent change by the maintainers.
Proposal
Since the same root cause affects several other tests, if given permission, I would like to submit a new PR to fix all related flaky tests in a consistent way, most likely by relaxing regex in assertion for each test (similar to the PR i submitted). If preferred, I can split the fixes into multiple smaller PRs for each class.
Please let me know whether you’d like me to fix them or not.
Reproduction of Failure
Original commit: 3239d1b
Add one line to pom.xml to skip verification when run with NonDex
Other Failed Tests
The flaky tests found with NonDex: