Add Bazel support for running docker tests

Now you can do 'bazel test docker-tests' and it will 1) build the events
plugin if needed and 2) run test/docker/run.sh with that built events.jar.

Change-Id: Ic67aa6253404d9eeb0774dd80c883c6039bf092b
diff --git a/BUILD b/BUILD
index e1af73a..aa06995 100644
--- a/BUILD
+++ b/BUILD
@@ -7,16 +7,27 @@
 
 load("@rules_java//java:defs.bzl", "java_library", "java_plugin")
 
+plugin_name = "events"
+
 gerrit_plugin(
-    name = "events",
+    name = plugin_name,
     srcs = glob(["src/main/java/**/*.java"]),
     manifest_entries = [
-        "Gerrit-PluginName: events",
+        "Gerrit-PluginName: " + plugin_name,
         "Gerrit-ApiVersion: 2.14.21",
         "Implementation-Title: Events Plugin",
-        "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/events",
+        "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/" + plugin_name,
         "Gerrit-Module: com.googlesource.gerrit.plugins.events.Module",
         "Gerrit-SshModule: com.googlesource.gerrit.plugins.events.SshModule",
     ],
     resources = glob(["src/main/resources/**/*"]),
 )
+
+sh_test(
+    name = "docker-tests",
+    size = "medium",
+    srcs = ["test/docker/run.sh"],
+    args = ["--events-plugin-jar", "$(location :events)"],
+    data = [plugin_name] + glob(["test/**"]),
+    local = True,
+)