Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ public void testQueryInterruptGracefullyStopsExplicitJob()
});
t.start();
// Allow thread to actually initiate the query
Thread.sleep(3000);
// Even when job is created, we might be using `query` API which means if we cancle within first
// 10 seconds,
// it is similar to Optional job cancellation. Need to wait until after we're in "Wait for job
// completion" mode.
Thread.sleep(15000);
bigQueryStatement.cancel();
// Wait until background thread is finished
t.join();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,10 @@ public void testSetTimeout() throws SQLException {
assertEquals(0, statement.getQueryTimeout());
statement.setQueryTimeout(1);
assertEquals(1, statement.getQueryTimeout());
try {
statement.executeQuery(selectQuery);
} catch (SQLException e) {
assertTrue(true);
assertEquals("SQL execution canceled", e.getMessage());
}
SQLException e = assertThrows(SQLException.class, () -> statement.executeQuery(selectQuery));
assertEquals(
"BigQueryException during runQuery\nJob execution was cancelled: Job timed out",
e.getMessage());
statement.close();
connection.close();
}
Expand Down
Loading