Search in sources :

Example 11 with Violation

use of com.google.rpc.PreconditionFailure.Violation in project bazel-buildfarm by bazelbuild.

the class AbstractServerInstanceTest method nestedOutputDirectoriesAreInvalid.

@Test
public void nestedOutputDirectoriesAreInvalid() {
    PreconditionFailure.Builder preconditionFailureBuilder = PreconditionFailure.newBuilder();
    AbstractServerInstance.validateOutputs(ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of("foo", "foo/bar"), preconditionFailureBuilder);
    PreconditionFailure preconditionFailure = preconditionFailureBuilder.build();
    assertThat(preconditionFailure.getViolationsCount()).isEqualTo(1);
    Violation violation = preconditionFailure.getViolationsList().get(0);
    assertThat(violation.getType()).isEqualTo(VIOLATION_TYPE_INVALID);
    assertThat(violation.getSubject()).isEqualTo("foo");
    assertThat(violation.getDescription()).isEqualTo(OUTPUT_DIRECTORY_IS_OUTPUT_ANCESTOR);
}
Also used : Violation(com.google.rpc.PreconditionFailure.Violation) PreconditionFailure(com.google.rpc.PreconditionFailure) Test(org.junit.Test)

Example 12 with Violation

use of com.google.rpc.PreconditionFailure.Violation in project bazel-buildfarm by bazelbuild.

the class AbstractServerInstanceTest method outputDirectoriesContainingOutputFilesAreInvalid.

@Test
public void outputDirectoriesContainingOutputFilesAreInvalid() {
    PreconditionFailure.Builder preconditionFailureBuilder = PreconditionFailure.newBuilder();
    AbstractServerInstance.validateOutputs(ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of("foo/bar"), ImmutableSet.of("foo"), preconditionFailureBuilder);
    PreconditionFailure preconditionFailure = preconditionFailureBuilder.build();
    assertThat(preconditionFailure.getViolationsCount()).isEqualTo(1);
    Violation violation = preconditionFailure.getViolationsList().get(0);
    assertThat(violation.getType()).isEqualTo(VIOLATION_TYPE_INVALID);
    assertThat(violation.getSubject()).isEqualTo("foo");
    assertThat(violation.getDescription()).isEqualTo(OUTPUT_DIRECTORY_IS_OUTPUT_ANCESTOR);
}
Also used : Violation(com.google.rpc.PreconditionFailure.Violation) PreconditionFailure(com.google.rpc.PreconditionFailure) Test(org.junit.Test)

Aggregations

PreconditionFailure (com.google.rpc.PreconditionFailure)12 Violation (com.google.rpc.PreconditionFailure.Violation)12 Test (org.junit.Test)11 Digest (build.bazel.remote.execution.v2.Digest)4 Directory (build.bazel.remote.execution.v2.Directory)2 OutputDirectory (build.bazel.remote.execution.v2.OutputDirectory)2 ActionCacheGrpc (build.bazel.remote.execution.v2.ActionCacheGrpc)1 ContentAddressableStorageGrpc (build.bazel.remote.execution.v2.ContentAddressableStorageGrpc)1 ExecuteOperationMetadata (build.bazel.remote.execution.v2.ExecuteOperationMetadata)1 ExecuteResponse (build.bazel.remote.execution.v2.ExecuteResponse)1 ExecutionGrpc (build.bazel.remote.execution.v2.ExecutionGrpc)1 Actions.checkPreconditionFailure (build.buildfarm.common.Actions.checkPreconditionFailure)1 OperationQueueGrpc (build.buildfarm.v1test.OperationQueueGrpc)1 ByteStreamGrpc (com.google.bytestream.ByteStreamGrpc)1 Operation (com.google.longrunning.Operation)1 OperationsGrpc (com.google.longrunning.OperationsGrpc)1 Any (com.google.protobuf.Any)1 ByteString (com.google.protobuf.ByteString)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1