@@ -1264,6 +1264,27 @@ public void testGrpcGcpOptionsIncludeStaticChannelPoolSettingsWithoutDcp() throw
12641264 assertEquals (Duration .ZERO , grpcGcpOptions .getChannelPoolOptions ().getScaleDownInterval ());
12651265 }
12661266
1267+ @ Test
1268+ public void testGrpcGcpLazyFallbackChannelPoolOptionsStartWithoutChannels () {
1269+ SpannerOptions options =
1270+ SpannerOptions .newBuilder ()
1271+ .setProjectId ("[PROJECT]" )
1272+ .enableGrpcGcpExtension ()
1273+ .disableDynamicChannelPool ()
1274+ .setNumChannels (8 )
1275+ .build ();
1276+
1277+ GcpChannelPoolOptions poolOptions =
1278+ GapicSpannerRpc .getGrpcGcpLazyFallbackChannelPoolOptions (options );
1279+
1280+ assertEquals (8 , poolOptions .getMaxSize ());
1281+ assertEquals (0 , poolOptions .getMinSize ());
1282+ assertEquals (0 , poolOptions .getInitSize ());
1283+ assertEquals (0 , poolOptions .getMinRpcPerChannel ());
1284+ assertEquals (0 , poolOptions .getMaxRpcPerChannel ());
1285+ assertEquals (Duration .ZERO , poolOptions .getScaleDownInterval ());
1286+ }
1287+
12671288 @ Test
12681289 public void testGrpcGcpOptionsRetainDynamicChannelPoolSettingsWithDcp () throws Exception {
12691290 Duration affinityKeyLifetime = Duration .ofMinutes (10 );
@@ -1434,7 +1455,7 @@ private SpannerOptions createSpannerOptions() {
14341455 }
14351456
14361457 @ Test
1437- public void testDirectPathFallbackCreatesOneGrpcGcpLayerPerPath () {
1458+ public void testDirectPathFallbackCreatesLazyCloudPathGrpcGcpPool () {
14381459 SpannerOptions .useEnvironment (new SpannerOptions .SpannerEnvironment () {});
14391460 GapicSpannerRpc rpc = null ;
14401461 try {
@@ -1445,8 +1466,8 @@ public void testDirectPathFallbackCreatesOneGrpcGcpLayerPerPath() {
14451466 GrpcGcpObjectCounts before = countGrpcGcpObjectsFromChannelz ();
14461467 rpc = new GapicSpannerRpc (options );
14471468 GrpcGcpObjectCounts counts = countGrpcGcpObjectsFromChannelz ().minus (before );
1448- assertEquals (counts .debugString (), 6 , counts .gcpManagedChannels );
1449- assertEquals (counts .debugString (), 48 , counts .channelRefs );
1469+ assertEquals (counts .debugString (), 3 , counts .gcpManagedChannels );
1470+ assertEquals (counts .debugString (), 24 , counts .channelRefs );
14501471 } finally {
14511472 if (rpc != null ) {
14521473 rpc .shutdown ();
0 commit comments