use of io.grpc.xds.LeastRequestLoadBalancer.LeastRequestConfig in project grpc-java by grpc.
the class LeastRequestLoadBalancerProviderTest method parseLoadBalancingConfig_missingChoiceCount_useDefaults.
@Test
public void parseLoadBalancingConfig_missingChoiceCount_useDefaults() throws IOException {
String lbConfig = "{}";
ConfigOrError configOrError = provider.parseLoadBalancingPolicyConfig(parseJsonObject(lbConfig));
assertThat(configOrError.getConfig()).isNotNull();
LeastRequestConfig config = (LeastRequestConfig) configOrError.getConfig();
assertThat(config.choiceCount).isEqualTo(LeastRequestLoadBalancerProvider.DEFAULT_CHOICE_COUNT);
}
use of io.grpc.xds.LeastRequestLoadBalancer.LeastRequestConfig in project grpc-java by grpc.
the class LeastRequestLoadBalancerProviderTest method parseLoadBalancingConfig_choiceCountCappedAtMax.
@Test
public void parseLoadBalancingConfig_choiceCountCappedAtMax() throws IOException {
String lbConfig = "{\"choiceCount\" : 11}";
ConfigOrError configOrError = provider.parseLoadBalancingPolicyConfig(parseJsonObject(lbConfig));
assertThat(configOrError.getConfig()).isNotNull();
LeastRequestConfig config = (LeastRequestConfig) configOrError.getConfig();
assertThat(config.choiceCount).isEqualTo(LeastRequestLoadBalancerProvider.MAX_CHOICE_COUNT);
}
Aggregations