Reduce resource requirements for some test runs

Adds --instance_group_size parameter and skips creating IGs in the
secondary zone is not used by any of the specified test cases.
pull/22501/head
Eric Gribkoff 5 years ago
parent 5186b231b1
commit a83409bd87
  1. 23
      tools/run_tests/run_xds_tests.py

@ -143,6 +143,15 @@ argp.add_argument('--source_image',
argp.add_argument('--machine_type', argp.add_argument('--machine_type',
default='e2-standard-2', default='e2-standard-2',
help='Machine type for VMs created during the test') help='Machine type for VMs created during the test')
argp.add_argument(
'--instance_group_size',
default=2,
type=int,
help=
'Number of VMs to create per instance group. Certain test cases (e.g., '
'round_robin) may not give meaningful results if this is set to a value '
'less than 2.'
)
argp.add_argument( argp.add_argument(
'--tolerate_gcp_errors', '--tolerate_gcp_errors',
default=False, default=False,
@ -163,7 +172,7 @@ if args.verbose:
_DEFAULT_SERVICE_PORT = 80 _DEFAULT_SERVICE_PORT = 80
_WAIT_FOR_BACKEND_SEC = args.wait_for_backend_sec _WAIT_FOR_BACKEND_SEC = args.wait_for_backend_sec
_WAIT_FOR_OPERATION_SEC = 300 _WAIT_FOR_OPERATION_SEC = 300
_INSTANCE_GROUP_SIZE = 2 _INSTANCE_GROUP_SIZE = args.instance_group_size
_NUM_TEST_RPCS = 10 * args.qps _NUM_TEST_RPCS = 10 * args.qps
_WAIT_FOR_STATS_SEC = 180 _WAIT_FOR_STATS_SEC = 180
_WAIT_FOR_URL_MAP_PATCH_SEC = 300 _WAIT_FOR_URL_MAP_PATCH_SEC = 300
@ -188,6 +197,12 @@ _BOOTSTRAP_TEMPLATE = """
] ]
}}] }}]
}}""" % (args.network.split('/')[-1], args.zone, args.xds_server) }}""" % (args.network.split('/')[-1], args.zone, args.xds_server)
_TESTS_USING_SECONDARY_IG = [
'secondary_locality_gets_no_requests_on_partial_primary_failure',
'secondary_locality_gets_requests_on_primary_failure'
]
_USE_SECONDARY_IG = any(
[t in args.test_cases for t in _TESTS_USING_SECONDARY_IG])
_PATH_MATCHER_NAME = 'path-matcher' _PATH_MATCHER_NAME = 'path-matcher'
_BASE_TEMPLATE_NAME = 'test-template' _BASE_TEMPLATE_NAME = 'test-template'
_BASE_INSTANCE_GROUP_NAME = 'test-ig' _BASE_INSTANCE_GROUP_NAME = 'test-ig'
@ -937,6 +952,7 @@ try:
template_name = _BASE_TARGET_PROXY_NAME + args.gcp_suffix template_name = _BASE_TARGET_PROXY_NAME + args.gcp_suffix
instance_group_name = _BASE_INSTANCE_GROUP_NAME + args.gcp_suffix instance_group_name = _BASE_INSTANCE_GROUP_NAME + args.gcp_suffix
same_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + '-same-zone' + args.gcp_suffix same_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + '-same-zone' + args.gcp_suffix
if _USE_SECONDARY_IG:
secondary_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + '-secondary-zone' + args.gcp_suffix secondary_zone_instance_group_name = _BASE_INSTANCE_GROUP_NAME + '-secondary-zone' + args.gcp_suffix
try: try:
create_health_check(gcp, health_check_name) create_health_check(gcp, health_check_name)
@ -977,6 +993,7 @@ try:
patch_backend_instances(gcp, backend_service, [instance_group]) patch_backend_instances(gcp, backend_service, [instance_group])
same_zone_instance_group = add_instance_group( same_zone_instance_group = add_instance_group(
gcp, args.zone, same_zone_instance_group_name, _INSTANCE_GROUP_SIZE) gcp, args.zone, same_zone_instance_group_name, _INSTANCE_GROUP_SIZE)
if _USE_SECONDARY_IG:
secondary_zone_instance_group = add_instance_group( secondary_zone_instance_group = add_instance_group(
gcp, args.secondary_zone, secondary_zone_instance_group_name, gcp, args.secondary_zone, secondary_zone_instance_group_name,
_INSTANCE_GROUP_SIZE) _INSTANCE_GROUP_SIZE)
@ -1020,10 +1037,12 @@ try:
same_zone_instance_group_name, result['selfLink'], same_zone_instance_group_name, result['selfLink'],
args.zone) args.zone)
gcp.instance_groups.append(same_zone_instance_group) gcp.instance_groups.append(same_zone_instance_group)
if _USE_SECONDARY_IG:
result = compute.instanceGroups().get( result = compute.instanceGroups().get(
project=args.project_id, project=args.project_id,
zone=args.secondary_zone, zone=args.secondary_zone,
instanceGroup=secondary_zone_instance_group_name).execute() instanceGroup=secondary_zone_instance_group_name
).execute()
secondary_zone_instance_group = InstanceGroup( secondary_zone_instance_group = InstanceGroup(
secondary_zone_instance_group_name, result['selfLink'], secondary_zone_instance_group_name, result['selfLink'],
args.secondary_zone) args.secondary_zone)

Loading…
Cancel
Save