|
56 | 56 | import org.junit.jupiter.api.BeforeAll; |
57 | 57 | import org.junit.jupiter.api.Test; |
58 | 58 |
|
59 | | -public class ITNightlyBigQueryTest { |
| 59 | +public class ITNightlyBigQueryTest extends ITBase { |
60 | 60 | static final String PROJECT_ID = ServiceOptions.getDefaultProjectId(); |
61 | 61 | static Connection bigQueryConnection; |
62 | 62 | static Statement bigQueryStatement; |
@@ -215,18 +215,13 @@ public void testQueryInterruptGracefullyStopsExplicitJob() |
215 | 215 | DriverManager.getConnection(connection_uri + ";JobCreationMode=1", new Properties()); |
216 | 216 | Statement bigQueryStatement = bigQueryConnection.createStatement(); |
217 | 217 |
|
218 | | - // This query takes 300 seconds to complete |
219 | | - String query300Seconds = |
220 | | - "DECLARE DELAY_TIME DATETIME; SET DELAY_TIME = DATETIME_ADD(CURRENT_DATETIME, INTERVAL 300" |
221 | | - + " SECOND); WHILE CURRENT_DATETIME < DELAY_TIME DO END WHILE;"; |
222 | | - |
223 | 218 | // Query will be started in the background thread & we will call cancel from current thread. |
224 | 219 | Thread t = |
225 | 220 | new Thread( |
226 | 221 | () -> { |
227 | 222 | SQLException e = |
228 | 223 | assertThrows( |
229 | | - SQLException.class, () -> bigQueryStatement.execute(query300Seconds)); |
| 224 | + SQLException.class, () -> bigQueryStatement.execute(query300seconds)); |
230 | 225 | assertTrue(e.getMessage().contains("User requested cancellation")); |
231 | 226 | threadException.set(false); |
232 | 227 | }); |
@@ -254,18 +249,13 @@ public void testQueryInterruptGracefullyStopsOptionalJob() |
254 | 249 | DriverManager.getConnection(connection_uri + ";JobCreationMode=2", new Properties()); |
255 | 250 | Statement bigQueryStatement = bigQueryConnection.createStatement(); |
256 | 251 |
|
257 | | - // This query takes 300 seconds to complete |
258 | | - String query300Seconds = |
259 | | - "DECLARE DELAY_TIME DATETIME; SET DELAY_TIME = DATETIME_ADD(CURRENT_DATETIME, INTERVAL 300" |
260 | | - + " SECOND); WHILE CURRENT_DATETIME < DELAY_TIME DO END WHILE;"; |
261 | | - |
262 | 252 | // Query will be started in the background thread & we will call cancel from current thread. |
263 | 253 | Thread t = |
264 | 254 | new Thread( |
265 | 255 | () -> { |
266 | 256 | SQLException e = |
267 | 257 | assertThrows( |
268 | | - SQLException.class, () -> bigQueryStatement.execute(query300Seconds)); |
| 258 | + SQLException.class, () -> bigQueryStatement.execute(query300seconds)); |
269 | 259 | assertTrue(e.getMessage().contains("Query was cancelled.")); |
270 | 260 | threadException.set(false); |
271 | 261 | }); |
|
0 commit comments