• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python2.7
2# Copyright 2015 gRPC authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""
17Houses generate_resolver_component_tests.
18"""
19
20load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_test")
21
22# buildifier: disable=unnamed-macro
23def generate_resolver_component_tests():
24    """Generate address_sorting_test and resolver_component_test suite with different configurations.
25
26    Note that the resolver_component_test suite's configuration is 2 dimensional: security and whether to enable the event_engine_dns experiment.
27    """
28    for unsecure_build_config_suffix in ["_unsecure", ""]:
29        grpc_cc_test(
30            name = "address_sorting_test%s" % unsecure_build_config_suffix,
31            srcs = [
32                "address_sorting_test.cc",
33            ],
34            external_deps = [
35                "absl/log:check",
36                "gtest",
37            ],
38            deps = [
39                "//test/cpp/util:test_util%s" % unsecure_build_config_suffix,
40                "//test/core/test_util:grpc_test_util%s" % unsecure_build_config_suffix,
41                "//:grpc++%s" % unsecure_build_config_suffix,
42                "//:grpc%s" % unsecure_build_config_suffix,
43                "//:gpr",
44                "//test/cpp/util:test_config",
45            ],
46            tags = ["no_windows"],
47        )
48
49        # meant to be invoked only through the top-level shell script driver
50        grpc_cc_binary(
51            name = "resolver_component_test%s" % unsecure_build_config_suffix,
52            testonly = 1,
53            srcs = [
54                "resolver_component_test.cc",
55            ],
56            external_deps = [
57                "absl/log:check",
58                "gtest",
59            ],
60            deps = [
61                "//test/cpp/util:test_util%s" % unsecure_build_config_suffix,
62                "//test/core/test_util:grpc_test_util%s" % unsecure_build_config_suffix,
63                "//test/core/test_util:fake_udp_and_tcp_server%s" % unsecure_build_config_suffix,
64                "//test/core/test_util:socket_use_after_close_detector%s" % unsecure_build_config_suffix,
65                "//:grpc++%s" % unsecure_build_config_suffix,
66                "//:grpc%s" % unsecure_build_config_suffix,
67                "//:gpr",
68                "//src/core:ares_resolver",
69                "//test/cpp/util:test_config",
70            ],
71            tags = ["no_windows"],
72        )
73        grpc_cc_test(
74            name = "resolver_component_tests_runner_invoker%s" % unsecure_build_config_suffix,
75            srcs = [
76                "resolver_component_tests_runner_invoker.cc",
77            ],
78            external_deps = [
79                "absl/flags:flag",
80                "absl/log:check",
81                "absl/strings",
82            ],
83            deps = [
84                "//test/cpp/util:test_util%s" % unsecure_build_config_suffix,
85                "//test/core/test_util:grpc_test_util%s" % unsecure_build_config_suffix,
86                "//:grpc++%s" % unsecure_build_config_suffix,
87                "//:grpc%s" % unsecure_build_config_suffix,
88                "//:gpr",
89                "//test/cpp/util:test_config",
90                "//test/cpp/util/windows:manifest_file",
91            ],
92            data = [
93                ":resolver_component_tests_runner",
94                ":resolver_component_test%s" % unsecure_build_config_suffix,
95                "//test/cpp/naming/utils:dns_server",
96                "//test/cpp/naming/utils:dns_resolver",
97                "//test/cpp/naming/utils:tcp_connect",
98                "//test/cpp/naming:resolver_test_record_groups",  # include the transitive dependency so that the dns server py binary can locate this
99            ],
100            args = [
101                "--test_bin_name=resolver_component_test%s" % unsecure_build_config_suffix,
102                "--running_under_bazel=true",
103            ],
104            tags = ["no_mac", "resolver_component_tests_runner_invoker"],
105        )
106