|
|
|
@ -99,17 +99,15 @@ TEST_P(OutlierDetectionTest, SuccessRateEjectionAndUnejection) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend is ejected, rpc destinated to it are now hashed to the other
|
|
|
|
@ -177,28 +175,24 @@ TEST_P(OutlierDetectionTest, SuccessRateMaxPercent) { |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(metadata1); |
|
|
|
|
const auto rpc_options2 = RpcOptions().set_metadata(metadata2); |
|
|
|
|
const auto rpc_options3 = RpcOptions().set_metadata(metadata3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, WaitForBackendOptions(), rpc_options3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options3); |
|
|
|
|
// Cause 2 error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata1)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata1)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendOk(DEBUG_LOCATION, 1, rpc_options2); |
|
|
|
|
CheckRpcSendOk(DEBUG_LOCATION, 1, rpc_options3); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
@ -280,17 +274,15 @@ TEST_P(OutlierDetectionTest, SuccessRateStdevFactor) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend experenced failure, but since the stdev_factor is high, no
|
|
|
|
@ -351,17 +343,15 @@ TEST_P(OutlierDetectionTest, SuccessRateEnforcementPercentage) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend experenced failure, but since the enforcement percentage is 0, no
|
|
|
|
@ -421,17 +411,15 @@ TEST_P(OutlierDetectionTest, SuccessRateMinimumHosts) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// All traffic still reaching the original backends and no backends are
|
|
|
|
@ -492,17 +480,15 @@ TEST_P(OutlierDetectionTest, SuccessRateRequestVolume) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// All traffic still reaching the original backends and no backends are
|
|
|
|
@ -567,18 +553,16 @@ TEST_P(OutlierDetectionTest, FailurePercentageEjectionAndUnejection) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend is ejected all traffic going to the ejected backend should now
|
|
|
|
@ -646,28 +630,24 @@ TEST_P(OutlierDetectionTest, FailurePercentageMaxPercentage) { |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(metadata1); |
|
|
|
|
const auto rpc_options2 = RpcOptions().set_metadata(metadata2); |
|
|
|
|
const auto rpc_options3 = RpcOptions().set_metadata(metadata3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, WaitForBackendOptions(), rpc_options3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options3); |
|
|
|
|
// Cause 2 error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata1)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata1)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend should be ejected, trafficed picked up by another backend.
|
|
|
|
@ -743,18 +723,16 @@ TEST_P(OutlierDetectionTest, FailurePercentageThreshold) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend experenced 1 failure, but since the threshold is 50 % no
|
|
|
|
@ -815,18 +793,16 @@ TEST_P(OutlierDetectionTest, FailurePercentageEnforcementPercentage) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend experenced failure, but since the enforcement percentage is 0, no
|
|
|
|
@ -886,18 +862,16 @@ TEST_P(OutlierDetectionTest, FailurePercentageMinimumHosts) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// All traffic still reaching the original backends and no backends are
|
|
|
|
@ -959,18 +933,16 @@ TEST_P(OutlierDetectionTest, FailurePercentageRequestVolume) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass to cause
|
|
|
|
|
// the backend to be ejected.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// All traffic still reaching the original backends and no backends are
|
|
|
|
@ -1050,10 +1022,14 @@ TEST_P(OutlierDetectionTest, SuccessRateAndFailurePercentage) { |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(metadata1); |
|
|
|
|
const auto rpc_options2 = RpcOptions().set_metadata(metadata2); |
|
|
|
|
const auto rpc_options3 = RpcOptions().set_metadata(metadata3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, WaitForBackendOptions(), rpc_options3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options3); |
|
|
|
|
// Cause 2 errors on 1 backend and 1 error on 2 backends and wait for 1
|
|
|
|
|
// outlier detection interval to pass. The 2 errors to the 1 backend will make
|
|
|
|
|
// exactly 1 outlier from the success rate algorithm; all 4 errors will make 3
|
|
|
|
@ -1063,33 +1039,21 @@ TEST_P(OutlierDetectionTest, SuccessRateAndFailurePercentage) { |
|
|
|
|
// eject another backend because of failure percentage we will stop as we have
|
|
|
|
|
// reached our 50% limit.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata1).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata1).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata2).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata2).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
CheckRpcSendOk(DEBUG_LOCATION, 100, rpc_options); |
|
|
|
@ -1149,17 +1113,15 @@ TEST_P(OutlierDetectionTest, SuccessRateAndFailurePercentageBothDisabled) { |
|
|
|
|
{"address_hash", CreateMetadataValueThatHashesToBackend(1)}}; |
|
|
|
|
const auto rpc_options = RpcOptions().set_metadata(metadata); |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(std::move(metadata1)); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
// Cause an error and wait for 1 outlier detection interval to pass
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure(DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions() |
|
|
|
|
.set_metadata(std::move(metadata)) |
|
|
|
|
.set_server_expected_error(StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
// 1 backend experenced failure, but since there is no counting there is no
|
|
|
|
@ -1235,42 +1197,34 @@ TEST_P(OutlierDetectionTest, |
|
|
|
|
const auto rpc_options1 = RpcOptions().set_metadata(metadata1); |
|
|
|
|
const auto rpc_options2 = RpcOptions().set_metadata(metadata2); |
|
|
|
|
const auto rpc_options3 = RpcOptions().set_metadata(metadata3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, WaitForBackendOptions(), rpc_options3); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 0, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 1, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options1); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 2, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options2); |
|
|
|
|
WaitForBackend(DEBUG_LOCATION, 3, /*check_status=*/nullptr, |
|
|
|
|
WaitForBackendOptions(), rpc_options3); |
|
|
|
|
// Cause 2 errors on 1 backend and 1 error on 2 backends and wait for 1
|
|
|
|
|
// outlier detection interval to pass. The errors should have caused 2
|
|
|
|
|
// ejctionss but since the policy is disabled we are not ejecting any and
|
|
|
|
|
// traffic flow as usual and RPCs reach destinated backends.
|
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata1).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata1).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
CheckRpcSendFailure( |
|
|
|
|
DEBUG_LOCATION, |
|
|
|
|
CheckRpcSendFailureOptions() |
|
|
|
|
.set_rpc_options( |
|
|
|
|
RpcOptions().set_metadata(metadata2).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)) |
|
|
|
|
.set_expected_error_code(StatusCode::CANCELLED)); |
|
|
|
|
DEBUG_LOCATION, StatusCode::CANCELLED, "", |
|
|
|
|
RpcOptions().set_metadata(metadata2).set_server_expected_error( |
|
|
|
|
StatusCode::CANCELLED)); |
|
|
|
|
gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); |
|
|
|
|
ResetBackendCounters(); |
|
|
|
|
CheckRpcSendOk(DEBUG_LOCATION, 100, rpc_options); |
|
|
|
|