CheckCodeOwnerConfigFilesIT: Test that non-visible branches are omitted
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Icb452f10acd0398f30cf7e9cb837e632e2aeb709
diff --git a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java
index a0f3384..e17063a 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerConfigFilesIT.java
@@ -27,6 +27,7 @@
import com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations;
import com.google.gerrit.entities.Permission;
import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.RefNames;
import com.google.gerrit.extensions.api.config.ConsistencyCheckInfo.ConsistencyProblemInfo;
import com.google.gerrit.extensions.api.projects.BranchInput;
import com.google.gerrit.extensions.restapi.AuthException;
@@ -86,6 +87,22 @@
}
@Test
+ public void nonVisibleBranchesAreSkipped() throws Exception {
+ String branchName = "non-visible";
+ gApi.projects().name(project.get()).branch(branchName).create(new BranchInput());
+
+ projectOperations
+ .project(project)
+ .forUpdate()
+ .add(block(Permission.READ).ref(RefNames.fullName(branchName)).group(REGISTERED_USERS))
+ .update();
+
+ assertThat(checkCodeOwnerConfigFilesIn(project))
+ .containsExactly(
+ "refs/heads/master", ImmutableMap.of(), "refs/meta/config", ImmutableMap.of());
+ }
+
+ @Test
@GerritConfig(name = "plugin.code-owners.disabledBranch", value = "refs/meta/config")
public void disabledBranchesAreSkipped() throws Exception {
assertThat(checkCodeOwnerConfigFilesIn(project))