Add alpha tests (subsetting) to xds_k8s_lb (#27460)

* Add compute alpha API config file

* WIP

* Try not to create a new job

* Change from using discovery file to use version flag

* Give compute_api_version a default value

* Extend the timeout of xds_k8s_lb

* Apply suggestions from code review

Co-authored-by: Sergii Tkachenko <hi@sergii.org>

Co-authored-by: Sergii Tkachenko <hi@sergii.org>
reviewable/pr27511/r1
Lidi Zheng 3 years ago committed by GitHub
parent eda416769e
commit 50a79d62e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tools/internal_ci/linux/grpc_xds_k8s_lb.cfg
  2. 10
      tools/internal_ci/linux/grpc_xds_k8s_lb.sh
  3. 2
      tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/api.py
  4. 7
      tools/run_tests/xds_k8s_test_driver/framework/infrastructure/gcp/compute.py
  5. 5
      tools/run_tests/xds_k8s_test_driver/framework/infrastructure/traffic_director.py
  6. 4
      tools/run_tests/xds_k8s_test_driver/framework/xds_flags.py
  7. 19
      tools/run_tests/xds_k8s_test_driver/framework/xds_k8s_testcase.py
  8. 1
      tools/run_tests/xds_k8s_test_driver/framework/xds_url_map_test_resources.py

@ -16,7 +16,7 @@
# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_xds_k8s_lb.sh"
timeout_mins: 90
timeout_mins: 180
action {
define_artifacts {
regex: "artifacts/**/*sponge_log.xml"

@ -105,7 +105,14 @@ run_test() {
--secondary_kube_context="${SECONDARY_KUBE_CONTEXT}" \
--server_image="${SERVER_IMAGE_NAME}:${GIT_COMMIT}" \
--client_image="${CLIENT_IMAGE_NAME}:${GIT_COMMIT}" \
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml"
--xml_output_file="${TEST_XML_OUTPUT_DIR}/${test_name}/sponge_log.xml" \
${@:2}
}
run_alpha_test() {
local test_name=$1
run_test ${test_name} \
--compute_api_version="v1alpha"
}
#######################################
@ -144,6 +151,7 @@ main() {
# Run tests
cd "${TEST_DRIVER_FULL_DIR}"
local failed_tests=0
run_alpha_test subsetting_test || (( failed_tests++ ))
test_suites=("change_backend_service_test" "failover_test" "remove_neg_test" "round_robin_test" "affinity_test")
for test in "${test_suites[@]}"; do
run_test $test || (( failed_tests++ ))

@ -115,6 +115,8 @@ class GcpApiManager:
return self._build_from_file(self.compute_v1_discovery_file)
else:
return self._build_from_discovery_v1(api_name, version)
elif version == 'v1alpha':
return self._build_from_discovery_v1(api_name, 'alpha')
raise NotImplementedError(f'Compute {version} not supported')

@ -40,8 +40,11 @@ class ComputeV1(gcp.api.GcpProjectApiResource):
class ZonalGcpResource(GcpResource):
zone: str
def __init__(self, api_manager: gcp.api.GcpApiManager, project: str):
super().__init__(api_manager.compute('v1'), project)
def __init__(self,
api_manager: gcp.api.GcpApiManager,
project: str,
version: str = 'v1'):
super().__init__(api_manager.compute(version), project)
class HealthCheckProtocol(enum.Enum):
TCP = enum.auto()

@ -68,9 +68,12 @@ class TrafficDirectorManager:
resource_prefix: str,
resource_suffix: str,
network: str = 'default',
compute_api_version: str = 'v1',
):
# API
self.compute = _ComputeV1(gcp_api_manager, project)
self.compute = _ComputeV1(gcp_api_manager,
project,
version=compute_api_version)
# Settings
self.project: str = project

@ -36,6 +36,10 @@ RESOURCE_SUFFIX = flags.DEFINE_string(
NETWORK = flags.DEFINE_string("network",
default="default",
help="GCP Network ID")
COMPUTE_API_VERSION = flags.DEFINE_string(
"compute_api_version",
default='v1',
help="The version of the GCP Compute API, e.g., v1, v1alpha")
# Mirrors --xds-server-uri argument of Traffic Director gRPC Bootstrap
XDS_SERVER_URI = flags.DEFINE_string(
"xds_server_uri",

@ -90,6 +90,7 @@ class XdsKubernetesTestCase(absltest.TestCase, metaclass=abc.ABCMeta):
cls.xds_server_uri = xds_flags.XDS_SERVER_URI.value
cls.ensure_firewall = xds_flags.ENSURE_FIREWALL.value
cls.firewall_allowed_ports = xds_flags.FIREWALL_ALLOWED_PORTS.value
cls.compute_api_version = xds_flags.COMPUTE_API_VERSION.value
# Resource names.
cls.resource_prefix = xds_flags.RESOURCE_PREFIX.value
@ -329,11 +330,13 @@ class RegularXdsKubernetesTestCase(XdsKubernetesTestCase):
cls.server_maintenance_port = KubernetesServerRunner.DEFAULT_MAINTENANCE_PORT
def initTrafficDirectorManager(self) -> TrafficDirectorManager:
return TrafficDirectorManager(self.gcp_api_manager,
project=self.project,
resource_prefix=self.resource_prefix,
resource_suffix=self.resource_suffix,
network=self.network)
return TrafficDirectorManager(
self.gcp_api_manager,
project=self.project,
resource_prefix=self.resource_prefix,
resource_suffix=self.resource_suffix,
network=self.network,
compute_api_version=self.compute_api_version)
def initKubernetesServerRunner(self) -> KubernetesServerRunner:
return KubernetesServerRunner(
@ -400,7 +403,8 @@ class AppNetXdsKubernetesTestCase(RegularXdsKubernetesTestCase):
project=self.project,
resource_prefix=self.resource_prefix,
resource_suffix=self.resource_suffix,
network=self.network)
network=self.network,
compute_api_version=self.compute_api_version)
class SecurityXdsKubernetesTestCase(XdsKubernetesTestCase):
@ -431,7 +435,8 @@ class SecurityXdsKubernetesTestCase(XdsKubernetesTestCase):
project=self.project,
resource_prefix=self.resource_prefix,
resource_suffix=self.resource_suffix,
network=self.network)
network=self.network,
compute_api_version=self.compute_api_version)
def initKubernetesServerRunner(self) -> KubernetesServerRunner:
return KubernetesServerRunner(

@ -159,6 +159,7 @@ class GcpResourceManager(metaclass=_MetaSingletonAndAbslFlags):
resource_prefix=self.resource_prefix,
resource_suffix=(self.resource_suffix or ""),
network=self.network,
compute_api_version=self.compute_api_version,
)
# Kubernetes namespace
self.k8s_namespace = k8s.KubernetesNamespace(self.k8s_api_manager,

Loading…
Cancel
Save