diff --git a/test/common/upstream/least_request_load_balancer_corpus/large_active_request_bias b/test/common/upstream/least_request_load_balancer_corpus/large_active_request_bias new file mode 100644 index 000000000000..b71dd055c2a7 --- /dev/null +++ b/test/common/upstream/least_request_load_balancer_corpus/large_active_request_bias @@ -0,0 +1,19 @@ +zone_aware_load_balancer_test_case { + load_balancer_test_case { + common_lb_config { + } + setup_priority_levels { + num_hosts_in_priority_level: 59 + random_bytestring: 9 + } + seed_for_prng: 4 + } + random_bytestring_for_weights: "!A" +} +least_request_lb_config { + active_request_bias { + default_value: 34816 + runtime_key: "*" + } +} +random_bytestring_for_requests: "+" diff --git a/test/common/upstream/least_request_load_balancer_fuzz_test.cc b/test/common/upstream/least_request_load_balancer_fuzz_test.cc index d6a63c628e34..0047d3377ab7 100644 --- a/test/common/upstream/least_request_load_balancer_fuzz_test.cc +++ b/test/common/upstream/least_request_load_balancer_fuzz_test.cc @@ -53,11 +53,22 @@ DEFINE_PROTO_FUZZER(const test::common::upstream::LeastRequestLoadBalancerTestCa MaxChoiceCountForTest); return; } - // Validate the correctness of the Slow-Start config values. - if (input.has_least_request_lb_config() && - input.least_request_lb_config().has_slow_start_config()) { - if (!ZoneAwareLoadBalancerFuzzBase::validateSlowStart( - input.least_request_lb_config().slow_start_config())) { + if (input.has_least_request_lb_config()) { + const auto& least_request_lb_config = input.least_request_lb_config(); + // Validate the correctness of the Slow-Start config values. + if (least_request_lb_config.has_slow_start_config() && + !ZoneAwareLoadBalancerFuzzBase::validateSlowStart( + least_request_lb_config.slow_start_config())) { + return; + } + // Validate that the active_request_bias is not too large (or else it will + // effectively zero all the weights). + if (least_request_lb_config.has_active_request_bias() && + least_request_lb_config.active_request_bias().default_value() > 25) { + ENVOY_LOG_MISC(debug, + "active_request_bias default_value in the least-request config is too high " + "({} > 25), skipping test as the config is invalid", + least_request_lb_config.active_request_bias().default_value()); return; } }