Merge changes from topic 'behind-the-back'

* changes:
  SubmitOnPushIT: Add assertions about new patch set when closing
  Add push tests for some weird behind-the-back scenarios
  Add a test for a single push of N changes
This commit is contained in:
Dave Borowitz
2016-06-14 16:54:54 +00:00
committed by Gerrit Code Review
3 changed files with 239 additions and 10 deletions

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.acceptance;
import static com.google.common.truth.Truth.assertThat;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.primitives.Ints;
@@ -39,6 +41,7 @@ import org.eclipse.jgit.transport.JschConfigSessionFactory;
import org.eclipse.jgit.transport.OpenSshConfig.Host;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.SshSessionFactory;
import org.eclipse.jgit.util.FS;
@@ -158,6 +161,20 @@ public class GitUtil {
return Iterables.getOnlyElement(r);
}
public static void assertPushOk(PushResult result, String ref) {
RemoteRefUpdate rru = result.getRemoteUpdate(ref);
assertThat(rru.getStatus()).named(rru.toString())
.isEqualTo(RemoteRefUpdate.Status.OK);
}
public static void assertPushRejected(PushResult result, String ref,
String expectedMessage) {
RemoteRefUpdate rru = result.getRemoteUpdate(ref);
assertThat(rru.getStatus()).named(rru.toString())
.isEqualTo(RemoteRefUpdate.Status.REJECTED_OTHER_REASON);
assertThat(rru.getMessage()).isEqualTo(expectedMessage);
}
public static Optional<String> getChangeId(TestRepository<?> tr, ObjectId id)
throws IOException {
RevCommit c = tr.getRevWalk().parseCommit(id);