From b42d75dd17445f3cfab4976e479cce58aec27bdb Mon Sep 17 00:00:00 2001 From: Anshuman Mishra Date: Thu, 20 Apr 2023 14:50:40 -0700 Subject: [PATCH] Minor: spacing and new lines --- .../build/lib/remote/RemoteModuleTest.java | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java b/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java index 3c66055b831754..9babfc487b4475 100644 --- a/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java +++ b/src/test/java/com/google/devtools/build/lib/remote/RemoteModuleTest.java @@ -385,38 +385,40 @@ public void testBeforeCommand() throws Exception { if (throwsException) { assertThrows(AbruptExitException.class, () -> remoteModule.beforeCommand(env)); - } else { - remoteModule.beforeCommand(env); - assertThat(Thread.interrupted()).isFalse(); - - capabilitiesList.forEach(capabilities -> { - if (!INACCESSIBLE_GRPC_REMOTE.equals(capabilities)) { - assertThat(capabilities.getRequestCount()).isEqualTo(1); - } - }); - RemoteActionContextProvider actionContextProvider = remoteModule.getActionContextProvider(); - assertThat(actionContextProvider).isNotNull(); - GrpcCacheClient grpcCacheClient = null; - GrpcRemoteExecutor grpcRemoteExecutor = null; - if (cacheCapabilities != null) { - assertThat(actionContextProvider.getRemoteCache()).isNotNull(); - assertThat(actionContextProvider.getRemoteCache().getCacheCapabilities()).isNotNull(); - assertThat(actionContextProvider.getRemoteCache().getCacheCapabilities()) - .isEqualTo(cacheCapabilities); - grpcCacheClient = (GrpcCacheClient) actionContextProvider.getRemoteCache().cacheProtocol; - assertCircuitBreakerInstance(grpcCacheClient.getRetrier().getCircuitBreaker(), remoteOptions); - } else { - assertThat(actionContextProvider.getRemoteCache()).isNull(); - } + return; + } + remoteModule.beforeCommand(env); + assertThat(Thread.interrupted()).isFalse(); - if (hasRemoteExecutionCapability) { - assertThat(actionContextProvider.getRemoteExecutionClient()).isNotNull(); - grpcRemoteExecutor = (GrpcRemoteExecutor) actionContextProvider.getRemoteExecutionClient(); - assertCircuitBreakerInstance(grpcRemoteExecutor.getRetrier().getCircuitBreaker(), remoteOptions); - } else { - assertThat(actionContextProvider.getRemoteExecutionClient()).isNull(); + capabilitiesList.forEach(capabilities -> { + if (!INACCESSIBLE_GRPC_REMOTE.equals(capabilities)) { + assertThat(capabilities.getRequestCount()).isEqualTo(1); } + }); + + RemoteActionContextProvider actionContextProvider = remoteModule.getActionContextProvider(); + assertThat(actionContextProvider).isNotNull(); + GrpcCacheClient grpcCacheClient; + GrpcRemoteExecutor grpcRemoteExecutor; + if (cacheCapabilities != null) { + assertThat(actionContextProvider.getRemoteCache()).isNotNull(); + assertThat(actionContextProvider.getRemoteCache().getCacheCapabilities()).isNotNull(); + assertThat(actionContextProvider.getRemoteCache().getCacheCapabilities()) + .isEqualTo(cacheCapabilities); + grpcCacheClient = (GrpcCacheClient) actionContextProvider.getRemoteCache().cacheProtocol; + assertCircuitBreakerInstance(grpcCacheClient.getRetrier().getCircuitBreaker(), remoteOptions); + } else { + assertThat(actionContextProvider.getRemoteCache()).isNull(); } + + if (hasRemoteExecutionCapability) { + assertThat(actionContextProvider.getRemoteExecutionClient()).isNotNull(); + grpcRemoteExecutor = (GrpcRemoteExecutor) actionContextProvider.getRemoteExecutionClient(); + assertCircuitBreakerInstance(grpcRemoteExecutor.getRetrier().getCircuitBreaker(), remoteOptions); + } else { + assertThat(actionContextProvider.getRemoteExecutionClient()).isNull(); + } + } finally { serverList.forEach(Server::shutdownNow); for (Server server : serverList) { @@ -433,8 +435,10 @@ public void testNetrc_netrcWithoutRemoteCache() throws Exception { scratch.file(netrc, "machine foo.example.org login baruser password barpass"); AuthAndTLSOptions authAndTLSOptions = Options.getDefaults(AuthAndTLSOptions.class); RemoteOptions remoteOptions = Options.getDefaults(RemoteOptions.class); + Cache>> credentialCache = Caffeine.newBuilder().build(); + Credentials credentials = RemoteModule.createCredentials( CredentialHelperEnvironment.newBuilder()