Fix test due to change in Gerrit core
I6ba424e09 broke this test by disallowing to remove the change id from
the commit message.
Change-Id: Ic56533dbfd21d073b8814d9f8610a3ad6cf6f748
(cherry picked from commit afb4b200764b7dc57477023f2401190a891064b5)
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java
index 8848278..b1e0273 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/CreateCheckIT.java
@@ -349,16 +349,20 @@
@Test
public void createCheckOnChangeEditRejected() throws Exception {
- int changeId = patchSetId.changeId().get();
- gApi.changes().id(changeId).edit().modifyCommitMessage("new message");
- assertThat(gApi.changes().id(changeId).edit().get()).isPresent();
+ int numChangeId = patchSetId.changeId().get();
+ String changeId = gApi.changes().id(numChangeId).get().changeId;
+ gApi.changes()
+ .id(numChangeId)
+ .edit()
+ .modifyCommitMessage("Change edit\n\nChange-Id: " + changeId);
+ assertThat(gApi.changes().id(numChangeId).edit().get()).isPresent();
CheckerUuid checkerUuid = checkerOperations.newChecker().repository(project).create();
CheckInput input = new CheckInput();
input.checkerUuid = checkerUuid.get();
input.state = CheckState.RUNNING;
RestResponse response =
- adminRestSession.post("/changes/" + changeId + "/revisions/edit/checks~checks", input);
+ adminRestSession.post("/changes/" + numChangeId + "/revisions/edit/checks~checks", input);
response.assertConflict();
assertThat(response.getEntityContent()).isEqualTo("checks are not supported on a change edit");
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
index 9446f9d..b494146 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/GetCheckIT.java
@@ -518,8 +518,9 @@
@Test
public void getCheckOnChangeEditRejected() throws Exception {
- int changeId = patchSetId.changeId().get();
- gApi.changes().id(changeId).edit().modifyCommitMessage("new message");
+ int numChangeId = patchSetId.changeId().get();
+ String changeId = gApi.changes().id(numChangeId).get().changeId;
+ gApi.changes().id(changeId).edit().modifyCommitMessage("Change edit\n\nChange-Id: " + changeId);
Optional<EditInfo> editInfo = gApi.changes().id(changeId).edit().get();
assertThat(editInfo).isPresent();
diff --git a/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java b/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java
index f1f7e52..d21fa3c 100644
--- a/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java
+++ b/javatests/com/google/gerrit/plugins/checks/acceptance/api/ListChecksIT.java
@@ -338,7 +338,7 @@
@Test
public void listAllOnChangeEditRejected() throws Exception {
- gApi.changes().id(changeId).edit().modifyCommitMessage("new message");
+ gApi.changes().id(changeId).edit().modifyCommitMessage("Change edit\n\nChange-Id: " + changeId);
Optional<EditInfo> editInfo = gApi.changes().id(changeId).edit().get();
assertThat(editInfo).isPresent();