@@ -6,52 +6,47 @@ import { SpannerEmulatorContainer } from "./spanner-emulator-container";
66const IMAGE = getImage ( __dirname , 3 ) ;
77
88describe ( "SpannerEmulatorContainer" , { timeout : 240_000 } , ( ) => {
9- // startupWithExplicitClient {
109 it ( "should start, expose endpoints and accept real client connections using explicitly configured client" , async ( ) => {
10+ // startupWithExplicitClient {
1111 await using container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
1212
13- const client = new Spanner ( {
13+ const spanner = new Spanner ( {
1414 projectId : container . getProjectId ( ) ,
1515 apiEndpoint : container . getHost ( ) ,
1616 port : container . getGrpcPort ( ) ,
1717 sslCreds : container . getSslCredentials ( ) ,
1818 } ) ;
1919
20- // list instance configs
21- const admin = client . getInstanceAdminClient ( ) ;
20+ const admin = spanner . getInstanceAdminClient ( ) ;
2221 const [ configs ] = await admin . listInstanceConfigs ( {
2322 parent : admin . projectPath ( container . getProjectId ( ) ) ,
2423 } ) ;
2524
26- // emulator always includes "emulator-config"
2725 const expectedConfigName = admin . instanceConfigPath ( container . getProjectId ( ) , "emulator-config" ) ;
2826 expect ( configs . map ( ( c ) => c . name ) ) . toContain ( expectedConfigName ) ;
27+ // }
2928 } ) ;
30- // }
3129
3230 describe . sequential ( "Shared state" , ( ) => {
3331 afterEach ( ( ) => {
3432 process . env . SPANNER_EMULATOR_HOST = "" ;
3533 } ) ;
3634
37- // startupWithEnvironmentVariable {
3835 it ( "should start, expose endpoints and accept real client connections using projectId and SPANNER_EMULATOR_HOST" , async ( ) => {
3936 await using container = await new SpannerEmulatorContainer ( IMAGE ) . withProjectId ( "test-project" ) . start ( ) ;
4037
41- // configure the client to talk to our emulator
38+ // startupWithEnvironmentVariable {
4239 process . env . SPANNER_EMULATOR_HOST = container . getEmulatorGrpcEndpoint ( ) ;
43- const client = new Spanner ( { projectId : container . getProjectId ( ) } ) ;
40+ const spanner = new Spanner ( { projectId : container . getProjectId ( ) } ) ;
41+ // }
4442
45- // list instance configs
46- const admin = client . getInstanceAdminClient ( ) ;
43+ const admin = spanner . getInstanceAdminClient ( ) ;
4744 const [ configs ] = await admin . listInstanceConfigs ( {
4845 parent : admin . projectPath ( container . getProjectId ( ) ) ,
4946 } ) ;
5047
51- // emulator always includes "emulator-config"
5248 const expectedConfigName = admin . instanceConfigPath ( container . getProjectId ( ) , "emulator-config" ) ;
5349 expect ( configs . map ( ( c ) => c . name ) ) . toContain ( expectedConfigName ) ;
5450 } ) ;
55- // }
5651 } ) ;
5752} ) ;
0 commit comments