diff options
author | Nasser Grainawi <nasser@codeaurora.org> | 2020-10-15 15:35:15 -0600 |
---|---|---|
committer | Nasser Grainawi <nasser@codeaurora.org> | 2020-10-15 15:35:15 -0600 |
commit | 5ddc976586c8da17fd93e7b3d3ee54122421ec21 (patch) | |
tree | d5027c4e3001a1a640fcff2a047a5d822a244526 | |
parent | bc47d238733981d957a820f4c66f7128fca80663 (diff) | |
parent | ba99e9bce51e2ee8e68b0de98860ee4c29179601 (diff) |
Merge branch 'stable-3.2' into stable-3.3v3.3.0-rc3v3.3.0-rc2
* stable-3.2:
ReplicationIT: Remove unnecessary storage inspection
ReplicationIT: Fix invalid replicationDelay setting
Split replication plugins tests in two groups
Change-Id: I24aae9834c518518539dae0e20106c74de1d714b
-rw-r--r-- | BUILD | 12 | ||||
-rw-r--r-- | src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java | 26 |
2 files changed, 23 insertions, 15 deletions
@@ -24,6 +24,18 @@ junit_tests( timeout = "long", srcs = glob([ "src/test/java/**/*Test.java", + ]), + tags = ["replication"], + visibility = ["//visibility:public"], + deps = PLUGIN_TEST_DEPS + PLUGIN_DEPS + [ + ":replication__plugin", + ":replication_util", + ], +) + +junit_tests( + name = "replication_it", + srcs = glob([ "src/test/java/**/*IT.java", ]), tags = ["replication"], diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java index 9a81488..ecc71ba 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java +++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationIT.java @@ -122,8 +122,6 @@ public class ReplicationIT extends LightweightPluginDaemonTest { Project.NameKey sourceProject = createTestProject("foo"); - assertThat(listIncompleteTasks("refs/meta/config")).hasSize(1); - WaitUtil.waitUntil( () -> nonEmptyProjectExists(Project.nameKey(sourceProject + "replica.git")), TEST_NEW_PROJECT_TIMEOUT); @@ -171,8 +169,6 @@ public class ReplicationIT extends LightweightPluginDaemonTest { RevCommit sourceCommit = pushResult.getCommit(); String sourceRef = pushResult.getPatchSet().refName(); - assertThat(listIncompleteTasks("refs/changes/\\d*/\\d*/\\d*")).hasSize(1); - try (Repository repo = repoManager.openRepository(targetProject)) { waitUntil(() -> checkedGetRef(repo, sourceRef) != null); @@ -194,8 +190,6 @@ public class ReplicationIT extends LightweightPluginDaemonTest { input.revision = master; gApi.projects().name(project.get()).branch(newBranch).create(input); - assertThat(listIncompleteTasks("refs/heads/(mybranch|master)")).hasSize(2); - try (Repository repo = repoManager.openRepository(targetProject); Repository sourceRepo = repoManager.openRepository(project)) { waitUntil(() -> checkedGetRef(repo, newBranch) != null); @@ -220,8 +214,6 @@ public class ReplicationIT extends LightweightPluginDaemonTest { RevCommit sourceCommit = pushResult.getCommit(); String sourceRef = pushResult.getPatchSet().refName(); - assertThat(listIncompleteTasks("refs/changes/\\d*/\\d*/\\d*")).hasSize(2); - try (Repository repo1 = repoManager.openRepository(targetProject1); Repository repo2 = repoManager.openRepository(targetProject2)) { waitUntil( @@ -244,10 +236,12 @@ public class ReplicationIT extends LightweightPluginDaemonTest { createTestProject(project + "replica1"); createTestProject(project + "replica2"); - setReplicationDestination("foo1", replicaSuffixes, ALL_PROJECTS); - setReplicationDestination("foo2", replicaSuffixes, ALL_PROJECTS); - config.setInt("remote", "foo1", "replicationDelay", TEST_REPLICATION_DELAY * 100); - config.setInt("remote", "foo2", "replicationDelay", TEST_REPLICATION_DELAY * 100); + FileBasedConfig dest1 = setReplicationDestination("foo1", replicaSuffixes, ALL_PROJECTS); + FileBasedConfig dest2 = setReplicationDestination("foo2", replicaSuffixes, ALL_PROJECTS); + dest1.setInt("remote", null, "replicationDelay", TEST_REPLICATION_DELAY * 100); + dest2.setInt("remote", null, "replicationDelay", TEST_REPLICATION_DELAY * 100); + dest1.save(); + dest2.save(); reloadConfig(); createChange(); @@ -595,13 +589,14 @@ public class ReplicationIT extends LightweightPluginDaemonTest { remoteName, Arrays.asList(replicaSuffix), project, replicationDelay, mirror); } - private void setReplicationDestination( + private FileBasedConfig setReplicationDestination( String remoteName, List<String> replicaSuffixes, Optional<String> project) throws IOException { - setReplicationDestination(remoteName, replicaSuffixes, project, TEST_REPLICATION_DELAY, false); + return setReplicationDestination( + remoteName, replicaSuffixes, project, TEST_REPLICATION_DELAY, false); } - private void setReplicationDestination( + private FileBasedConfig setReplicationDestination( String remoteName, List<String> replicaSuffixes, Optional<String> project, @@ -619,6 +614,7 @@ public class ReplicationIT extends LightweightPluginDaemonTest { project.ifPresent(prj -> config.setString("remote", remoteName, "projects", prj)); config.setBoolean("gerrit", null, "autoReload", true); config.save(); + return config; } private void setProjectDeletionReplication(String remoteName, boolean replicateProjectDeletion) |