summaryrefslogtreecommitdiffstats
path: root/javatests/com/google/gerrit/elasticsearch/BUILD
blob: 4806accd6eee7232aa5051a1a18c04c5eccce6de (plain)
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
load("//tools/bzl:junit.bzl", "junit_tests")

java_library(
    name = "elasticsearch_test_utils",
    testonly = True,
    srcs = [
        "ElasticContainer.java",
        "ElasticTestUtils.java",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//java/com/google/gerrit/elasticsearch",
        "//java/com/google/gerrit/index",
        "//java/com/google/gerrit/server",
        "//lib:guava",
        "//lib:junit",
        "//lib/guice",
        "//lib/httpcomponents:httpcore",
        "//lib/jgit/org.eclipse.jgit:jgit",
        "//lib/testcontainers",
        "//lib/testcontainers:testcontainers-elasticsearch",
    ],
)

ELASTICSEARCH_DEPS = [
    ":elasticsearch_test_utils",
    "//java/com/google/gerrit/elasticsearch",
    "//java/com/google/gerrit/testing:gerrit-test-util",
    "//lib/guice",
    "//lib/jgit/org.eclipse.jgit:jgit",
]

QUERY_TESTS_DEP = "//javatests/com/google/gerrit/server/query/%s:abstract_query_tests"

TYPES = [
    "account",
    "change",
    "group",
    "project",
]

SUFFIX = "sTest.java"

ELASTICSEARCH_TESTS_V5 = {i: "ElasticV5Query" + i.capitalize() + SUFFIX for i in TYPES}

ELASTICSEARCH_TESTS_V6 = {i: "ElasticV6Query" + i.capitalize() + SUFFIX for i in TYPES}

ELASTICSEARCH_TESTS_V7 = {i: "ElasticV7Query" + i.capitalize() + SUFFIX for i in TYPES}

ELASTICSEARCH_TAGS = [
    "docker",
    "elastic",
    "exclusive",
]

[junit_tests(
    name = "elasticsearch_query_%ss_test_V5" % name,
    size = "large",
    srcs = [src],
    tags = ELASTICSEARCH_TAGS,
    deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
) for name, src in ELASTICSEARCH_TESTS_V5.items()]

[junit_tests(
    name = "elasticsearch_query_%ss_test_V6" % name,
    size = "large",
    srcs = [src],
    tags = ELASTICSEARCH_TAGS + ["flaky"],
    deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name],
) for name, src in ELASTICSEARCH_TESTS_V6.items()]

[junit_tests(
    name = "elasticsearch_query_%ss_test_V7" % name,
    size = "large",
    srcs = [src],
    tags = ELASTICSEARCH_TAGS + ["flaky"],
    deps = ELASTICSEARCH_DEPS + [QUERY_TESTS_DEP % name] + [
        "//lib/httpcomponents:httpasyncclient",
        "//lib/httpcomponents:httpclient",
    ],
) for name, src in ELASTICSEARCH_TESTS_V7.items()]

junit_tests(
    name = "elasticsearch_tests",
    size = "small",
    srcs = glob(
        ["*Test.java"],
        exclude = ["Elastic*Query*" + SUFFIX],
    ),
    tags = ["elastic"],
    deps = [
        "//java/com/google/gerrit/elasticsearch",
        "//lib:guava",
        "//lib/guice",
        "//lib/jgit/org.eclipse.jgit:jgit",
        "//lib/truth",
    ],
)