From 04871dcc2a106b2504489af1c1f6d53a38a0ff41 Mon Sep 17 00:00:00 2001 From: sanjaypujare Date: Thu, 17 Sep 2020 21:25:19 -0700 Subject: [PATCH] xds: bootstrapper fixes: remove extra readBootstrap & avoid parseConfig (#7436) --- .../main/java/io/grpc/xds/Bootstrapper.java | 2 +- .../sds/ClientSslContextProviderFactory.java | 11 +- .../sds/ServerSslContextProviderFactory.java | 11 +- .../internal/sds/TlsContextManagerImpl.java | 10 +- .../grpc/xds/CommonBootstrapperTestUtils.java | 74 +++++ .../io/grpc/xds/XdsSdsClientServerTest.java | 4 +- ...tProviderClientSslContextProviderTest.java | 11 +- ...tProviderServerSslContextProviderTest.java | 11 +- .../CommonCertProviderTestUtils.java | 270 ------------------ ...MeshCaCertificateProviderProviderTest.java | 202 +++++++++---- .../ClientSslContextProviderFactoryTest.java | 10 +- .../ServerSslContextProviderFactoryTest.java | 10 +- 12 files changed, 269 insertions(+), 357 deletions(-) create mode 100644 xds/src/test/java/io/grpc/xds/CommonBootstrapperTestUtils.java diff --git a/xds/src/main/java/io/grpc/xds/Bootstrapper.java b/xds/src/main/java/io/grpc/xds/Bootstrapper.java index 19856b88a66..f1f10a5d707 100644 --- a/xds/src/main/java/io/grpc/xds/Bootstrapper.java +++ b/xds/src/main/java/io/grpc/xds/Bootstrapper.java @@ -84,7 +84,7 @@ public static Bootstrapper getInstance() { /** Parses a raw string into {@link BootstrapInfo}. */ @VisibleForTesting @SuppressWarnings("unchecked") - public static BootstrapInfo parseConfig(String rawData) throws XdsInitializationException { + static BootstrapInfo parseConfig(String rawData) throws XdsInitializationException { XdsLogger logger = XdsLogger.withPrefix(LOG_PREFIX); logger.log(XdsLogLevel.INFO, "Reading bootstrap information"); Map rawBootstrap; diff --git a/xds/src/main/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactory.java b/xds/src/main/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactory.java index 1163e94ab28..19ad67186c3 100644 --- a/xds/src/main/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactory.java +++ b/xds/src/main/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactory.java @@ -34,8 +34,8 @@ final class ClientSslContextProviderFactory private final CertProviderClientSslContextProvider.Factory certProviderClientSslContextProviderFactory; - ClientSslContextProviderFactory() { - this(Bootstrapper.getInstance(), CertProviderClientSslContextProvider.Factory.getInstance()); + ClientSslContextProviderFactory(Bootstrapper bootstrapper) { + this(bootstrapper, CertProviderClientSslContextProvider.Factory.getInstance()); } ClientSslContextProviderFactory( @@ -58,7 +58,7 @@ public SslContextProvider create(UpstreamTlsContext upstreamTlsContext) { try { return SdsClientSslContextProvider.getProvider( upstreamTlsContext, - Bootstrapper.getInstance().readBootstrap().getNode().toEnvoyProtoNodeV2(), + bootstrapper.readBootstrap().getNode().toEnvoyProtoNodeV2(), Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setNameFormat("client-sds-sslcontext-provider-%d") .setDaemon(true) @@ -70,10 +70,11 @@ public SslContextProvider create(UpstreamTlsContext upstreamTlsContext) { } else if (CommonTlsContextUtil.hasCertProviderInstance( upstreamTlsContext.getCommonTlsContext())) { try { + Bootstrapper.BootstrapInfo bootstrapInfo = bootstrapper.readBootstrap(); return certProviderClientSslContextProviderFactory.getProvider( upstreamTlsContext, - bootstrapper.readBootstrap().getNode().toEnvoyProtoNode(), - bootstrapper.readBootstrap().getCertProviders()); + bootstrapInfo.getNode().toEnvoyProtoNode(), + bootstrapInfo.getCertProviders()); } catch (XdsInitializationException e) { throw new RuntimeException(e); } diff --git a/xds/src/main/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactory.java b/xds/src/main/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactory.java index e3f006acee6..3a33c975c0b 100644 --- a/xds/src/main/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactory.java +++ b/xds/src/main/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactory.java @@ -34,8 +34,8 @@ final class ServerSslContextProviderFactory private final CertProviderServerSslContextProvider.Factory certProviderServerSslContextProviderFactory; - ServerSslContextProviderFactory() { - this(Bootstrapper.getInstance(), CertProviderServerSslContextProvider.Factory.getInstance()); + ServerSslContextProviderFactory(Bootstrapper bootstrapper) { + this(bootstrapper, CertProviderServerSslContextProvider.Factory.getInstance()); } ServerSslContextProviderFactory( @@ -60,7 +60,7 @@ public SslContextProvider create( try { return SdsServerSslContextProvider.getProvider( downstreamTlsContext, - Bootstrapper.getInstance().readBootstrap().getNode().toEnvoyProtoNodeV2(), + bootstrapper.readBootstrap().getNode().toEnvoyProtoNodeV2(), Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() .setNameFormat("server-sds-sslcontext-provider-%d") .setDaemon(true) @@ -72,10 +72,11 @@ public SslContextProvider create( } else if (CommonTlsContextUtil.hasCertProviderInstance( downstreamTlsContext.getCommonTlsContext())) { try { + Bootstrapper.BootstrapInfo bootstrapInfo = bootstrapper.readBootstrap(); return certProviderServerSslContextProviderFactory.getProvider( downstreamTlsContext, - bootstrapper.readBootstrap().getNode().toEnvoyProtoNode(), - bootstrapper.readBootstrap().getCertProviders()); + bootstrapInfo.getNode().toEnvoyProtoNode(), + bootstrapInfo.getCertProviders()); } catch (XdsInitializationException e) { throw new RuntimeException(e); } diff --git a/xds/src/main/java/io/grpc/xds/internal/sds/TlsContextManagerImpl.java b/xds/src/main/java/io/grpc/xds/internal/sds/TlsContextManagerImpl.java index a870e9d36fd..31d2e014ee9 100644 --- a/xds/src/main/java/io/grpc/xds/internal/sds/TlsContextManagerImpl.java +++ b/xds/src/main/java/io/grpc/xds/internal/sds/TlsContextManagerImpl.java @@ -19,6 +19,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.annotations.VisibleForTesting; +import io.grpc.xds.Bootstrapper; import io.grpc.xds.EnvoyServerProtoData.DownstreamTlsContext; import io.grpc.xds.EnvoyServerProtoData.UpstreamTlsContext; import io.grpc.xds.internal.sds.ReferenceCountingMap.ValueFactory; @@ -36,8 +37,11 @@ public final class TlsContextManagerImpl implements TlsContextManager { private final ReferenceCountingMap mapForClients; private final ReferenceCountingMap mapForServers; - private TlsContextManagerImpl() { - this(new ClientSslContextProviderFactory(), new ServerSslContextProviderFactory()); + /** Create a TlsContextManagerImpl instance using the passed in {@link Bootstrapper}. */ + @VisibleForTesting public TlsContextManagerImpl(Bootstrapper bootstrapper) { + this( + new ClientSslContextProviderFactory(bootstrapper), + new ServerSslContextProviderFactory(bootstrapper)); } @VisibleForTesting @@ -53,7 +57,7 @@ private TlsContextManagerImpl() { /** Gets the TlsContextManagerImpl singleton. */ public static synchronized TlsContextManagerImpl getInstance() { if (instance == null) { - instance = new TlsContextManagerImpl(); + instance = new TlsContextManagerImpl(Bootstrapper.getInstance()); } return instance; } diff --git a/xds/src/test/java/io/grpc/xds/CommonBootstrapperTestUtils.java b/xds/src/test/java/io/grpc/xds/CommonBootstrapperTestUtils.java new file mode 100644 index 00000000000..547c61f94ca --- /dev/null +++ b/xds/src/test/java/io/grpc/xds/CommonBootstrapperTestUtils.java @@ -0,0 +1,74 @@ +/* + * Copyright 2020 The gRPC Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.grpc.xds; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import io.grpc.internal.JsonParser; +import java.io.IOException; +import java.util.Map; + +public class CommonBootstrapperTestUtils { + private static final String FILE_WATCHER_CONFIG = "{\"path\": \"/etc/secret/certs\"}"; + private static final String MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"target_uri\": \"meshca.com\",\n" + + " \"channel_credentials\": {\"google_default\": {}},\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"token_exchange_service\": \"securetoken.googleapis.com\",\n" + + " \"subject_token_path\": \"/etc/secret/sajwt.token\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " },\n" // end google_grpc + + " \"time_out\": {\"seconds\": 10}\n" + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"certificate_lifetime\": {\"seconds\": 86400},\n" + + " \"renewal_grace_period\": {\"seconds\": 3600},\n" + + " \"key_type\": \"RSA\",\n" + + " \"key_size\": 2048,\n" + + " \"location\": \"https://container.googleapis.com/v1/project/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" + + " }"; + + /** Creates a test bootstrap info object. */ + @SuppressWarnings("unchecked") + public static Bootstrapper.BootstrapInfo getTestBootstrapInfo() { + try { + Bootstrapper.CertificateProviderInfo gcpId = + new Bootstrapper.CertificateProviderInfo( + "testca", (Map) JsonParser.parse(MESHCA_CONFIG)); + Bootstrapper.CertificateProviderInfo fileProvider = + new Bootstrapper.CertificateProviderInfo( + "file_watcher", (Map) JsonParser.parse(FILE_WATCHER_CONFIG)); + Map certProviders = + ImmutableMap.of("gcp_id", gcpId, "file_provider", fileProvider); + Bootstrapper.BootstrapInfo bootstrapInfo = + new Bootstrapper.BootstrapInfo( + ImmutableList.of(), + EnvoyProtoData.Node.newBuilder().build(), + certProviders); + return bootstrapInfo; + } catch (IOException e) { + throw new AssertionError(e); + } + } +} diff --git a/xds/src/test/java/io/grpc/xds/XdsSdsClientServerTest.java b/xds/src/test/java/io/grpc/xds/XdsSdsClientServerTest.java index 3ccf551756e..0a16e3f60e5 100644 --- a/xds/src/test/java/io/grpc/xds/XdsSdsClientServerTest.java +++ b/xds/src/test/java/io/grpc/xds/XdsSdsClientServerTest.java @@ -80,10 +80,12 @@ public class XdsSdsClientServerTest { @Rule public final GrpcCleanupRule cleanupRule = new GrpcCleanupRule(); private int port; private FakeNameResolverFactory fakeNameResolverFactory; + private Bootstrapper mockBootstrapper; @Before public void setUp() throws IOException { port = XdsServerTestHelper.findFreePort(); + mockBootstrapper = mock(Bootstrapper.class); } @After @@ -367,7 +369,7 @@ private SimpleServiceGrpc.SimpleServiceBlockingStub getBlockingStub( ? Attributes.newBuilder() .set(XdsAttributes.ATTR_SSL_CONTEXT_PROVIDER_SUPPLIER, new SslContextProviderSupplier( - upstreamTlsContext, TlsContextManagerImpl.getInstance())) + upstreamTlsContext, new TlsContextManagerImpl(mockBootstrapper))) .build() : Attributes.EMPTY; fakeNameResolverFactory.setServers( diff --git a/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderClientSslContextProviderTest.java b/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderClientSslContextProviderTest.java index f7d8d69bfa1..00b29014648 100644 --- a/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderClientSslContextProviderTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderClientSslContextProviderTest.java @@ -34,6 +34,7 @@ import io.envoyproxy.envoy.config.core.v3.DataSource; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext; import io.grpc.xds.Bootstrapper; +import io.grpc.xds.CommonBootstrapperTestUtils; import io.grpc.xds.EnvoyServerProtoData; import io.grpc.xds.internal.sds.CommonTlsContextTestsUtil; import io.grpc.xds.internal.sds.CommonTlsContextTestsUtil.TestCallback; @@ -96,7 +97,7 @@ public void testProviderForClient_mtls() throws Exception { getSslContextProvider( "gcp_id", "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); @@ -159,7 +160,7 @@ public void testProviderForClient_queueExecutor() throws Exception { getSslContextProvider( "gcp_id", "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); QueuedExecutor queuedExecutor = new QueuedExecutor(); @@ -192,7 +193,7 @@ public void testProviderForClient_tls() throws Exception { getSslContextProvider( /* certInstanceName= */ null, "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); @@ -229,7 +230,7 @@ public void testProviderForClient_sslContextException_onError() throws Exception getSslContextProvider( /* certInstanceName= */ null, "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */null, staticCertValidationContext); @@ -260,7 +261,7 @@ public void testProviderForClient_rootInstanceNull_expectError() throws Exceptio getSslContextProvider( /* certInstanceName= */ null, /* rootInstanceName= */ null, - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); fail("exception expected"); diff --git a/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderServerSslContextProviderTest.java b/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderServerSslContextProviderTest.java index 9de2081ed7c..ef801ccc2c1 100644 --- a/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderServerSslContextProviderTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/certprovider/CertProviderServerSslContextProviderTest.java @@ -32,6 +32,7 @@ import io.envoyproxy.envoy.config.core.v3.DataSource; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext; import io.grpc.xds.Bootstrapper; +import io.grpc.xds.CommonBootstrapperTestUtils; import io.grpc.xds.EnvoyServerProtoData; import io.grpc.xds.internal.certprovider.CertProviderClientSslContextProviderTest.QueuedExecutor; import io.grpc.xds.internal.sds.CommonTlsContextTestsUtil; @@ -90,7 +91,7 @@ public void testProviderForServer_mtls() throws Exception { getSslContextProvider( "gcp_id", "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null, /* requireClientCert= */ true); @@ -154,7 +155,7 @@ public void testProviderForServer_queueExecutor() throws Exception { getSslContextProvider( "gcp_id", "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null, /* requireClientCert= */ true); @@ -188,7 +189,7 @@ public void testProviderForServer_tls() throws Exception { getSslContextProvider( "gcp_id", /* rootInstanceName= */ null, - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null, /* requireClientCert= */ false); @@ -229,7 +230,7 @@ public void testProviderForServer_sslContextException_onError() throws Exception getSslContextProvider( /* certInstanceName= */ "gcp_id", /* rootInstanceName= */ "gcp_id", - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */null, staticCertValidationContext, /* requireClientCert= */ true); @@ -266,7 +267,7 @@ public void testProviderForServer_certInstanceNull_expectError() throws Exceptio getSslContextProvider( /* certInstanceName= */ null, /* rootInstanceName= */ null, - CommonCertProviderTestUtils.getTestBootstrapInfo(), + CommonBootstrapperTestUtils.getTestBootstrapInfo(), /* alpnProtocols= */ null, /* staticCertValidationContext= */ null, /* requireClientCert= */ false); diff --git a/xds/src/test/java/io/grpc/xds/internal/certprovider/CommonCertProviderTestUtils.java b/xds/src/test/java/io/grpc/xds/internal/certprovider/CommonCertProviderTestUtils.java index 4e70164fe60..9507f3deac0 100644 --- a/xds/src/test/java/io/grpc/xds/internal/certprovider/CommonCertProviderTestUtils.java +++ b/xds/src/test/java/io/grpc/xds/internal/certprovider/CommonCertProviderTestUtils.java @@ -20,8 +20,6 @@ import com.google.common.io.CharStreams; import io.grpc.internal.testing.TestUtils; -import io.grpc.xds.Bootstrapper; -import io.grpc.xds.XdsInitializationException; import io.grpc.xds.internal.sds.trust.CertificateUtils; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -55,274 +53,6 @@ public class CommonCertProviderTestUtils { "-+END\\s+.*PRIVATE\\s+KEY[^-]*-+", // Footer Pattern.CASE_INSENSITIVE); - /** Creates a test bootstrap info object. */ - public static Bootstrapper.BootstrapInfo getTestBootstrapInfo() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"target_uri\": \"meshca.com\",\n" - + " \"channel_credentials\": {\"google_default\": {}},\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"token_exchange_service\": \"securetoken.googleapis.com\",\n" - + " \"subject_token_path\": \"/etc/secret/sajwt.token\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " },\n" // end google_grpc - + " \"time_out\": {\"seconds\": 10}\n" - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"certificate_lifetime\": {\"seconds\": 86400},\n" - + " \"renewal_grace_period\": {\"seconds\": 3600},\n" - + " \"key_type\": \"RSA\",\n" - + " \"key_size\": 2048,\n" - + " \"location\": \"https://container.googleapis.com/v1/project/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " },\n" // end gcp_id - + " \"file_provider\": {\n" - + " \"plugin_name\": \"file_watcher\",\n" - + " \"config\": {\"path\": \"/etc/secret/certs\"}\n" - + " }\n" - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getNonDefaultTestBootstrapInfo() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"target_uri\": \"nonDefaultMeshCaUrl\",\n" - + " \"channel_credentials\": {\"google_default\": {}},\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"token_exchange_service\": \"test.sts.com\",\n" - + " \"subject_token_path\": \"/tmp/path4\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " },\n" // end google_grpc - + " \"time_out\": {\"seconds\": 12}\n" - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"certificate_lifetime\": {\"seconds\": 234567},\n" - + " \"renewal_grace_period\": {\"seconds\": 4321},\n" - + " \"key_type\": \"RSA\",\n" - + " \"key_size\": 512,\n" - + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " },\n" // end gcp_id - + " \"file_provider\": {\n" - + " \"plugin_name\": \"file_watcher\",\n" - + " \"config\": {\"path\": \"/etc/secret/certs\"}\n" - + " }\n" - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getMinimalBootstrapInfo() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"subject_token_path\": \"/tmp/path5\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " }\n" // end google_grpc - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " }\n" // end gcp_id - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getMinimalBootstrapInfo_v1beta1AndZone() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"subject_token_path\": \"/tmp/path5\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " }\n" // end google_grpc - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"location\": \"https://container.googleapis.com/v1beta1/projects/test-project1/zones/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " }\n" // end gcp_id - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getMinimalAndBadClusterUrlBootstrapInfo() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"subject_token_path\": \"/tmp/path5\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " }\n" // end google_grpc - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"location\": \"https://container.googleapis.com/v1/project/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " }\n" // end gcp_id - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getMissingSaJwtLocation() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " }\n" - + " }]\n" // end call_credentials - + " }\n" // end google_grpc - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " }\n" // end gcp_id - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getMissingGkeClusterUrl() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"target_uri\": \"meshca.com\",\n" - + " \"channel_credentials\": {\"google_default\": {}},\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"token_exchange_service\": \"securetoken.googleapis.com\",\n" - + " \"subject_token_path\": \"/etc/secret/sajwt.token\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " },\n" // end google_grpc - + " \"time_out\": {\"seconds\": 10}\n" - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"certificate_lifetime\": {\"seconds\": 86400},\n" - + " \"renewal_grace_period\": {\"seconds\": 3600},\n" - + " \"key_type\": \"RSA\",\n" - + " \"key_size\": 2048\n" - + " }\n" // end config - + " },\n" // end gcp_id - + " \"file_provider\": {\n" - + " \"plugin_name\": \"file_watcher\",\n" - + " \"config\": {\"path\": \"/etc/secret/certs\"}\n" - + " }\n" - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - - static Bootstrapper.BootstrapInfo getBadChannelCredsConfig() - throws XdsInitializationException { - String rawData = - "{\n" - + " \"xds_servers\": [],\n" - + " \"certificate_providers\": {\n" - + " \"gcp_id\": {\n" - + " \"plugin_name\": \"testca\",\n" - + " \"config\": {\n" - + " \"server\": {\n" - + " \"api_type\": \"GRPC\",\n" - + " \"grpc_services\": [{\n" - + " \"google_grpc\": {\n" - + " \"channel_credentials\": {\"mtls\": \"true\"},\n" - + " \"call_credentials\": [{\n" - + " \"sts_service\": {\n" - + " \"subject_token_path\": \"/tmp/path5\"\n" - + " }\n" - + " }]\n" // end call_credentials - + " }\n" // end google_grpc - + " }]\n" // end grpc_services - + " },\n" // end server - + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" - + " }\n" // end config - + " }\n" // end gcp_id - + " }\n" - + "}"; - return Bootstrapper.parseConfig(rawData); - } - static PrivateKey getPrivateKey(String resourceName) throws Exception { InputStream inputStream = TestUtils.class.getResourceAsStream("/certs/" + resourceName); diff --git a/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderProviderTest.java b/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderProviderTest.java index d1bd116703b..791d5a395c5 100644 --- a/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderProviderTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/certprovider/MeshCaCertificateProviderProviderTest.java @@ -29,9 +29,8 @@ import com.google.auth.oauth2.GoogleCredentials; import io.grpc.internal.BackoffPolicy; import io.grpc.internal.ExponentialBackoffPolicy; +import io.grpc.internal.JsonParser; import io.grpc.internal.TimeProvider; -import io.grpc.xds.Bootstrapper; -import io.grpc.xds.XdsInitializationException; import io.grpc.xds.internal.sts.StsCredentials; import java.io.IOException; import java.util.Map; @@ -107,10 +106,11 @@ public void providerRegisteredName() { } @Test - public void createProvider_minimalConfig() throws XdsInitializationException { + public void createProvider_minimalConfig() throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildMinimalConfig(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(MINIMAL_MESHCA_CONFIG); ScheduledExecutorService mockService = mock(ScheduledExecutorService.class); when(scheduledExecutorServiceFactory.create( eq(MeshCaCertificateProviderProvider.MESHCA_URL_DEFAULT))) @@ -143,10 +143,11 @@ public void createProvider_minimalConfig() throws XdsInitializationException { @Test public void createProvider_minimalConfig_v1beta1AndZone() - throws XdsInitializationException { + throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildMinimalConfig_v1beta1AndZone(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(V1BETA1_ZONE_MESHCA_CONFIG); ScheduledExecutorService mockService = mock(ScheduledExecutorService.class); when(scheduledExecutorServiceFactory.create( eq(MeshCaCertificateProviderProvider.MESHCA_URL_DEFAULT))) @@ -179,10 +180,11 @@ public void createProvider_minimalConfig_v1beta1AndZone() @Test public void createProvider_missingGkeUrl_expectException() - throws XdsInitializationException { + throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildMissingGkeClusterUrlConfig(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(MISSING_GKE_CLUSTER_URL_MESHCA_CONFIG); try { provider.createCertificateProvider(map, distWatcher, true); fail("exception expected"); @@ -192,11 +194,12 @@ public void createProvider_missingGkeUrl_expectException() } @Test - public void createProvider_missingGkeSaJwtLocation_expectException() - throws XdsInitializationException { + public void createProvider_missingSaJwtLocation_expectException() + throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildMissingSaJwtLocationConfig(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(MISSING_SAJWT_MESHCA_CONFIG); try { provider.createCertificateProvider(map, distWatcher, true); fail("exception expected"); @@ -207,10 +210,11 @@ public void createProvider_missingGkeSaJwtLocation_expectException() @Test public void createProvider_missingProject_expectException() - throws XdsInitializationException { + throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildBadClusterUrlConfig(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(MINIMAL_BAD_CLUSTER_URL_MESHCA_CONFIG); try { provider.createCertificateProvider(map, distWatcher, true); fail("exception expected"); @@ -221,10 +225,11 @@ public void createProvider_missingProject_expectException() @Test public void createProvider_badChannelCreds_expectException() - throws XdsInitializationException { + throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildBadChannelCredsConfig(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(BAD_CHANNEL_CREDS_MESHCA_CONFIG); try { provider.createCertificateProvider(map, distWatcher, true); fail("exception expected"); @@ -234,10 +239,11 @@ public void createProvider_badChannelCreds_expectException() } @Test - public void createProvider_nonDefaultFullConfig() throws XdsInitializationException { + public void createProvider_nonDefaultFullConfig() throws IOException { CertificateProvider.DistributorWatcher distWatcher = new CertificateProvider.DistributorWatcher(); - Map map = buildFullConfig(); + @SuppressWarnings("unchecked") + Map map = (Map) JsonParser.parse(NONDEFAULT_MESHCA_CONFIG); ScheduledExecutorService mockService = mock(ScheduledExecutorService.class); when(scheduledExecutorServiceFactory.create(eq(NON_DEFAULT_MESH_CA_URL))) .thenReturn(mockService); @@ -267,45 +273,137 @@ public void createProvider_nonDefaultFullConfig() throws XdsInitializationExcept eq(TimeUnit.SECONDS.toMillis(RPC_TIMEOUT_SECONDS))); } - private static Map buildFullConfig() throws XdsInitializationException { - return getCertProviderConfig(CommonCertProviderTestUtils.getNonDefaultTestBootstrapInfo()); - } + private static final String NONDEFAULT_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"target_uri\": \"nonDefaultMeshCaUrl\",\n" + + " \"channel_credentials\": {\"google_default\": {}},\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"token_exchange_service\": \"test.sts.com\",\n" + + " \"subject_token_path\": \"/tmp/path4\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " },\n" // end google_grpc + + " \"time_out\": {\"seconds\": 12}\n" + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"certificate_lifetime\": {\"seconds\": 234567},\n" + + " \"renewal_grace_period\": {\"seconds\": 4321},\n" + + " \"key_type\": \"RSA\",\n" + + " \"key_size\": 512,\n" + + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" + + " }"; - private static Map buildMinimalConfig() throws XdsInitializationException { - return getCertProviderConfig(CommonCertProviderTestUtils.getMinimalBootstrapInfo()); - } + private static final String MINIMAL_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"subject_token_path\": \"/tmp/path5\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " }\n" // end google_grpc + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" + + " }"; - private static Map buildMinimalConfig_v1beta1AndZone() - throws XdsInitializationException { - return getCertProviderConfig( - CommonCertProviderTestUtils.getMinimalBootstrapInfo_v1beta1AndZone()); - } + private static final String V1BETA1_ZONE_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"subject_token_path\": \"/tmp/path5\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " }\n" // end google_grpc + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"location\": \"https://container.googleapis.com/v1beta1/projects/test-project1/zones/test-zone2/clusters/test-cluster3\"\n" + + " }"; - private static Map buildBadClusterUrlConfig() throws XdsInitializationException { - return getCertProviderConfig( - CommonCertProviderTestUtils.getMinimalAndBadClusterUrlBootstrapInfo()); - } + private static final String MINIMAL_BAD_CLUSTER_URL_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"subject_token_path\": \"/tmp/path5\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " }\n" // end google_grpc + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"location\": \"https://container.googleapis.com/v1/project/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" + + " }"; - private static Map buildMissingSaJwtLocationConfig() - throws XdsInitializationException { - return getCertProviderConfig(CommonCertProviderTestUtils.getMissingSaJwtLocation()); - } + private static final String MISSING_SAJWT_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " }\n" + + " }]\n" // end call_credentials + + " }\n" // end google_grpc + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" + + " }"; - private static Map buildMissingGkeClusterUrlConfig() - throws XdsInitializationException { - return getCertProviderConfig(CommonCertProviderTestUtils.getMissingGkeClusterUrl()); - } - - private static Map buildBadChannelCredsConfig() - throws XdsInitializationException { - return getCertProviderConfig(CommonCertProviderTestUtils.getBadChannelCredsConfig()); - } + private static final String MISSING_GKE_CLUSTER_URL_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"target_uri\": \"meshca.com\",\n" + + " \"channel_credentials\": {\"google_default\": {}},\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"token_exchange_service\": \"securetoken.googleapis.com\",\n" + + " \"subject_token_path\": \"/etc/secret/sajwt.token\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " },\n" // end google_grpc + + " \"time_out\": {\"seconds\": 10}\n" + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"certificate_lifetime\": {\"seconds\": 86400},\n" + + " \"renewal_grace_period\": {\"seconds\": 3600},\n" + + " \"key_type\": \"RSA\",\n" + + " \"key_size\": 2048\n" + + " }"; - private static Map getCertProviderConfig(Bootstrapper.BootstrapInfo bootstrapInfo) { - Map certProviders = - bootstrapInfo.getCertProviders(); - Bootstrapper.CertificateProviderInfo gcpIdInfo = - certProviders.get("gcp_id"); - return gcpIdInfo.getConfig(); - } + private static final String BAD_CHANNEL_CREDS_MESHCA_CONFIG = + "{\n" + + " \"server\": {\n" + + " \"api_type\": \"GRPC\",\n" + + " \"grpc_services\": [{\n" + + " \"google_grpc\": {\n" + + " \"channel_credentials\": {\"mtls\": \"true\"},\n" + + " \"call_credentials\": [{\n" + + " \"sts_service\": {\n" + + " \"subject_token_path\": \"/tmp/path5\"\n" + + " }\n" + + " }]\n" // end call_credentials + + " }\n" // end google_grpc + + " }]\n" // end grpc_services + + " },\n" // end server + + " \"location\": \"https://container.googleapis.com/v1/projects/test-project1/locations/test-zone2/clusters/test-cluster3\"\n" + + " }"; } diff --git a/xds/src/test/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactoryTest.java b/xds/src/test/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactoryTest.java index 7b37c2d6449..46f0685b5a0 100644 --- a/xds/src/test/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactoryTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/sds/ClientSslContextProviderFactoryTest.java @@ -30,6 +30,7 @@ import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext; import io.envoyproxy.envoy.type.matcher.v3.StringMatcher; import io.grpc.xds.Bootstrapper; +import io.grpc.xds.CommonBootstrapperTestUtils; import io.grpc.xds.EnvoyServerProtoData.UpstreamTlsContext; import io.grpc.xds.XdsInitializationException; import io.grpc.xds.internal.certprovider.CertProviderClientSslContextProvider; @@ -37,7 +38,6 @@ import io.grpc.xds.internal.certprovider.CertificateProviderProvider; import io.grpc.xds.internal.certprovider.CertificateProviderRegistry; import io.grpc.xds.internal.certprovider.CertificateProviderStore; -import io.grpc.xds.internal.certprovider.CommonCertProviderTestUtils; import io.grpc.xds.internal.certprovider.TestCertificateProvider; import java.io.IOException; import org.junit.Assert; @@ -131,7 +131,7 @@ public void createCertProviderClientSslContextProvider() throws XdsInitializatio /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = clientSslContextProviderFactory.create(upstreamTlsContext); @@ -154,7 +154,7 @@ public void createCertProviderClientSslContextProvider_onlyRootCert() /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = clientSslContextProviderFactory.create(upstreamTlsContext); @@ -184,7 +184,7 @@ public void createCertProviderClientSslContextProvider_withStaticContext() /* alpnProtocols= */ null, staticCertValidationContext); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = clientSslContextProviderFactory.create(upstreamTlsContext); @@ -211,7 +211,7 @@ public void createCertProviderClientSslContextProvider_2providers() /* alpnProtocols= */ null, /* staticCertValidationContext= */ null); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = clientSslContextProviderFactory.create(upstreamTlsContext); diff --git a/xds/src/test/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactoryTest.java b/xds/src/test/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactoryTest.java index 3f0f8cf2e04..00d32268b49 100644 --- a/xds/src/test/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactoryTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/sds/ServerSslContextProviderFactoryTest.java @@ -30,13 +30,13 @@ import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext; import io.envoyproxy.envoy.type.matcher.v3.StringMatcher; import io.grpc.xds.Bootstrapper; +import io.grpc.xds.CommonBootstrapperTestUtils; import io.grpc.xds.EnvoyServerProtoData.DownstreamTlsContext; import io.grpc.xds.XdsInitializationException; import io.grpc.xds.internal.certprovider.CertProviderServerSslContextProvider; import io.grpc.xds.internal.certprovider.CertificateProvider; import io.grpc.xds.internal.certprovider.CertificateProviderRegistry; import io.grpc.xds.internal.certprovider.CertificateProviderStore; -import io.grpc.xds.internal.certprovider.CommonCertProviderTestUtils; import java.io.IOException; import org.junit.Assert; import org.junit.Before; @@ -128,7 +128,7 @@ public void createCertProviderServerSslContextProvider() throws XdsInitializatio /* staticCertValidationContext= */ null, /* requireClientCert= */ true); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = serverSslContextProviderFactory.create(downstreamTlsContext); @@ -152,7 +152,7 @@ public void createCertProviderServerSslContextProvider_onlyCertInstance() /* staticCertValidationContext= */ null, /* requireClientCert= */ true); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = serverSslContextProviderFactory.create(downstreamTlsContext); @@ -183,7 +183,7 @@ public void createCertProviderServerSslContextProvider_withStaticContext() staticCertValidationContext, /* requireClientCert= */ true); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = serverSslContextProviderFactory.create(downstreamTlsContext); @@ -211,7 +211,7 @@ public void createCertProviderServerSslContextProvider_2providers() /* staticCertValidationContext= */ null, /* requireClientCert= */ true); - Bootstrapper.BootstrapInfo bootstrapInfo = CommonCertProviderTestUtils.getTestBootstrapInfo(); + Bootstrapper.BootstrapInfo bootstrapInfo = CommonBootstrapperTestUtils.getTestBootstrapInfo(); when(bootstrapper.readBootstrap()).thenReturn(bootstrapInfo); SslContextProvider sslContextProvider = serverSslContextProviderFactory.create(downstreamTlsContext);