Skip to content

Commit

Permalink
test: ensure Storage instances are closed in ITStorageLifecycleTest (#…
Browse files Browse the repository at this point in the history
…2246)

Looking at CI logs I noticed grpc was logging a leaked channel pool. The storage instance wasn't being closed in these tests.
  • Loading branch information
BenWhitehead authored Oct 5, 2023
1 parent 338dd18 commit f1740ee
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public void grpc() throws Exception {
service1.close();

// expect a new instance to be returned
Storage service3 = options.getService();

assertThat(service3).isNotSameInstanceAs(service1);
// make sure an RPC can be done
StreamSupport.stream(service3.list().iterateAll().spliterator(), false)
.collect(Collectors.toList());
try (Storage service3 = options.getService()) {
assertThat(service3).isNotSameInstanceAs(service1);
// make sure an RPC can be done
StreamSupport.stream(service3.list().iterateAll().spliterator(), false)
.collect(Collectors.toList());
}
}

@Test
Expand All @@ -95,11 +95,12 @@ public void http() throws Exception {
service1.close(); // this should be a no-op for http

// expect the original instance to still be returned
Storage service3 = options.getService();
try (Storage service3 = options.getService()) {

assertThat(service3).isSameInstanceAs(service1);
// make sure an RPC can be done
StreamSupport.stream(service3.list().iterateAll().spliterator(), false)
.collect(Collectors.toList());
assertThat(service3).isSameInstanceAs(service1);
// make sure an RPC can be done
StreamSupport.stream(service3.list().iterateAll().spliterator(), false)
.collect(Collectors.toList());
}
}
}

0 comments on commit f1740ee

Please sign in to comment.