use of io.grpc.NameResolver.ConfigOrError in project grpc-java by grpc.
the class LeastRequestLoadBalancerProviderTest method parseLoadBalancingConfig_invalid_tooSmallSize.
@Test
public void parseLoadBalancingConfig_invalid_tooSmallSize() throws IOException {
String lbConfig = "{\"choiceCount\" : 1}";
ConfigOrError configOrError = provider.parseLoadBalancingPolicyConfig(parseJsonObject(lbConfig));
assertThat(configOrError.getError()).isNotNull();
assertThat(configOrError.getError().getCode()).isEqualTo(Code.INVALID_ARGUMENT);
assertThat(configOrError.getError().getDescription()).isEqualTo("Invalid 'choiceCount'");
}
use of io.grpc.NameResolver.ConfigOrError 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