Skip to content

xds: Check isHttp11ProxyAvailable in equals() #12212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ boolean isHttp11ProxyAvailable() {

@Override
public int hashCode() {
return Objects.hash(discoveryMechanisms, lbConfig);
return Objects.hash(discoveryMechanisms, lbConfig, isHttp11ProxyAvailable);
}

@Override
Expand All @@ -102,14 +102,16 @@ public boolean equals(Object o) {
}
ClusterResolverConfig that = (ClusterResolverConfig) o;
return discoveryMechanisms.equals(that.discoveryMechanisms)
&& lbConfig.equals(that.lbConfig);
&& lbConfig.equals(that.lbConfig)
&& isHttp11ProxyAvailable == that.isHttp11ProxyAvailable;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("discoveryMechanisms", discoveryMechanisms)
.add("lbConfig", lbConfig)
.add("isHttp11ProxyAvailable", isHttp11ProxyAvailable)
.toString();
}

Expand Down
22 changes: 22 additions & 0 deletions xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.testing.EqualsTester;
import io.grpc.Attributes;
import io.grpc.ChannelLogger;
import io.grpc.ConnectivityState;
Expand Down Expand Up @@ -1199,6 +1200,27 @@ public void handleNameResolutionErrorFromUpstream_afterChildLbCreated_fallThroug
any(ConnectivityState.class), any(SubchannelPicker.class));
}

@Test
public void config_equalsTester() {
new EqualsTester()
.addEqualityGroup(
new ClusterResolverConfig(
Collections.singletonList(edsDiscoveryMechanism1), leastRequest, false),
new ClusterResolverConfig(
Collections.singletonList(edsDiscoveryMechanism1), leastRequest, false))
.addEqualityGroup(new ClusterResolverConfig(
Collections.singletonList(edsDiscoveryMechanism1), roundRobin, false))
.addEqualityGroup(new ClusterResolverConfig(
Collections.singletonList(edsDiscoveryMechanism1), leastRequest, true))
.addEqualityGroup(new ClusterResolverConfig(
Collections.singletonList(edsDiscoveryMechanismWithOutlierDetection),
leastRequest,
false))
.addEqualityGroup(new ClusterResolverConfig(
Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), leastRequest, false))
.testEquals();
}

private void deliverLbConfig(ClusterResolverConfig config) {
loadBalancer.acceptResolvedAddresses(
ResolvedAddresses.newBuilder()
Expand Down