Skip to content

Commit 0642e6a

Browse files
authored
tests: unflake max staleness read tests (#86)
1 parent a5e031d commit 0642e6a

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/test/java/com/google/cloud/spanner/jdbc/it/ITJdbcReadOnlyTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public void createTestTables() throws Exception {
8484

8585
@Test
8686
public void testSqlScript() throws Exception {
87+
// Wait 100ms to ensure that staleness tests in the script succeed.
88+
Thread.sleep(100L);
8789
JdbcSqlScriptVerifier verifier = new JdbcSqlScriptVerifier(new ITJdbcConnectionProvider());
8890
verifier.verifyStatementsInFile("ITReadOnlySpannerTest.sql", SqlScriptVerifier.class);
8991
}

src/test/java/com/google/cloud/spanner/jdbc/it/ITReadOnlySpannerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ public void createTestTables() throws Exception {
101101

102102
@Test
103103
public void testSqlScript() throws Exception {
104+
// Wait 100ms to ensure that staleness tests in the script succeed.
105+
Thread.sleep(100L);
104106
SqlScriptVerifier verifier = new SqlScriptVerifier(new ITConnectionProvider());
105107
verifier.verifyStatementsInFile("ITReadOnlySpannerTest.sql", SqlScriptVerifier.class);
106108
}

src/test/resources/com/google/cloud/spanner/jdbc/ITReadOnlySpannerTest.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ SHOW VARIABLE READ_TIMESTAMP;
109109

110110

111111
NEW_CONNECTION;
112-
--TimestampBound.ofExactStaleness(100, TimeUnit.MILLISECONDS),
112+
--TimestampBound.ofExactStaleness(1, TimeUnit.MILLISECONDS),
113113

114-
SET READ_ONLY_STALENESS = 'EXACT_STALENESS 100ms';
114+
SET READ_ONLY_STALENESS = 'EXACT_STALENESS 1ms';
115115

116116
@EXPECT RESULT_SET
117117
SELECT COUNT(*) AS ACTUAL, 1000 AS EXPECTED FROM NUMBERS;

0 commit comments

Comments
 (0)