-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD
129 lines (115 loc) · 3.49 KB
/
BUILD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
load("@rules_java//java:defs.bzl", "java_library")
load("//tools/bzl:junit.bzl", "junit_tests")
load(
"//tools/bzl:plugin.bzl",
"PLUGIN_DEPS",
"PLUGIN_TEST_DEPS",
"gerrit_plugin",
)
gerrit_plugin(
name = "index-elasticsearch",
srcs = glob(["src/main/java/**/*.java"]),
deps = [
"@elasticsearch-rest-client//jar",
"@httpasyncclient//jar",
"@httpcore-nio//jar",
"@jackson-core//jar",
],
)
ELASTICSEARCH_DEPS = [
"@docker-java-api//jar",
"@docker-java-transport//jar",
"@docker-java-transport-zerodep//jar",
"@duct-tape//jar",
"@httpasyncclient//jar",
"@jackson-annotations//jar",
"@jna//jar",
"@testcontainers-elasticsearch//jar",
"@testcontainers//jar",
]
java_library(
name = "index-elasticsearch__plugin_test_deps",
testonly = True,
srcs = [],
visibility = ["//visibility:public"],
exports = ELASTICSEARCH_DEPS,
)
java_library(
name = "elasticsearch_test_utils",
testonly = True,
srcs = glob(
["src/test/java/**/*.java"],
exclude = ["src/test/java/**/*Test.java"],
),
visibility = ["//visibility:public"],
deps = ELASTICSEARCH_DEPS + PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
":index-elasticsearch__plugin",
],
)
QUERY_TESTS_DEP = "//javatests/com/google/gerrit/server/query/%s:abstract_query_tests"
TYPES = [
"account",
"change",
"group",
"project",
]
SUFFIX = "sTest.java"
ABSTRACT_ELASTICSEARCH_TESTS = {i: "Elastic*Query" + i.capitalize() + SUFFIX for i in TYPES}
[java_library(
name = "abstract_elasticsearch_query_%ss_test" % name,
testonly = True,
srcs = glob(["src/test/java/com/google/gerrit/elasticsearch/" + src]),
visibility = ["//visibility:public"],
deps = ELASTICSEARCH_DEPS + PLUGIN_TEST_DEPS + [
QUERY_TESTS_DEP % name,
":elasticsearch_test_utils",
":index-elasticsearch__plugin",
],
) for name, src in ABSTRACT_ELASTICSEARCH_TESTS.items()]
ELASTICSEARCH_TESTS_V7 = {i: "ElasticV7Query" + i.capitalize() + SUFFIX for i in TYPES}
[junit_tests(
name = "elasticsearch_query_%ss_test_V7" % name,
size = "enormous",
srcs = ["src/test/java/com/google/gerrit/elasticsearch/" + src],
tags = [
"docker",
"elastic",
"exclusive",
],
deps = ELASTICSEARCH_DEPS + PLUGIN_TEST_DEPS + [
QUERY_TESTS_DEP % name,
":elasticsearch_test_utils",
":index-elasticsearch__plugin",
":abstract_elasticsearch_query_%ss_test" % name,
],
) for name, src in ELASTICSEARCH_TESTS_V7.items()]
ELASTICSEARCH_TESTS_V8 = {i: "ElasticV8Query" + i.capitalize() + SUFFIX for i in TYPES}
[junit_tests(
name = "elasticsearch_query_%ss_test_V8" % name,
size = "enormous",
srcs = ["src/test/java/com/google/gerrit/elasticsearch/" + src],
tags = [
"docker",
"elastic",
"exclusive",
],
deps = ELASTICSEARCH_DEPS + PLUGIN_TEST_DEPS + [
QUERY_TESTS_DEP % name,
":elasticsearch_test_utils",
":index-elasticsearch__plugin",
":abstract_elasticsearch_query_%ss_test" % name,
],
) for name, src in ELASTICSEARCH_TESTS_V8.items()]
junit_tests(
name = "index-elasticsearch_tests",
size = "small",
srcs = glob(
["src/test/java/**/*Test.java"],
exclude = ["src/test/java/**/Elastic*Query*" + SUFFIX],
),
tags = ["elastic"],
deps = ELASTICSEARCH_DEPS + PLUGIN_TEST_DEPS + [
":elasticsearch_test_utils",
":index-elasticsearch__plugin",
],
)