use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class SuggestReviewersIT method suggestReviewersGroupSizeConsiderations.
@Test
@GerritConfig(name = "addreviewer.maxAllowed", value = "2")
@GerritConfig(name = "addreviewer.maxWithoutConfirmation", value = "1")
public void suggestReviewersGroupSizeConsiderations() throws Exception {
AccountGroup.UUID largeGroup = createGroupWithArbitraryMembers(3);
String largeGroupName = groupOperations.group(largeGroup).get().name();
AccountGroup.UUID mediumGroup = createGroupWithArbitraryMembers(2);
String mediumGroupName = groupOperations.group(mediumGroup).get().name();
String changeId = createChange().getChangeId();
List<SuggestedReviewerInfo> reviewers;
SuggestedReviewerInfo reviewer;
// Large group should never be suggested.
reviewers = suggestReviewers(changeId, largeGroupName, 10);
assertThat(reviewers).isEmpty();
// Medium group should be suggested with appropriate count and confirm.
reviewers = suggestReviewers(changeId, mediumGroupName, 10);
assertThat(reviewers).hasSize(1);
reviewer = reviewers.get(0);
assertThat(reviewer.group.id).isEqualTo(mediumGroup.get());
assertThat(reviewer.count).isEqualTo(2);
assertThat(reviewer.confirm).isTrue();
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class SubmitByFastForwardIT method submitTwoIndependentChangesWithFastForwardFail.
@Test
@GerritConfig(name = "change.submitWholeTopic", value = "true")
public void submitTwoIndependentChangesWithFastForwardFail() throws Throwable {
RevCommit initialHead = projectOperations.project(project).getHead("master");
PushOneCommit.Result change1 = createChange("subject1", "file1.txt", "content", "topic");
testRepo.reset(initialHead);
PushOneCommit.Result change2 = createChange("subject2", "file2.txt", "content", "topic");
approve(change1.getChangeId());
approve(change2.getChangeId());
String fastForwardIndependentChangesError = "Change could not be merged because the submission" + " has two independent changes with the same destination branch. Independent changes can't " + "be submitted to the same destination branch with FAST_FORWARD_ONLY submit strategy";
submitWithConflict(change2.getChangeId(), String.format("Failed to submit 2 changes due to the following problems:\n" + "Change %d: %s\nChange %d: %s", change1.getChange().getId().get(), fastForwardIndependentChangesError, change2.getChange().getId().get(), fastForwardIndependentChangesError));
RevCommit updatedHead = projectOperations.project(project).getHead("master");
assertThat(updatedHead.getId()).isEqualTo(initialHead.getId());
assertRefUpdatedEvents();
assertChangeMergedEvents();
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class RefOperationValidationIT method enforceFileCountLimitOnPushesForReview.
@Test
@GerritConfig(name = "change.maxFiles", value = "0")
public void enforceFileCountLimitOnPushesForReview() throws Exception {
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, "change", "c.txt", "content");
PushOneCommit.Result result = push.to("refs/for/master");
result.assertErrorStatus("Exceeding maximum number of files per change");
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class CancellationIT method deadlineConfigWithZeroTimeoutIsIgnored.
@Test
@GerritConfig(name = "deadline.default.timeout", value = "0ms")
@GerritConfig(name = "deadline.default.requestType", value = "REST")
public void deadlineConfigWithZeroTimeoutIsIgnored() throws Exception {
testTicker.useFakeTicker().setAutoIncrementStep(Duration.ofMillis(2));
RestResponse response = adminRestSession.putWithHeaders("/projects/" + name("new"));
response.assertCreated();
}
use of com.google.gerrit.acceptance.config.GerritConfig in project gerrit by GerritCodeReview.
the class SubmoduleSubscriptionsIT method testSubmoduleSubjectCommitMessage.
@Test
@GerritConfig(name = "submodule.verboseSuperprojectUpdate", value = "SUBJECT_ONLY")
public void testSubmoduleSubjectCommitMessage() throws Exception {
allowMatchingSubmoduleSubscription(subKey, "refs/heads/master", superKey, "refs/heads/master");
pushChangeTo(subRepo, "master");
createSubmoduleSubscription(superRepo, "master", subKey, "master");
ObjectId subHEAD = pushChangeTo(subRepo, "master");
// The first update doesn't include the rev log
RevWalk rw = subRepo.getRevWalk();
expectToHaveCommitMessage(superRepo, "master", "Update git submodules\n\n" + "* Update " + subKey.get() + " from branch 'master'\n to " + subHEAD.getName());
// The next commit should generate only its commit message,
// omitting previous commit logs
subHEAD = pushChangeTo(subRepo, "master");
RevCommit subCommitMsg = rw.parseCommit(subHEAD);
expectToHaveCommitMessage(superRepo, "master", "Update git submodules\n\n" + "* Update " + subKey.get() + " from branch 'master'\n to " + subHEAD.getName() + "\n - " + subCommitMsg.getShortMessage());
}
Aggregations