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

Spanner: Flaky Test: SpannerStatementQueryExecutor.getChildrenRowsQuery #3290

Open
williamlin0825 opened this issue Oct 6, 2024 · 0 comments
Labels
priority: p2 type: bug Something isn't working

Comments

@williamlin0825
Copy link

A test in the getChildrenRowsQueryTest checks for the result from getSQL() from SpannerStatementQueryExecutor.getChildrenRowsQuery. However, it checks the result in a specific order, which is not guaranteed. I purpose to simply check whether the selected field names are correct instead of checking in a specific order.

assertThat(statement.getSql())
.isEqualTo(
"SELECT deleted, id3, id, id_2 FROM child_test_table WHERE ((id = @tag0 AND id_2 ="
+ " @tag1)) AND (deleted = false)");

[INFO] 
INFO: Adding excluded groups to newly created one
INFO: Adding NonDex argLine to existing argLine specified by the project
CONFIG: nondexFilter=.*
nondexMode=FULL
nondexSeed=933178
nondexStart=0
nondexEnd=9223372036854775807
nondexPrintstack=false
nondexDir=/home/jhihwei2/spring-cloud-gcp/spring-cloud-gcp-data-spanner/.nondex
nondexJarDir=/home/jhihwei2/spring-cloud-gcp/spring-cloud-gcp-data-spanner/.nondex
nondexExecid=fBBMREC82yfCbEu7MM71JCaMC87SgB9c1lrSr1Wi5nY=
nondexLogging=CONFIG
test=
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.google.cloud.spring.data.spanner.repository.query.SpannerQueryLookupStrategyTests
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.198 s <<< FAILURE! -- in com.google.cloud.spring.data.spanner.repository.query.SpannerQueryLookupStrategyTests
[ERROR] com.google.cloud.spring.data.spanner.repository.query.SpannerQueryLookupStrategyTests.getChildrenRowsQueryTest -- Time elapsed: 3.119 s <<< FAILURE!
org.opentest4j.AssertionFailedError: 

expected: "SELECT deleted, id3, id, id_2 FROM child_test_table WHERE ((id = @tag0 AND id_2 = @tag1)) AND (deleted = false)"
 but was: "SELECT id_2, id, id3, deleted FROM child_test_table WHERE ((id = @tag0 AND id_2 = @tag1)) AND (deleted = false)"
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
        at com.google.cloud.spring.data.spanner.repository.query.SpannerQueryLookupStrategyTests.getChildrenRowsQueryTest(SpannerQueryLookupStrategyTests.java:177)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   SpannerQueryLookupStrategyTests.getChildrenRowsQueryTest:177 
expected: "SELECT deleted, id3, id, id_2 FROM child_test_table WHERE ((id = @tag0 AND id_2 = @tag1)) AND (deleted = false)"
 but was: "SELECT id_2, id, id3, deleted FROM child_test_table WHERE ((id = @tag0 AND id_2 = @tag1)) AND (deleted = false)"
[INFO] 
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants