ChangeIT: Move reflog test to ReflogIT

Change-Id: Iaca8427db6c0af3c8b7fa620b708268f69023eb3
This commit is contained in:
David Pursehouse
2018-08-15 10:04:54 +01:00
parent 107b2bd5ca
commit fc95445267
2 changed files with 26 additions and 26 deletions

View File

@@ -69,7 +69,6 @@ import com.google.gerrit.acceptance.NoHttpd;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.TestAccount;
import com.google.gerrit.acceptance.TestProjectInput;
import com.google.gerrit.acceptance.UseLocalDisk;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.common.data.LabelFunction;
@@ -89,12 +88,10 @@ import com.google.gerrit.extensions.api.changes.ReviewResult;
import com.google.gerrit.extensions.api.changes.RevisionApi;
import com.google.gerrit.extensions.api.changes.StarsInput;
import com.google.gerrit.extensions.api.groups.GroupApi;
import com.google.gerrit.extensions.api.projects.BranchApi;
import com.google.gerrit.extensions.api.projects.BranchInput;
import com.google.gerrit.extensions.api.projects.ConfigInput;
import com.google.gerrit.extensions.api.projects.ProjectApi;
import com.google.gerrit.extensions.api.projects.ProjectInput;
import com.google.gerrit.extensions.api.projects.ReflogEntryInfo;
import com.google.gerrit.extensions.client.ChangeKind;
import com.google.gerrit.extensions.client.ChangeStatus;
import com.google.gerrit.extensions.client.Comment.Range;
@@ -211,29 +208,6 @@ public class ChangeIT extends AbstractDaemonTest {
}
}
@Test
@UseLocalDisk
public void reflog() throws Exception {
BranchApi branchApi = gApi.projects().name(project.get()).branch("master");
List<ReflogEntryInfo> reflog = branchApi.reflog();
assertThat(reflog).isNotEmpty();
// Current number of entries in the reflog
int refLogLen = reflog.size();
// Create and submit a change
PushOneCommit.Result r = createChange();
String changeId = r.getChangeId();
String revision = r.getCommit().name();
ReviewInput in = ReviewInput.approve();
gApi.changes().id(changeId).revision(revision).review(in);
gApi.changes().id(changeId).revision(revision).submit();
// Submitting the change causes a new entry in the reflog
reflog = branchApi.reflog();
assertThat(reflog).hasSize(refLogLen + 1);
}
@Test
public void get() throws Exception {
PushOneCommit.Result r = createChange();

View File

@@ -21,8 +21,12 @@ import static com.google.gerrit.reviewdb.client.RefNames.changeMetaRef;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.PushOneCommit;
import com.google.gerrit.acceptance.UseLocalDisk;
import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.api.projects.BranchApi;
import com.google.gerrit.extensions.api.projects.ReflogEntryInfo;
import com.google.gerrit.reviewdb.client.Change;
import java.io.File;
import java.util.List;
import org.eclipse.jgit.lib.ReflogEntry;
import org.eclipse.jgit.lib.Repository;
import org.junit.Test;
@@ -48,4 +52,26 @@ public class ReflogIT extends AbstractDaemonTest {
assertThat(last.getComment()).isEqualTo("change.PutTopic");
}
}
@Test
public void reflogUpdatedBySubmittingChange() throws Exception {
BranchApi branchApi = gApi.projects().name(project.get()).branch("master");
List<ReflogEntryInfo> reflog = branchApi.reflog();
assertThat(reflog).isNotEmpty();
// Current number of entries in the reflog
int refLogLen = reflog.size();
// Create and submit a change
PushOneCommit.Result r = createChange();
String changeId = r.getChangeId();
String revision = r.getCommit().name();
ReviewInput in = ReviewInput.approve();
gApi.changes().id(changeId).revision(revision).review(in);
gApi.changes().id(changeId).revision(revision).submit();
// Submitting the change causes a new entry in the reflog
reflog = branchApi.reflog();
assertThat(reflog).hasSize(refLogLen + 1);
}
}