Merge branch 'stable-3.8' into stable-3.9
* stable-3.8:
Consume global-refdb directly from source
Fix errorprone Flogger error
Change-Id: I86ccde4bb9a0a7a1233a7b09586bae7f127a1cf4
diff --git a/BUILD b/BUILD
index 335c2da..5bd8d41 100644
--- a/BUILD
+++ b/BUILD
@@ -7,28 +7,6 @@
)
gerrit_plugin(
- name = "zookeeper-refdb-zk-3.5",
- srcs = glob(["src/main/java/**/*.java"]),
- dir_name = "zookeeper-refdb",
- manifest_entries = [
- "Gerrit-PluginName: zookeeper-refdb",
- "Gerrit-Module: com.googlesource.gerrit.plugins.validation.dfsrefdb.zookeeper.ZkValidationModule",
- "Implementation-Title: zookeeper ref-db plugin",
- "Implementation-URL: https://review.gerrithub.io/admin/repos/GerritForge/plugins_zookeeper",
- ],
- resources = glob(["src/main/resources/**/*"]),
- deps = [
- ":global-refdb-neverlink",
- "@curator-client//jar",
- "@curator-framework//jar",
- "@curator-recipes//jar",
- "@netty-all//jar",
- "@zookeeper-jute_3.5//jar",
- "@zookeeper_3.5//jar",
- ],
-)
-
-gerrit_plugin(
name = "zookeeper-refdb",
srcs = glob(["src/main/java/**/*.java"]),
manifest_entries = [
@@ -44,7 +22,17 @@
"@curator-client//jar",
"@curator-framework//jar",
"@curator-recipes//jar",
- "@zookeeper_3.4//jar",
+ "@netty-buffer//jar",
+ "@netty-codec//jar",
+ "@netty-common//jar",
+ "@netty-handler//jar",
+ "@netty-resolver//jar",
+ "@netty-transport-classes-epoll//jar",
+ "@netty-transport-native-epoll//jar",
+ "@netty-transport-native-unix-common//jar",
+ "@netty-transport//jar",
+ "@zookeeper-jute//jar",
+ "@zookeeper//jar",
],
)
@@ -72,21 +60,22 @@
testonly = 1,
visibility = ["//visibility:public"],
exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+ ":zookeeper-refdb__plugin",
"//plugins/global-refdb",
- ":zookeeper-refdb-zk-3.5__plugin",
+ "@curator-client//jar",
"@curator-framework//jar",
"@curator-recipes//jar",
"@curator-test//jar",
- "@curator-client//jar",
- "@jackson-annotations//jar",
- "@jna//jar",
- "@visible-assertions//jar",
"@docker-java-api//jar",
+ "@docker-java-transport-zerodep//jar",
"@docker-java-transport//jar",
"@duct-tape//jar",
- "@testcontainers//jar",
- "@testcontainer-localstack//jar",
- "@jackson-dataformat-cbor//jar",
+ "@jackson-annotations//jar",
"@jackson-databind//jar",
+ "@jackson-dataformat-cbor//jar",
+ "@jna//jar",
+ "@testcontainer-localstack//jar",
+ "@testcontainers//jar",
+ "@visible-assertions//jar",
],
)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index b50d3bf..726a563 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -1,108 +1,169 @@
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
- CURATOR_VER = "4.2.0"
+ CURATOR_VER = "5.5.0"
maven_jar(
name = "curator-test",
artifact = "org.apache.curator:curator-test:" + CURATOR_VER,
- sha1 = "98ac2dd69b8c07dcaab5e5473f93fdb9e320cd73",
+ sha1 = "065586d87700aa29855e6aa566b210eadd1bb38d",
)
maven_jar(
name = "curator-framework",
artifact = "org.apache.curator:curator-framework:" + CURATOR_VER,
- sha1 = "5b1cc87e17b8fe4219b057f6025662a693538861",
+ sha1 = "b706a216e49352103bd2527e83b1ec2410924494",
)
maven_jar(
name = "curator-recipes",
artifact = "org.apache.curator:curator-recipes:" + CURATOR_VER,
- sha1 = "7f775be5a7062c2477c51533b9d008f70411ba8e",
+ sha1 = "4aa0cfb129c36cd91528fc1b8775705280e60285",
)
maven_jar(
name = "curator-client",
artifact = "org.apache.curator:curator-client:" + CURATOR_VER,
- sha1 = "d5d50930b8dd189f92c40258a6ba97675fea3e15",
+ sha1 = "db2d83bdc0bac7b4f25fc113d8ce3eedc0a4e89c",
+ )
+
+ ZOOKEEPER_VER = "3.8.2"
+
+ maven_jar(
+ name = "zookeeper",
+ artifact = "org.apache.zookeeper:zookeeper:" + ZOOKEEPER_VER,
+ sha1 = "963e953f8e362fc3f253832876be2ae2dcde58d7",
)
maven_jar(
- name = "zookeeper_3.5",
- artifact = "org.apache.zookeeper:zookeeper:3.5.8",
- sha1 = "fc0d02657ed5b26029daa50d7f98b9806a0b13af",
+ name = "zookeeper-jute",
+ artifact = "org.apache.zookeeper:zookeeper-jute:" + ZOOKEEPER_VER,
+ sha1 = "f644829e30004ff4a079c357c4bb34bf5aa5fb94",
+ )
+
+ NETTY_VER = "4.1.94.Final"
+
+ maven_jar(
+ name = "netty-buffer",
+ artifact = "io.netty:netty-buffer:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "eec248b26f16e888688e5bb37b7eeda76b78d2f7",
)
maven_jar(
- name = "zookeeper-jute_3.5",
- artifact = "org.apache.zookeeper:zookeeper-jute:3.5.8",
- sha1 = "b399078f6ccfd6c258e42054091052e8f3e05824",
+ name = "netty-codec",
+ artifact = "io.netty:netty-codec:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "c70ef20ca338558147887df60f46341bc47f6900",
)
maven_jar(
- name = "netty-all",
- artifact = "io.netty:netty-all:4.1.48.Final",
- sha1 = "ebb3666ba4883ba81920cec8ccb1a3adcc827eb1",
+ name = "netty-common",
+ artifact = "io.netty:netty-common:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "ad4ecf779ebc794cd351f57792f56ea01387b868",
)
maven_jar(
- name = "zookeeper_3.4",
- artifact = "org.apache.zookeeper:zookeeper:3.4.14",
- sha1 = "c114c1e1c8172a7cd3f6ae39209a635f7a06c1a1",
+ name = "netty-handler",
+ artifact = "io.netty:netty-handler:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "cd9121ce24d6d3f2898946d04b0ef3ec548b00b4",
)
- JACKSON_VER = "2.10.4"
+ maven_jar(
+ name = "netty-resolver",
+ artifact = "io.netty:netty-resolver:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "e96f649e8e9dcb29a1f8e95328b99c9eb6cf76c2",
+ )
+
+ maven_jar(
+ name = "netty-transport",
+ artifact = "io.netty:netty-transport:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "ec783a737f96991a87b1d5794e2f9eb2024d708a",
+ )
+
+ maven_jar(
+ name = "netty-transport-classes-epoll",
+ artifact = "io.netty:netty-transport-classes-epoll:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "240e36cd5c2ffaf655913f8857f2d58b26394679",
+ )
+
+ maven_jar(
+ name = "netty-transport-native-epoll",
+ artifact = "io.netty:netty-transport-native-epoll:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "1f77c54f1877d9ed51f207eb64a5634bdcc7efa1",
+ )
+
+ maven_jar(
+ name = "netty-transport-native-unix-common",
+ artifact = "io.netty:netty-transport-native-unix-common:" + NETTY_VER,
+ attach_source = False,
+ sha1 = "3fa5f9d04b6b782d869d6e0657d896eeadca5866",
+ )
+
+ JACKSON_VER = "2.15.2"
maven_jar(
name = "jackson-annotations",
artifact = "com.fasterxml.jackson.core:jackson-annotations:" + JACKSON_VER,
- sha1 = "6ae6028aff033f194c9710ad87c224ccaadeed6c",
+ sha1 = "4724a65ac8e8d156a24898d50fd5dbd3642870b8",
)
maven_jar(
name = "jackson-core",
artifact = "com.fasterxml.jackson.core:jackson-core:" + JACKSON_VER,
- sha1 = "8796585e716440d6dd5128b30359932a9eb74d0d",
+ sha1 = "a6fe1836469a69b3ff66037c324d75fc66ef137c",
)
maven_jar(
name = "jackson-dataformat-cbor",
artifact = "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:" + JACKSON_VER,
- sha1 = "c854bb2d46138198cb5d4aae86ef6c04b8bc1e70",
+ sha1 = "baafc85c70765594add14bd93f3efd68e1945b76",
)
maven_jar(
name = "jackson-databind",
artifact = "com.fasterxml.jackson.core:jackson-databind:" + JACKSON_VER,
- sha1 = "76e9152e93d4cf052f93a64596f633ba5b1c8ed9",
+ sha1 = "9353b021f10c307c00328f52090de2bdb4b6ff9c",
)
- TESTCONTAINERS_VERSION = "1.15.3"
+ TESTCONTAINERS_VERSION = "1.18.3"
maven_jar(
name = "testcontainers",
artifact = "org.testcontainers:testcontainers:" + TESTCONTAINERS_VERSION,
- sha1 = "95c6cfde71c2209f0c29cb14e432471e0b111880",
+ sha1 = "a82f6258f92d50d278b9c67bdf5eabcaa5c08654",
)
maven_jar(
name = "testcontainer-localstack",
artifact = "org.testcontainers:localstack:" + TESTCONTAINERS_VERSION,
- sha1 = "7aa69995bdaafb4b06e69fdab9bd98c4fddee43d",
+ sha1 = "2b7a8d4522330217545c4234b916b6b77f5c6f95",
)
- DOCKER_JAVA_VERS = "3.2.8"
+ DOCKER_JAVA_VERS = "3.3.2"
maven_jar(
name = "docker-java-api",
artifact = "com.github.docker-java:docker-java-api:" + DOCKER_JAVA_VERS,
- sha1 = "4ac22a72d546a9f3523cd4b5fabffa77c4a6ec7c",
+ sha1 = "0de6345d2f69638a224f73d9e62de83c7692e436",
)
maven_jar(
name = "docker-java-transport",
artifact = "com.github.docker-java:docker-java-transport:" + DOCKER_JAVA_VERS,
- sha1 = "c3b5598c67d0a5e2e780bf48f520da26b9915eab",
+ sha1 = "a4c2cba248ccfefe9c5c8d8d4726f3e0b2b51104",
+ )
+
+ maven_jar(
+ name = "docker-java-transport-zerodep",
+ artifact = "com.github.docker-java:docker-java-transport-zerodep:" + DOCKER_JAVA_VERS,
+ sha1 = "36ef508e5e48613afb7fafbf7e89184243738e96",
)
maven_jar(
@@ -119,6 +180,6 @@
maven_jar(
name = "jna",
- artifact = "net.java.dev.jna:jna:5.5.0",
- sha1 = "0e0845217c4907822403912ad6828d8e0b256208",
+ artifact = "net.java.dev.jna:jna:5.13.0",
+ sha1 = "1200e7ebeedbe0d10062093f32925a912020e747",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZkInit.java b/src/main/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZkInit.java
index 893698e..fdd04a6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZkInit.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZkInit.java
@@ -20,8 +20,6 @@
import com.google.gerrit.pgm.init.api.InitStep;
import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.config.AllProjectsNameProvider;
-import com.google.gerrit.server.config.AllUsersName;
-import com.google.gerrit.server.config.AllUsersNameProvider;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.schema.NoteDbSchemaVersionManager;
import com.google.inject.AbstractModule;
@@ -87,7 +85,6 @@
@Override
protected void configure() {
bind(AllProjectsName.class).toProvider(AllProjectsNameProvider.class);
- bind(AllUsersName.class).toProvider(AllUsersNameProvider.class);
}
});
}
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
index f3f6563..f6249d8 100644
--- a/src/main/resources/Documentation/about.md
+++ b/src/main/resources/Documentation/about.md
@@ -11,7 +11,7 @@
## Requirements
-Supported Zookeeper version is 3.5.x. For SSL connection minimal Zookeeper version is 3.5.1[ZOOKEEPER-2125](https://issues.apache.org/jira/browse/ZOOKEEPER-2125).
+Supported Zookeeper version is 3.8.x.
## Setup
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 9370f82..90bdbf7 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -9,35 +9,70 @@
Gerrit /plugins directory, replacing the existing empty one.
```
- cd gerrit/plugins
- ln -sf @PLUGIN@/external_plugin_deps.bzl .
+cd gerrit/plugins
+ln -sf @PLUGIN@/external_plugin_deps.bzl .
```
From the Gerrit source tree issue the command:
```
- bazel build plugins/@PLUGIN@
+bazel build plugins/@PLUGIN@
```
The output is created in
```
- bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
+bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
```
+## Eclipse project setup
+
This project can be imported into the Eclipse IDE:
-Add the plugin name to the `CUSTOM_PLUGINS_TEST_DEPS`
+
+- Add the plugin name to the `CUSTOM_PLUGINS_TEST_DEPS`
set in Gerrit core in `tools/bzl/plugins.bzl`,
-and execute:
+- execute:
```
- ./tools/eclipse/project.py
+./tools/eclipse/project.py
```
-To execute the tests run:
+## Run tests
+
+To execute the tests run
```
- bazel test --test_tag_filters=@PLUGIN@
+bazel test --test_tag_filters=zookeeper //...
+```
+or
+```
+bazel test //plugins/@PLUGIN@/...
+```
+
+### Debugging tests
+
+```
+bazel test --test_output=streamed //plugins/@PLUGIN@/...
+```
+
+If necessary increase log levels in `src/test/resources/log4j.properties`
+to trace testcontainers and docker java API.
+
+### Tracing traffic to docker daemon
+
+If you face issue you can trace traffic to the docker daemon using
+[socat](https://linux.die.net/man/1/socat) exposing the docker daemon via TCP.
+
+Run socat to log diagnostics and show the traffic to the docker daemon
+
+```
+socat -dd -v TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock
+```
+
+Execute the tests over TCP
+
+```
+bazelisk test --test_env='DOCKER_HOST=tcp://127.0.0.1:2375' //plugins/@PLUGIN@/...
```
[Back to @PLUGIN@ documentation index][index]
diff --git a/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZookeeperTestContainerSupport.java b/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZookeeperTestContainerSupport.java
index 107ece9..366a83f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZookeeperTestContainerSupport.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/ZookeeperTestContainerSupport.java
@@ -33,7 +33,7 @@
public class ZookeeperTestContainerSupport {
static class ZookeeperContainer extends GenericContainer<ZookeeperContainer> {
- public static String ZOOKEEPER_VERSION = "3.5.5";
+ public static String ZOOKEEPER_VERSION = "3.8.2";
public ZookeeperContainer() {
super("zookeeper:" + ZOOKEEPER_VERSION);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/migration/ZkMigrationsTest.java b/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/migration/ZkMigrationsTest.java
index 3ba2eba..67fc3e2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/migration/ZkMigrationsTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/validation/dfsrefdb/zookeeper/migration/ZkMigrationsTest.java
@@ -18,8 +18,8 @@
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
@@ -59,13 +59,13 @@
@Test
public void shouldNotMigrateAnythingForNewSites() throws Exception {
migrations.migrate(plugin.getSysInjector(), curatorMock, 0);
- verifyZeroInteractions(curatorMock);
+ verifyNoInteractions(curatorMock);
}
@Test
public void shouldNotMigrateAnythingForSchema184() throws Exception {
migrations.migrate(plugin.getSysInjector(), curatorMock, 184);
- verifyZeroInteractions(curatorMock);
+ verifyNoInteractions(curatorMock);
}
@Test
@@ -77,18 +77,18 @@
verifyNoMoreInteractions(curatorMock);
verifyNoMoreInteractions(deleteBuilderMock);
- verifyZeroInteractions(backgroundVersionableMock);
+ verifyNoInteractions(backgroundVersionableMock);
}
@Test
public void shouldNotCallCuratorDeleteIfAlreadyOnLatestVersion() throws Exception {
migrations.migrate(plugin.getSysInjector(), curatorMock, NoteDbSchemaVersions.LATEST);
- verifyZeroInteractions(curatorMock);
+ verifyNoInteractions(curatorMock);
}
@Test
public void shouldNotCallCuratorDeleteIfOverLatestVersion() throws Exception {
migrations.migrate(plugin.getSysInjector(), curatorMock, NoteDbSchemaVersions.LATEST + 1);
- verifyZeroInteractions(curatorMock);
+ verifyNoInteractions(curatorMock);
}
}
diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties
new file mode 100644
index 0000000..2f33b7f
--- /dev/null
+++ b/src/test/resources/log4j.properties
@@ -0,0 +1,9 @@
+log4j.rootLogger=ERROR, MAIN
+log4j.appender.MAIN=org.apache.log4j.ConsoleAppender
+log4j.appender.MAIN.layout=org.apache.log4j.PatternLayout
+log4j.appender.MAIN.layout.ConversionPattern=%r [%t] %-5p %c %x - %m%n
+
+log4j.logger.org.testcontainers=INFO
+log4j.logger.tc=INFO
+log4j.logger.com.github.dockerjava=WARN
+log4j.logger.com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire=OFF