aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
authorGravatar buchgr <buchgr@google.com>2017-05-19 17:30:10 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-05-22 14:37:43 +0200
commitc30b38e2aa05defb08c4152b1e6e0eee5c63a792 (patch)
tree9b049120e180a68abc138dca770d1910f0593cce /src/test/java/com/google
parent31dbadf4e86146af90bd5a1a5dfccc046c960d76 (diff)
Remote+BES: Stabilize command line flags.
Update the command line flags used by remote execution/caching as well as the build event service (BES). Major changes: - Remote execution/caching and BES share flags for authentication and TLS. - Removed API Key authentication from BES, as it's not being used. - Add TLS support to BES upload. - Add --bes_project_id flag. If set, the value is propagated as part of BES lifecycle events. For reviewers: Start your review at CommonRemoteAndBesOptions, BuildEventServiceOptions and RemoteOptions. The other changes are mostly automatic IDE renames of fields and flag updates in shell script tests. RELNOTES: None. PiperOrigin-RevId: 156553857
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/BUILD1
-rw-r--r--src/test/java/com/google/devtools/build/lib/remote/GrpcActionCacheTest.java32
2 files changed, 19 insertions, 14 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/BUILD b/src/test/java/com/google/devtools/build/lib/BUILD
index adcbbf9d56..a97481f686 100644
--- a/src/test/java/com/google/devtools/build/lib/BUILD
+++ b/src/test/java/com/google/devtools/build/lib/BUILD
@@ -1077,6 +1077,7 @@ java_test(
"//src/main/java/com/google/devtools/build/lib:inmemoryfs",
"//src/main/java/com/google/devtools/build/lib:io",
"//src/main/java/com/google/devtools/build/lib:preconditions",
+ "//src/main/java/com/google/devtools/build/lib:runtime",
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/remote",
diff --git a/src/test/java/com/google/devtools/build/lib/remote/GrpcActionCacheTest.java b/src/test/java/com/google/devtools/build/lib/remote/GrpcActionCacheTest.java
index d9bb33c853..110cfb385b 100644
--- a/src/test/java/com/google/devtools/build/lib/remote/GrpcActionCacheTest.java
+++ b/src/test/java/com/google/devtools/build/lib/remote/GrpcActionCacheTest.java
@@ -33,6 +33,7 @@ import com.google.devtools.build.lib.remote.RemoteProtocol.CasStatus;
import com.google.devtools.build.lib.remote.RemoteProtocol.CasUploadBlobReply;
import com.google.devtools.build.lib.remote.RemoteProtocol.CasUploadBlobRequest;
import com.google.devtools.build.lib.remote.RemoteProtocol.ContentDigest;
+import com.google.devtools.build.lib.runtime.AuthAndTLSOptions;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.Path;
@@ -105,19 +106,22 @@ public class GrpcActionCacheTest {
}
private GrpcActionCache newClient() throws IOException {
- return newClient(Options.getDefaults(RemoteOptions.class));
+ return newClient(Options.getDefaults(RemoteOptions.class),
+ Options.getDefaults(AuthAndTLSOptions.class));
}
- private GrpcActionCache newClient(RemoteOptions options) throws IOException {
+ private GrpcActionCache newClient(RemoteOptions remoteOptions, AuthAndTLSOptions authTlsOptions)
+ throws IOException {
ChannelOptions channelOptions =
- options.authCredentialsJson != null
+ authTlsOptions.authCredentials != null
? ChannelOptions.create(
- options, scratch.resolve(options.authCredentialsJson).getInputStream())
- : ChannelOptions.create(options);
+ authTlsOptions, remoteOptions.grpcMaxChunkSizeBytes,
+ scratch.resolve(authTlsOptions.authCredentials).getInputStream())
+ : ChannelOptions.create(authTlsOptions, remoteOptions.grpcMaxChunkSizeBytes);
return new GrpcActionCache(
ClientInterceptors.intercept(
channel, ImmutableList.of(new ChannelOptionsInterceptor(channelOptions))),
- options,
+ remoteOptions,
channelOptions);
}
@@ -153,8 +157,8 @@ public class GrpcActionCacheTest {
options.grpcMaxBatchInputs = 10;
options.grpcMaxChunkSizeBytes = 2;
options.grpcMaxBatchSizeBytes = 10;
- options.grpcTimeoutSeconds = 10;
- GrpcActionCache client = newClient(options);
+ options.remoteTimeout = 10;
+ GrpcActionCache client = newClient(options, Options.getDefaults(AuthAndTLSOptions.class));
ContentDigest fooDigest = fakeRemoteCacheService.put("fooooooo".getBytes(UTF_8));
ContentDigest barDigest = fakeRemoteCacheService.put("baaaar".getBytes(UTF_8));
ContentDigest s1Digest = fakeRemoteCacheService.put("1".getBytes(UTF_8));
@@ -189,8 +193,8 @@ public class GrpcActionCacheTest {
options.grpcMaxBatchInputs = 10;
options.grpcMaxChunkSizeBytes = 2;
options.grpcMaxBatchSizeBytes = 10;
- options.grpcTimeoutSeconds = 10;
- GrpcActionCache client = newClient(options);
+ options.remoteTimeout = 10;
+ GrpcActionCache client = newClient(options, Options.getDefaults(AuthAndTLSOptions.class));
byte[] foo = "fooooooo".getBytes(UTF_8);
byte[] bar = "baaaar".getBytes(UTF_8);
@@ -268,9 +272,9 @@ public class GrpcActionCacheTest {
@Test
public void testAuthCredentials() throws Exception {
- RemoteOptions options = Options.getDefaults(RemoteOptions.class);
+ AuthAndTLSOptions options = Options.getDefaults(AuthAndTLSOptions.class);
options.authEnabled = true;
- options.authCredentialsJson = "/exec/root/creds.json";
+ options.authCredentials = "/exec/root/creds.json";
options.authScope = "dummy.scope";
GenericJson json = new GenericJson();
@@ -278,9 +282,9 @@ public class GrpcActionCacheTest {
json.put("client_id", "some_client");
json.put("client_secret", "foo");
json.put("refresh_token", "bar");
- scratch.file(options.authCredentialsJson, new JacksonFactory().toString(json));
+ scratch.file(options.authCredentials, new JacksonFactory().toString(json));
- GrpcActionCache client = newClient(options);
+ GrpcActionCache client = newClient(Options.getDefaults(RemoteOptions.class), options);
byte[] foo = "foo".getBytes(UTF_8);
ContentDigest fooDigest = ContentDigests.computeDigest(foo);
ImmutableList<ContentDigest> digests = client.uploadBlobs(ImmutableList.<byte[]>of(foo));