Search in sources :

Example 26 with CdsUpdate

use of io.grpc.xds.XdsClient.CdsUpdate in project grpc-java by grpc.

the class CdsLoadBalancer2Test method nonAggregateCluster_resourceUpdate.

@Test
public void nonAggregateCluster_resourceUpdate() {
    CdsUpdate update = CdsUpdate.forEds(CLUSTER, null, null, 100L, upstreamTlsContext).roundRobinLbPolicy().build();
    xdsClient.deliverCdsUpdate(CLUSTER, update);
    assertThat(childBalancers).hasSize(1);
    FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers);
    ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config;
    DiscoveryMechanism instance = Iterables.getOnlyElement(childLbConfig.discoveryMechanisms);
    assertDiscoveryMechanism(instance, CLUSTER, DiscoveryMechanism.Type.EDS, null, null, null, 100L, upstreamTlsContext);
    update = CdsUpdate.forEds(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, 200L, null).roundRobinLbPolicy().build();
    xdsClient.deliverCdsUpdate(CLUSTER, update);
    childLbConfig = (ClusterResolverConfig) childBalancer.config;
    instance = Iterables.getOnlyElement(childLbConfig.discoveryMechanisms);
    assertDiscoveryMechanism(instance, CLUSTER, DiscoveryMechanism.Type.EDS, EDS_SERVICE_NAME, null, LRS_SERVER_INFO, 200L, null);
}
Also used : DiscoveryMechanism(io.grpc.xds.ClusterResolverLoadBalancerProvider.ClusterResolverConfig.DiscoveryMechanism) ClusterResolverConfig(io.grpc.xds.ClusterResolverLoadBalancerProvider.ClusterResolverConfig) CdsUpdate(io.grpc.xds.XdsClient.CdsUpdate) Test(org.junit.Test)

Aggregations

CdsUpdate (io.grpc.xds.XdsClient.CdsUpdate)26 Test (org.junit.Test)26 Any (com.google.protobuf.Any)9 ClusterResolverConfig (io.grpc.xds.ClusterResolverLoadBalancerProvider.ClusterResolverConfig)9 Status (io.grpc.Status)7 DiscoveryMechanism (io.grpc.xds.ClusterResolverLoadBalancerProvider.ClusterResolverConfig.DiscoveryMechanism)5 CdsResourceWatcher (io.grpc.xds.XdsClient.CdsResourceWatcher)3 Truth.assertWithMessage (com.google.common.truth.Truth.assertWithMessage)2 Message (com.google.protobuf.Message)2 Cluster (io.envoyproxy.envoy.config.cluster.v3.Cluster)2 WeightedCluster (io.envoyproxy.envoy.config.route.v3.WeightedCluster)2 SubchannelPicker (io.grpc.LoadBalancer.SubchannelPicker)2 LbEndpoint (io.grpc.xds.Endpoints.LbEndpoint)2 CertificateProviderPluginInstance (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateProviderPluginInstance)1 CommonTlsContext (io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext)1 ConnectivityState (io.grpc.ConnectivityState)1 LeastRequestConfig (io.grpc.xds.LeastRequestLoadBalancer.LeastRequestConfig)1 RingHashConfig (io.grpc.xds.RingHashLoadBalancer.RingHashConfig)1 EdsResourceWatcher (io.grpc.xds.XdsClient.EdsResourceWatcher)1