GitProtocolV2IT: Fail if git client is too old to support v2

JUnit assumption violation is not reflected on Bazel UI: [1]. As the
consequence, if a test is passing it's not clear, it's skipped due to
assumption violation or it is passing the actual tests. Especially for
the important Gerrit features like git wire protocol v2 we must be sure
that the integration tests got actually executed and were successful.

Given that the git wire protocol test requires very recent git client
version (2.18) add git-protocol-v2 label to the test rule and provide
instructions how to skip the test in Bazel documentation.

[1] https://github.com/bazelbuild/bazel/issues/3476

Bug: Issue 12032
Change-Id: Icba99ab22fa7e99fb303eb79cf3df3b354ee3d77
diff --git a/Documentation/dev-bazel.txt b/Documentation/dev-bazel.txt
index 3eac4e5..eac18d9 100644
--- a/Documentation/dev-bazel.txt
+++ b/Documentation/dev-bazel.txt
@@ -304,6 +304,12 @@
   bazel test --test_tag_filters=-docker //...
 ----
 
+To exclude tests that require very recent git client version:
+
+----
+  bazel test --test_tag_filters=-git-protocol-v2 //...
+----
+
 To ignore cached test results:
 
 ----
@@ -324,6 +330,7 @@
 * edit
 * elastic
 * git
+* git-protocol-v2
 * notedb
 * pgm
 * rest
diff --git a/javatests/com/google/gerrit/integration/git/BUILD b/javatests/com/google/gerrit/integration/git/BUILD
index 6a6f5ad..4184f1f 100644
--- a/javatests/com/google/gerrit/integration/git/BUILD
+++ b/javatests/com/google/gerrit/integration/git/BUILD
@@ -3,5 +3,5 @@
 acceptance_tests(
     srcs = glob(["*IT.java"]),
     group = "git",
-    labels = ["git"],
+    labels = ["git-protocol-v2"],
 )
diff --git a/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java b/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java
index 22981f0..162f73a 100644
--- a/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java
+++ b/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java
@@ -15,7 +15,6 @@
 package com.google.gerrit.integration.git;
 
 import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.TruthJUnit.assume;
 import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.allow;
 import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.deny;
 import static java.nio.charset.StandardCharsets.UTF_8;
@@ -63,8 +62,9 @@
     GitClientVersion requiredGitVersion = new GitClientVersion(2, 18, 0);
     GitClientVersion actualGitVersion =
         new GitClientVersion(execute(ImmutableList.of("git", "version")));
-    // If not found, test succeeds with assumption violation
-    assume().that(actualGitVersion).isAtLeast(requiredGitVersion);
+    // If git client version cannot be updated, consider to skip this tests. Due to
+    // an existing issue in bazel, JUnit assumption violation feature cannot be used.
+    assertThat(actualGitVersion).isAtLeast(requiredGitVersion);
 
     try (ServerContext ctx = startServer()) {
       ctx.getInjector().injectMembers(this);