Account for empty EDS update in test_round_robin

pull/23911/head
Eric Gribkoff 5 years ago
parent 0bd773c152
commit bbe880c0a2
  1. 31
      tools/run_tests/run_xds_tests.py

@ -579,17 +579,26 @@ def test_round_robin(gcp, backend_service, instance_group):
threshold = 1 threshold = 1
wait_until_all_rpcs_go_to_given_backends(instance_names, wait_until_all_rpcs_go_to_given_backends(instance_names,
_WAIT_FOR_STATS_SEC) _WAIT_FOR_STATS_SEC)
stats = get_client_stats(_NUM_TEST_RPCS, _WAIT_FOR_STATS_SEC) # TODO(ericgribkoff) Delayed config propagation from earlier tests
requests_received = [stats.rpcs_by_peer[x] for x in stats.rpcs_by_peer] # may result in briefly receiving an empty EDS update, resulting in failed
total_requests_received = sum(requests_received) # RPCs. Retry distribution validation if this occurs; long-term fix is
if total_requests_received != _NUM_TEST_RPCS: # creating new backend resources for each individual test case.
raise Exception('Unexpected RPC failures', stats) max_attempts = 10
expected_requests = total_requests_received / len(instance_names) for i in range(max_attempts):
for instance in instance_names: stats = get_client_stats(_NUM_TEST_RPCS, _WAIT_FOR_STATS_SEC)
if abs(stats.rpcs_by_peer[instance] - expected_requests) > threshold: requests_received = [stats.rpcs_by_peer[x] for x in stats.rpcs_by_peer]
raise Exception( total_requests_received = sum(requests_received)
'RPC peer distribution differs from expected by more than %d ' if total_requests_received != _NUM_TEST_RPCS:
'for instance %s (%s)' % (threshold, instance, stats)) logger.info('Unexpected RPC failures, retrying: %s', stats)
continue
expected_requests = total_requests_received / len(instance_names)
for instance in instance_names:
if abs(stats.rpcs_by_peer[instance] - expected_requests) > threshold:
raise Exception(
'RPC peer distribution differs from expected by more than %d '
'for instance %s (%s)' % (threshold, instance, stats))
return
raise Exception('RPC failures persisted through %d retries' % max_attempts)
def test_secondary_locality_gets_no_requests_on_partial_primary_failure( def test_secondary_locality_gets_no_requests_on_partial_primary_failure(

Loading…
Cancel
Save