@@ -8,7 +8,7 @@ const IMAGE = getImage(__dirname, 3);
88describe ( "SpannerEmulatorContainer" , { timeout : 240_000 } , ( ) => {
99 // startupWithExplicitClient {
1010 it ( "should start, expose endpoints and accept real client connections using explicitly configured client" , async ( ) => {
11- const container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
11+ await using container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
1212
1313 const client = new Spanner ( {
1414 projectId : container . getProjectId ( ) ,
@@ -26,8 +26,6 @@ describe("SpannerEmulatorContainer", { timeout: 240_000 }, () => {
2626 // emulator always includes "emulator-config"
2727 const expectedConfigName = admin . instanceConfigPath ( container . getProjectId ( ) , "emulator-config" ) ;
2828 expect ( configs . map ( ( c ) => c . name ) ) . toContain ( expectedConfigName ) ;
29-
30- await container . stop ( ) ;
3129 } ) ;
3230 // }
3331
@@ -38,7 +36,7 @@ describe("SpannerEmulatorContainer", { timeout: 240_000 }, () => {
3836
3937 // startupWithEnvironmentVariable {
4038 it ( "should start, expose endpoints and accept real client connections using projectId and SPANNER_EMULATOR_HOST" , async ( ) => {
41- const container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
39+ await using container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
4240
4341 // configure the client to talk to our emulator
4442 process . env . SPANNER_EMULATOR_HOST = container . getEmulatorGrpcEndpoint ( ) ;
@@ -53,8 +51,6 @@ describe("SpannerEmulatorContainer", { timeout: 240_000 }, () => {
5351 // emulator always includes "emulator-config"
5452 const expectedConfigName = admin . instanceConfigPath ( container . getProjectId ( ) , "emulator-config" ) ;
5553 expect ( configs . map ( ( c ) => c . name ) ) . toContain ( expectedConfigName ) ;
56-
57- await container . stop ( ) ;
5854 } ) ;
5955 // }
6056 } ) ;
0 commit comments