David Pursehouse 7e18f1a84a Add 'docker' tag to build rules for Elasticsearch tests
Split ElasticReindexIT out to its own rule with the labels 'docker' and
'elastic'.

Add a 'docker' label on the Elasticsearch query tests.

This will allow to exclude all the tests that require docker:

  bazel test --test_tag_filters=-docker //...

Currently only the Elasticsearch related tests use docker, so the same
could be achieved by excluding the 'elastic' tag, however it is possible
that in future we will add more tests that use different docker
containers.

Change-Id: Ia67835d96c5863a14a060505f1aece7f4b39a12b
2018-05-28 14:32:58 +09:00

71 lines
1.9 KiB
Python

java_library(
name = "elasticsearch",
srcs = glob(
["src/main/java/**/*.java"],
exclude = ["**/testing/**"],
),
visibility = ["//visibility:public"],
deps = [
"//gerrit-antlr:query_exception",
"//gerrit-extension-api:api",
"//gerrit-reviewdb:server",
"//gerrit-server:server",
"//lib:gson",
"//lib:guava",
"//lib:gwtorm",
"//lib/commons:codec",
"//lib/elasticsearch-rest-client",
"//lib/guice",
"//lib/guice:guice-assistedinject",
"//lib/httpcomponents:httpasyncclient",
"//lib/httpcomponents:httpclient",
"//lib/httpcomponents:httpcore",
"//lib/httpcomponents:httpcore-nio",
"//lib/jackson:jackson-core",
"//lib/jgit/org.eclipse.jgit:jgit",
"//lib/log:api",
],
)
load("//tools/bzl:junit.bzl", "junit_tests")
java_library(
name = "elasticsearch_test_utils",
testonly = 1,
srcs = glob(["src/main/java/com/google/gerrit/elasticsearch/testing/*.java"]),
visibility = ["//visibility:public"],
deps = [
":elasticsearch",
"//gerrit-reviewdb:client",
"//gerrit-server:server",
"//lib:gson",
"//lib:truth",
"//lib/guice",
"//lib/httpcomponents:httpcore",
"//lib/jgit/org.eclipse.jgit:jgit",
"//lib/testcontainers",
],
)
junit_tests(
name = "elasticsearch_tests",
size = "large",
srcs = glob(["src/test/java/**/*Test.java"]),
tags = [
"docker",
"elastic",
],
deps = [
":elasticsearch",
":elasticsearch_test_utils",
"//gerrit-server:query_tests_code",
"//gerrit-server:server",
"//gerrit-server:testutil",
"//lib/guice",
"//lib/httpcomponents:httpcore",
"//lib/jgit/org.eclipse.jgit:jgit",
"//lib/jgit/org.eclipse.jgit.junit:junit",
"//lib/testcontainers",
],
)