Merge pull request #21193 from apolcyn/fix_test_assertion

Fix racey test assertion in alts_concurrent_connectivity_test
pull/21119/head^2
hcaseyal 5 years ago committed by GitHub
commit 6e0f525d8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc

@ -236,7 +236,22 @@ class ConnectLoopRunner {
<< "connect_loop runner:" << std::hex << self
<< " got ev.type:" << ev.type << " i:" << i;
ASSERT_TRUE(ev.success);
grpc_connectivity_state prev_state = state;
state = grpc_channel_check_connectivity_state(channel, 1);
if (self->expected_connectivity_states_ ==
GRPC_CHANNEL_TRANSIENT_FAILURE &&
prev_state == GRPC_CHANNEL_CONNECTING &&
state == GRPC_CHANNEL_CONNECTING) {
// Detect a race in state checking: if the watch_connectivity_state
// completed from prior state "connecting", this could be because the
// channel momentarily entered state "transient failure", which is
// what we want. However, if the channel immediately re-enters
// "connecting" state, then the new state check might still result in
// "connecting". A continuous repeat of this can cause this loop to
// never terminate in time. So take this scenario to indicate that the
// channel momentarily entered transient failure.
break;
}
}
grpc_channel_destroy(channel);
grpc_completion_queue_shutdown(cq);

Loading…
Cancel
Save