xds_cluster_e2e_test: change tests to provide better failure messages (#30727)

pull/30732/head
Mark D. Roth 2 years ago committed by GitHub
parent dc1cb1fb59
commit 4a27b432b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      test/cpp/end2end/xds/xds_cluster_end2end_test.cc

@ -259,13 +259,12 @@ TEST_P(CdsTest, CircuitBreaking) {
}
// Sending a RPC now should fail, the error message should tell us
// we hit the max concurrent requests limit and got dropped.
Status status = SendRpc();
EXPECT_FALSE(status.ok());
EXPECT_EQ(status.error_message(), "circuit breaker drop");
// Cancel one RPC to allow another one through
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::UNAVAILABLE,
"circuit breaker drop");
// Cancel one RPC to allow another one through.
rpcs[0].CancelRpc();
status = SendRpc();
EXPECT_TRUE(status.ok());
CheckRpcSendOk(DEBUG_LOCATION);
// Clean up.
for (size_t i = 1; i < kMaxConcurrentRequests; ++i) {
rpcs[i].CancelRpc();
}
@ -300,13 +299,12 @@ TEST_P(CdsTest, CircuitBreakingMultipleChannelsShareCallCounter) {
}
// Sending a RPC now should fail, the error message should tell us
// we hit the max concurrent requests limit and got dropped.
Status status = SendRpc();
EXPECT_FALSE(status.ok());
EXPECT_EQ(status.error_message(), "circuit breaker drop");
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::UNAVAILABLE,
"circuit breaker drop");
// Cancel one RPC to allow another one through
rpcs[0].CancelRpc();
status = SendRpc();
EXPECT_TRUE(status.ok());
CheckRpcSendOk(DEBUG_LOCATION);
// Clean up.
for (size_t i = 1; i < kMaxConcurrentRequests; ++i) {
rpcs[i].CancelRpc();
}
@ -550,11 +548,15 @@ TEST_P(EdsTest, AllServersUnreachableFailFast) {
}
EdsResourceArgs args({{"locality0", std::move(endpoints)}});
balancer_->ads_service()->SetEdsResource(BuildEdsResource(args));
const Status status = SendRpc(RpcOptions().set_timeout_ms(kRpcTimeoutMs));
// The error shouldn't be DEADLINE_EXCEEDED because timeout is set to 5
// seconds, and we should disocver in that time that the target backend is
// down.
EXPECT_EQ(StatusCode::UNAVAILABLE, status.error_code());
CheckRpcSendFailure(
DEBUG_LOCATION, StatusCode::UNAVAILABLE,
"connections to all backends failing; last error: "
"(UNKNOWN: Failed to connect to remote host: Connection refused|"
"UNAVAILABLE: Failed to connect to remote host: FD shutdown)",
RpcOptions().set_timeout_ms(kRpcTimeoutMs));
}
// Tests that RPCs fail when the backends are down, and will succeed again

Loading…
Cancel
Save