Fix flaky test in CreateMergePatchSet
ChangeIT#createMergePatchSet was flaky. For some reason, even though the patchset was created, after the second creation (e.g previously line 3245) one of the followings happened around 50% of the times: 1. changeInfo.revisions contained 3 revisions, instead of 2. 2. changeInfo.currentRevision was null. Another finding was that when I removed the flag CURRENT_COMMIT, none of those bugs occurred. One theory is that something is really wrong with creating a merge patchset with the same parent: The change in "dev" is both a parent and a grandparent of the change in line 3245. This should be investigated further, but this change only fixes the flaky test. Change-Id: Iff2bec4f74163f3634fbbc3dfbe996382a7c91e6
This commit is contained in:
@@ -3238,13 +3238,33 @@ public class ChangeIT extends AbstractDaemonTest {
|
|||||||
|
|
||||||
assertThat(changeInfo.revisions.get(changeInfo.currentRevision).commit.message)
|
assertThat(changeInfo.revisions.get(changeInfo.currentRevision).commit.message)
|
||||||
.contains(subject);
|
.contains(subject);
|
||||||
|
}
|
||||||
|
|
||||||
// No subject: reuse message from previous patchset.
|
@Test
|
||||||
|
public void createMergePatchSet_SubjectCarriesOverByDefault() throws Exception {
|
||||||
|
RevCommit initialHead = projectOperations.project(project).getHead("master");
|
||||||
|
createBranch("dev");
|
||||||
|
|
||||||
|
// create a change for master
|
||||||
|
PushOneCommit.Result result = createChange();
|
||||||
|
String changeId = result.getChangeId();
|
||||||
|
String subject = result.getChange().change().getSubject();
|
||||||
|
|
||||||
|
// push a commit into dev branch
|
||||||
|
testRepo.reset(initialHead);
|
||||||
|
PushOneCommit.Result pushResult =
|
||||||
|
pushFactory.create(user.newIdent(), testRepo).to("refs/heads/dev");
|
||||||
|
pushResult.assertOkStatus();
|
||||||
|
MergeInput mergeInput = new MergeInput();
|
||||||
|
mergeInput.source = "dev";
|
||||||
|
MergePatchSetInput in = new MergePatchSetInput();
|
||||||
|
in.merge = mergeInput;
|
||||||
in.subject = null;
|
in.subject = null;
|
||||||
|
|
||||||
|
// Ensure subject carries over
|
||||||
gApi.changes().id(changeId).createMergePatchSet(in);
|
gApi.changes().id(changeId).createMergePatchSet(in);
|
||||||
changeInfo = gApi.changes().id(changeId).get(ALL_REVISIONS, CURRENT_COMMIT, CURRENT_REVISION);
|
ChangeInfo changeInfo = gApi.changes().id(changeId).get();
|
||||||
assertThat(changeInfo.revisions.get(changeInfo.currentRevision).commit.message)
|
assertThat(changeInfo.subject).isEqualTo(subject);
|
||||||
.contains(subject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Reference in New Issue
Block a user