use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class RefAdvertisementIT method advertisedReferencesOmitPrivateChangesOfOtherUsersWhenShortcutDisabled.
@Test
@GerritConfig(name = "auth.skipFullRefEvaluationIfAllRefsAreVisible", value = "false")
public void advertisedReferencesOmitPrivateChangesOfOtherUsersWhenShortcutDisabled() throws Exception {
projectOperations.project(project).forUpdate().add(allow(Permission.READ).ref("refs/*").group(REGISTERED_USERS)).update();
TestRepository<?> userTestRepository = cloneProject(project, user);
try (Git git = userTestRepository.git()) {
String change3RefName = cd3.currentPatchSet().refName();
assertWithMessage("Precondition violated").that(getRefs(git)).contains(change3RefName);
gApi.changes().id(cd3.getId().get()).setPrivate(true, null);
assertThat(getRefs(git)).doesNotContain(change3RefName);
}
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProject_WhenDefaultBranchIsSet_WithBranches.
@Test
@GerritConfig(name = "gerrit.defaultBranch", value = "refs/heads/main")
public void createProject_WhenDefaultBranchIsSet_WithBranches() throws Exception {
// Host-level default only applies if no branches were passed in the input
String newProjectName = name("newProject");
ProjectInput in = new ProjectInput();
in.name = newProjectName;
in.createEmptyCommit = true;
in.branches = ImmutableList.of("refs/heads/test", "release");
gApi.projects().create(in);
ImmutableMap<String, BranchInfo> branches = getProjectBranches(newProjectName);
assertThat(branches.keySet()).containsExactly("HEAD", "refs/meta/config", "refs/heads/test", "refs/heads/release");
assertHead(newProjectName, "refs/heads/test");
assertEmptyCommit(newProjectName, "refs/heads/test", "refs/heads/release");
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CreateProjectIT method createPermissionOnlyProject_WhenDefaultBranchIsSet.
@Test
@GerritConfig(name = "gerrit.defaultBranch", value = "main")
public void createPermissionOnlyProject_WhenDefaultBranchIsSet() throws Exception {
String newProjectName = name("newProject");
ProjectInput in = new ProjectInput();
in.name = newProjectName;
in.permissionsOnly = true;
gApi.projects().create(in);
// For permissionOnly, don't use host-level default branch.
assertHead(newProjectName, RefNames.REFS_CONFIG);
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CreateProjectIT method createProjectWithEmptyCommit_WhenDefaultBranchIsSet.
@Test
@GerritConfig(name = "gerrit.defaultBranch", value = "main")
public void createProjectWithEmptyCommit_WhenDefaultBranchIsSet() throws Exception {
String newProjectName = name("newProject");
ProjectInput in = new ProjectInput();
in.name = newProjectName;
in.createEmptyCommit = true;
gApi.projects().create(in);
ImmutableMap<String, BranchInfo> branches = getProjectBranches(newProjectName);
// HEAD symbolic ref is set to the default, and the actual ref is created.
assertThat(branches.keySet()).containsExactly("HEAD", "refs/meta/config", "refs/heads/main");
assertHead(newProjectName, "refs/heads/main");
assertEmptyCommit(newProjectName, "HEAD", "refs/heads/main");
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CreateProjectIT method repositoryConfigTakesPrecedenceOverInheritedSubmitType.
@SuppressWarnings("deprecation")
@Test
@GerritConfig(name = "repository.testinheritedsubmittype/*.defaultSubmitType", value = "CHERRY_PICK")
public void repositoryConfigTakesPrecedenceOverInheritedSubmitType() throws Exception {
// Can't use name() since we need to specify this project name in gerrit.config prior to
// startup. Pick something reasonably unique instead.
String parent = "testinheritedsubmittype";
ProjectInput pin = new ProjectInput();
pin.name = parent;
pin.submitType = SubmitType.MERGE_ALWAYS;
ConfigInfo cfg = gApi.projects().create(pin).config();
assertThat(cfg.submitType).isEqualTo(SubmitType.MERGE_ALWAYS);
assertThat(cfg.defaultSubmitType.value).isEqualTo(SubmitType.MERGE_ALWAYS);
assertThat(cfg.defaultSubmitType.configuredValue).isEqualTo(SubmitType.MERGE_ALWAYS);
assertThat(cfg.defaultSubmitType.inheritedValue).isEqualTo(SubmitType.MERGE_IF_NECESSARY);
String child = parent + "/child";
pin = new ProjectInput();
pin.parent = parent;
pin.name = child;
cfg = gApi.projects().create(pin).config();
assertThat(cfg.submitType).isEqualTo(SubmitType.CHERRY_PICK);
assertThat(cfg.defaultSubmitType.value).isEqualTo(SubmitType.CHERRY_PICK);
assertThat(cfg.defaultSubmitType.configuredValue).isEqualTo(SubmitType.CHERRY_PICK);
assertThat(cfg.defaultSubmitType.inheritedValue).isEqualTo(SubmitType.MERGE_ALWAYS);
}
Aggregations