@@ -1099,10 +1099,12 @@ public static void beforeClass() throws InterruptedException, IOException {
10991099 .setContentType ("application/json" )
11001100 .build (),
11011101 JSON_CONTENT_SIMPLE .getBytes (StandardCharsets .UTF_8 ));
1102- InputStream stream =
1103- ITBigQueryTest .class .getClassLoader ().getResourceAsStream ("QueryTestData.csv" );
1104- storage .createFrom (
1105- BlobInfo .newBuilder (BUCKET , LOAD_FILE_LARGE ).setContentType ("text/plain" ).build (), stream );
1102+ try (InputStream stream =
1103+ ITBigQueryTest .class .getClassLoader ().getResourceAsStream ("QueryTestData.csv" )) {
1104+ storage .createFrom (
1105+ BlobInfo .newBuilder (BUCKET , LOAD_FILE_LARGE ).setContentType ("text/plain" ).build (),
1106+ stream );
1107+ }
11061108 storage .create (
11071109 BlobInfo .newBuilder (BUCKET , JSON_LOAD_FILE_BQ_RESULTSET )
11081110 .setContentType ("application/json" )
@@ -1179,10 +1181,11 @@ public static void beforeClass() throws InterruptedException, IOException {
11791181 }
11801182
11811183 @ AfterClass
1182- public static void afterClass () throws ExecutionException , InterruptedException {
1184+ public static void afterClass () throws Exception {
11831185 if (bigquery != null ) {
11841186 RemoteBigQueryHelper .forceDelete (bigquery , DATASET );
11851187 RemoteBigQueryHelper .forceDelete (bigquery , UK_DATASET );
1188+ RemoteBigQueryHelper .forceDelete (bigquery , OTHER_DATASET );
11861189 RemoteBigQueryHelper .forceDelete (bigquery , MODEL_DATASET );
11871190 RemoteBigQueryHelper .forceDelete (bigquery , ROUTINE_DATASET );
11881191 }
@@ -1191,6 +1194,11 @@ public static void afterClass() throws ExecutionException, InterruptedException
11911194 if (!wasDeleted && LOG .isLoggable (Level .WARNING )) {
11921195 LOG .log (Level .WARNING , "Deletion of bucket {0} timed out, bucket is not empty" , BUCKET );
11931196 }
1197+ storage .close ();
1198+ }
1199+
1200+ if (otel instanceof OpenTelemetrySdk ) {
1201+ ((OpenTelemetrySdk ) otel ).close ();
11941202 }
11951203 }
11961204
0 commit comments