Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  Elasticsearch: run no other test at the same time
  ElasticVersionTest: run it through bazel as well
  Elasticsearch: cover V5 and flaky V6 tests -for CI
  Split Elasticsearch query tests into separate rules
  dev-contributing: Document that we format .bzl files with buildifier

Change-Id: I42b9f45dc80156c687a4456b20babadf28ff57a7
This commit is contained in:
David Pursehouse 2018-07-11 19:43:41 +09:00
commit 7783deac93
4 changed files with 71 additions and 9 deletions

View File

@ -164,7 +164,7 @@ Guide].
To format Java source code, Gerrit uses the
link:https://github.com/google/google-java-format[`google-java-format`]
tool (version 1.5), and to format Bazel BUILD and WORKSPACE files the
tool (version 1.5), and to format Bazel BUILD, WORKSPACE and .bzl files the
link:https://github.com/bazelbuild/buildtools/tree/master/buildifier[`buildifier`]
tool (version 0.12.0).
These tools automatically apply format according to the style guides; this

View File

@ -19,6 +19,7 @@ acceptance_tests(
labels = [
"docker",
"elastic",
"exclusive",
"flaky",
"pgm",
],

View File

@ -24,8 +24,9 @@ acceptance_tests(
srcs = ["ElasticIndexIT.java"],
group = "elastic",
labels = [
"elastic",
"docker",
"elastic",
"exclusive",
"ssh",
],
deps = [

View File

@ -48,19 +48,79 @@ java_library(
],
)
ELASTICSEARCH_DEPS = [
":elasticsearch",
":elasticsearch_test_utils",
"//gerrit-server:query_tests_code",
"//gerrit-server:testutil",
"//lib:truth",
"//lib/guice",
"//lib/jgit/org.eclipse.jgit:jgit",
]
TYPES = [
"account",
"change",
"group",
]
SUFFIX = "sTest.java"
ELASTICSEARCH_TESTS = {i: "src/test/java/com/google/gerrit/elasticsearch/ElasticQuery" + i.capitalize() + "sTest.java" for i in [
"account",
"change",
"group",
]}
ELASTICSEARCH_TESTS = {i: "src/test/java/com/google/gerrit/elasticsearch/ElasticQuery" + i.capitalize() + SUFFIX for i in TYPES}
ELASTICSEARCH_TESTS_V5 = {i: "src/test/java/com/google/gerrit/elasticsearch/ElasticV5Query" + i.capitalize() + SUFFIX for i in TYPES}
ELASTICSEARCH_TESTS_V6 = {i: "src/test/java/com/google/gerrit/elasticsearch/ElasticV6Query" + i.capitalize() + SUFFIX for i in TYPES}
ELASTICSEARCH_TAGS = [
"docker",
"elastic",
"exclusive",
]
[junit_tests(
name = "elasticsearch_query_%ss_test" % name,
size = "large",
srcs = [src],
tags = ELASTICSEARCH_TAGS,
deps = ELASTICSEARCH_DEPS,
) for name, src in ELASTICSEARCH_TESTS.items()]
[junit_tests(
name = "elasticsearch_query_%ss_test_v5" % name,
size = "large",
srcs = [src],
tags = ELASTICSEARCH_TAGS,
deps = ELASTICSEARCH_DEPS,
) for name, src in ELASTICSEARCH_TESTS_V5.items()]
[junit_tests(
name = "elasticsearch_query_%ss_test_v6" % name,
size = "large",
srcs = [src],
tags = ELASTICSEARCH_TAGS,
deps = ELASTICSEARCH_DEPS,
) for name, src in ELASTICSEARCH_TESTS_V6.items()]
junit_tests(
name = "elasticsearch_tests",
size = "large",
srcs = glob(["src/test/java/**/*Test.java"]),
tags = [
"docker",
"elastic",
],
size = "small",
srcs = glob(
["src/test/java/com/google/gerrit/elasticsearch/*Test.java"],
exclude = ["src/test/java/com/google/gerrit/elasticsearch/Elastic*Query*" + SUFFIX],
),
tags = ["elastic"],
deps = [
":elasticsearch",
":elasticsearch_test_utils",
"//gerrit-server:query_tests_code",
"//gerrit-server:testutil",
"//lib:guava",
"//lib:truth",
"//lib/guice",
"//lib/jgit/org.eclipse.jgit:jgit",