Pave the way for the 'stable-3.6' submit requirements migration
This is the tests change that switches to direct push instead of push for
review + merge operations for the `OWNERS` file creation under the repo
in question.
Bug: Issue 15556
Change-Id: I99a8cb21ab10ab62519dba6d1c0dda08c6f50aba
diff --git a/owners/src/test/java/com/googlesource/gerrit/owners/OwnersMetricsIT.java b/owners/src/test/java/com/googlesource/gerrit/owners/OwnersMetricsIT.java
index b241b66..47e2510 100644
--- a/owners/src/test/java/com/googlesource/gerrit/owners/OwnersMetricsIT.java
+++ b/owners/src/test/java/com/googlesource/gerrit/owners/OwnersMetricsIT.java
@@ -22,6 +22,7 @@
import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.acceptance.UseLocalDisk;
import com.google.gerrit.acceptance.config.GlobalPluginConfig;
+import com.google.gerrit.entities.RefNames;
import com.google.inject.Inject;
import org.junit.Test;
@@ -56,13 +57,14 @@
// inherited: true
// owners:
// - u.email()
- merge(
- createChange(
+ pushFactory
+ .create(
+ admin.newIdent(),
testRepo,
- "master",
"Add OWNER file",
"OWNERS",
- String.format("inherited: %s\nowners:\n- %s\n", inherit, u.email()),
- ""));
+ String.format("inherited: %s\nowners:\n- %s\n", inherit, u.email()))
+ .to(RefNames.fullName("master"))
+ .assertOkStatus();
}
}
diff --git a/owners/src/test/java/com/googlesource/gerrit/owners/OwnersSubmitRequirementIT.java b/owners/src/test/java/com/googlesource/gerrit/owners/OwnersSubmitRequirementIT.java
index fda7edb..002dc4b 100644
--- a/owners/src/test/java/com/googlesource/gerrit/owners/OwnersSubmitRequirementIT.java
+++ b/owners/src/test/java/com/googlesource/gerrit/owners/OwnersSubmitRequirementIT.java
@@ -411,20 +411,14 @@
// - u1.email()
// - ...
// - uN.email()
- merge(
- createChange(
- testRepo,
- "master",
- "Add OWNER file",
- "OWNERS",
- String.format(
- "inherited: %s\nmatchers:\n" + "- suffix: %s\n owners:\n%s",
- inherit,
- extension,
- Stream.of(users)
- .map(user -> String.format(" - %s\n", user.email()))
- .collect(joining())),
- ""));
+ pushOwnersToMaster(
+ String.format(
+ "inherited: %s\nmatchers:\n" + "- suffix: %s\n owners:\n%s",
+ inherit,
+ extension,
+ Stream.of(users)
+ .map(user -> String.format(" - %s\n", user.email()))
+ .collect(joining())));
}
private void addOwnerFileToRoot(boolean inherit, TestAccount u) throws Exception {
@@ -433,14 +427,7 @@
// inherited: true
// owners:
// - u.email()
- merge(
- createChange(
- testRepo,
- "master",
- "Add OWNER file",
- "OWNERS",
- String.format("inherited: %s\nowners:\n- %s\n", inherit, u.email()),
- ""));
+ pushOwnersToMaster(String.format("inherited: %s\nowners:\n- %s\n", inherit, u.email()));
}
protected void addOwnerFileToRoot(boolean inherit, LabelDefinition label, TestAccount u)
@@ -451,20 +438,21 @@
// label: label,score # score is optional
// owners:
// - u.email()
- merge(
- createChange(
- testRepo,
- "master",
- "Add OWNER file",
- "OWNERS",
+ pushOwnersToMaster(
+ String.format(
+ "inherited: %s\nlabel: %s\nowners:\n- %s\n",
+ inherit,
String.format(
- "inherited: %s\nlabel: %s\nowners:\n- %s\n",
- inherit,
- String.format(
- "%s%s",
- label.getName(),
- label.getScore().map(value -> String.format(",%d", value)).orElse("")),
- u.email()),
- ""));
+ "%s%s",
+ label.getName(),
+ label.getScore().map(value -> String.format(",%d", value)).orElse("")),
+ u.email()));
+ }
+
+ private void pushOwnersToMaster(String owners) throws Exception {
+ pushFactory
+ .create(admin.newIdent(), testRepo, "Add OWNER file", "OWNERS", owners)
+ .to(RefNames.fullName("master"))
+ .assertOkStatus();
}
}