summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2021-01-15 23:31:47 +0000
committerDavid Ostrovsky <david@ostrovsky.org>2021-01-26 17:46:54 +0100
commit8838f1a3664d62f2dbcd9254227de9ab65c0b9ec (patch)
tree751ad50ef5d26de6fb85caeb45d5a7cff240c2e8
parent6e74f32cb1ad9865cc5e36cf3b7cf271b02af187 (diff)
Do not remove Change-Id footer in test
Prevent ChangeEditIT.updateCommitMessageByEditingMagicCommitMsgFile and RobotCommentsIT.fixDoesNotModifyCommitMessageOfChangeEdit corrupting the change by removing the Change-Id footer. Change-Id: I7f55e2d6bf6ddc0ab6891c3e27f24297933ac168
-rw-r--r--javatests/com/google/gerrit/acceptance/api/revision/RobotCommentsIT.java3
-rw-r--r--javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java6
2 files changed, 6 insertions, 3 deletions
diff --git a/javatests/com/google/gerrit/acceptance/api/revision/RobotCommentsIT.java b/javatests/com/google/gerrit/acceptance/api/revision/RobotCommentsIT.java
index dfd25e25cb..f41f4acb20 100644
--- a/javatests/com/google/gerrit/acceptance/api/revision/RobotCommentsIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/revision/RobotCommentsIT.java
@@ -876,7 +876,8 @@ public class RobotCommentsIT extends AbstractDaemonTest {
public void fixDoesNotModifyCommitMessageOfChangeEdit() throws Exception {
assume().that(notesMigration.readChanges()).isTrue();
- String changeEditCommitMessage = "This is the commit message of the change edit.\n";
+ String changeEditCommitMessage =
+ "This is the commit message of the change edit.\n\nChange-Id: " + changeId + "\n";
gApi.changes().id(changeId).edit().modifyCommitMessage(changeEditCommitMessage);
fixReplacementInfo.path = FILE_NAME;
diff --git a/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java b/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java
index 7a67fba910..12df63acc1 100644
--- a/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java
+++ b/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java
@@ -324,12 +324,14 @@ public class ChangeEditIT extends AbstractDaemonTest {
@Test
public void updateCommitMessageByEditingMagicCommitMsgFile() throws Exception {
createEmptyEditFor(changeId);
+ String updatedCommitMsg = "Foo Bar\n\nChange-Id: " + changeId + "\n";
gApi.changes()
.id(changeId)
.edit()
- .modifyFile(Patch.COMMIT_MSG, RawInputUtil.create("Foo Bar".getBytes(UTF_8)));
+ .modifyFile(Patch.COMMIT_MSG, RawInputUtil.create(updatedCommitMsg.getBytes(UTF_8)));
assertThat(getEdit(changeId)).isPresent();
- ensureSameBytes(getFileContentOfEdit(changeId, Patch.COMMIT_MSG), "Foo Bar\n".getBytes(UTF_8));
+ ensureSameBytes(
+ getFileContentOfEdit(changeId, Patch.COMMIT_MSG), updatedCommitMsg.getBytes(UTF_8));
}
@Test