diff options
author | David Pursehouse <dpursehouse@collab.net> | 2016-11-04 22:10:01 +0900 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2016-11-08 11:11:41 +0900 |
commit | 1ef6e50b0a0649958fa85ff16cbe8efbea9894e8 (patch) | |
tree | 6bb5830d02fd9be806287ade0bd58110fbbeaea8 | |
parent | a61b6eed5337049a7feb58ac935543624f107129 (diff) |
AbstractSubmit: Add more assertions in submitWholeTopic
Add an additional check that the remote log has the expected commits
after the submit.
Bug: Issue 4887
Change-Id: Ia39fd771d9e019f97670d6131022fcd3d8d2965d
-rw-r--r-- | gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java index 213f62cbe9..c565ad0725 100644 --- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java +++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java @@ -22,6 +22,7 @@ import static com.google.common.truth.TruthJUnit.assume; import static com.google.gerrit.extensions.client.ListChangesOption.CURRENT_REVISION; import static com.google.gerrit.extensions.client.ListChangesOption.DETAILED_LABELS; +import com.google.common.base.Function; import com.google.common.base.Strings; import com.google.common.collect.HashMultimap; import com.google.common.collect.Iterables; @@ -163,6 +164,27 @@ public abstract class AbstractSubmit extends AbstractDaemonTest { // Also check submitters for changes submitted via the topic relationship. assertSubmitter(change1); assertSubmitter(change2); + + // Check that the repo has the expected commits + List<RevCommit> log = getRemoteLog(); + List<String> commitsInRepo = Lists.transform(log, + new Function<RevCommit, String>() { + @Override + public String apply(RevCommit input) { + return input.getShortMessage(); + } + }); + int expectedCommitCount = getSubmitType() == SubmitType.MERGE_ALWAYS + ? 5 // initial commit + 3 commits + merge commit + : 4; // initial commit + 3 commits + assertThat(log).hasSize(expectedCommitCount); + + assertThat(commitsInRepo).containsAllOf( + "Initial empty repository", "Change 1", "Change 2", "Change 3"); + if (getSubmitType() == SubmitType.MERGE_ALWAYS) { + assertThat(commitsInRepo).contains( + "Merge changes from topic 'test-topic'"); + } } @Test |