@@ -31,25 +31,31 @@ describe("SpannerEmulatorContainer", { timeout: 240_000 }, () => {
3131 } ) ;
3232 // }
3333
34- // startupWithEnvironmentVariable {
35- it ( "should start, expose endpoints and accept real client connections using projectId and SPANNER_EMULATOR_HOST" , async ( ) => {
36- const container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
34+ describe . sequential ( "Shared state" , ( ) => {
35+ afterEach ( ( ) => {
36+ process . env . SPANNER_EMULATOR_HOST = "" ;
37+ } ) ;
3738
38- // configure the client to talk to our emulator
39- process . env . SPANNER_EMULATOR_HOST = container . getEmulatorGrpcEndpoint ( ) ;
40- const client = new Spanner ( { projectId : container . getProjectId ( ) } ) ;
39+ // startupWithEnvironmentVariable {
40+ 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 ( ) ;
4142
42- // list instance configs
43- const admin = client . getInstanceAdminClient ( ) ;
44- const [ configs ] = await admin . listInstanceConfigs ( {
45- parent : admin . projectPath ( container . getProjectId ( ) ) ,
46- } ) ;
43+ // configure the client to talk to our emulator
44+ process . env . SPANNER_EMULATOR_HOST = container . getEmulatorGrpcEndpoint ( ) ;
45+ const client = new Spanner ( { projectId : container . getProjectId ( ) } ) ;
4746
48- // emulator always includes "emulator-config"
49- const expectedConfigName = admin . instanceConfigPath ( container . getProjectId ( ) , "emulator-config" ) ;
50- expect ( configs . map ( ( c ) => c . name ) ) . toContain ( expectedConfigName ) ;
47+ // list instance configs
48+ const admin = client . getInstanceAdminClient ( ) ;
49+ const [ configs ] = await admin . listInstanceConfigs ( {
50+ parent : admin . projectPath ( container . getProjectId ( ) ) ,
51+ } ) ;
5152
52- await container . stop ( ) ;
53+ // emulator always includes "emulator-config"
54+ const expectedConfigName = admin . instanceConfigPath ( container . getProjectId ( ) , "emulator-config" ) ;
55+ expect ( configs . map ( ( c ) => c . name ) ) . toContain ( expectedConfigName ) ;
56+
57+ await container . stop ( ) ;
58+ } ) ;
59+ // }
5360 } ) ;
54- // }
5561} ) ;
0 commit comments