Build

The spanner-refdb plugin can be built in-tree in Gerrit's /plugins path.

The plugins/external_plugin_deps.bzl file will need to be updated to match or contain spanner-refdb/external_plugin_deps.bzl.

git clone --recursive https://gerrit.googlesource.com/gerrit
cd gerrit
git clone "https://gerrit.googlesource.com/plugins/spanner-refdb" plugins/spanner-refdb
ln -sf plugins/spanner-refdb/external_plugin_deps.bzl plugins/.
bazelisk build plugins/spanner-refdb

The output is created in

gerrit/bazel-bin/plugins/spanner-refdb/spanner-refdb.jar

Eclipse project setup

This project can be imported into the Eclipse IDE:

  • Add the plugin name to the CUSTOM_PLUGINS_TEST_DEPS set in Gerrit core in tools/bzl/plugins.bzl,
  • execute:
./tools/eclipse/project.py

Run tests

To execute the tests run

bazelisk test --test_tag_filters=spanner-refdb //...

or

bazelisk test //plugins/@PLUGIN@/...

On MacOS you may need to access the docker daemon via TCP.

Run socat to expose the docker daemon socket via TCP

socat 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@/...

Debugging tests

bazelisk 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 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