Skip to content

Commit

Permalink
Minor: spacing and new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
amishra-u committed Apr 20, 2023
1 parent a102961 commit b42d75d
Showing 1 changed file with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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<URI, ImmutableMap<String, ImmutableList<String>>> credentialCache =
Caffeine.newBuilder().build();

Credentials credentials =
RemoteModule.createCredentials(
CredentialHelperEnvironment.newBuilder()
Expand Down

0 comments on commit b42d75d

Please sign in to comment.