Skip to content

Commit

Permalink
util: Mark GracefulSwitchLB.switchTo() deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
ejona86 committed Jul 23, 2024
1 parent 9269050 commit 85e0a01
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ public Status acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
/**
* Gracefully switch to a new policy defined by the given factory, if the given factory isn't
* equal to the current one.
*
* @deprecated Use {@code parseLoadBalancingPolicyConfig()} and pass the configuration to
* {@link io.grpc.LoadBalancer.ResolvedAddresses.Builder#setLoadBalancingPolicyConfig}
*/
@Deprecated
public void switchTo(LoadBalancer.Factory newBalancerFactory) {
switchToCalled = true;
switchToInternal(newBalancerFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public class GracefulSwitchLoadBalancerTest {
// OLD TESTS

@Test
@Deprecated
public void switchTo_canHandleEmptyAddressListFromNameResolutionForwardedToLatestPolicy() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -115,6 +116,7 @@ public void switchTo_canHandleEmptyAddressListFromNameResolutionForwardedToLates
}

@Test
@Deprecated
public void switchTo_handleResolvedAddressesAndNameResolutionErrorForwardedToLatestPolicy() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -155,6 +157,7 @@ public void switchTo_handleResolvedAddressesAndNameResolutionErrorForwardedToLat
}

@Test
@Deprecated
public void switchTo_acceptResolvedAddressesAndNameResolutionErrorForwardedToLatestPolicy() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -195,6 +198,7 @@ public void switchTo_acceptResolvedAddressesAndNameResolutionErrorForwardedToLat
}

@Test
@Deprecated
public void switchTo_shutdownTriggeredWhenSwitchAndForwardedWhenSwitchLbShutdown() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -226,6 +230,7 @@ public void switchTo_shutdownTriggeredWhenSwitchAndForwardedWhenSwitchLbShutdown
}

@Test
@Deprecated
public void switchTo_requestConnectionForwardedToLatestPolicies() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -263,6 +268,7 @@ public void switchTo_requestConnectionForwardedToLatestPolicies() {
}

@Test
@Deprecated
public void switchTo_createSubchannelForwarded() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand All @@ -289,6 +295,7 @@ public void switchTo_createSubchannelForwarded() {
}

@Test
@Deprecated
public void switchTo_updateBalancingStateIsGraceful() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -340,6 +347,7 @@ public void switchTo_updateBalancingStateIsGraceful() {
}

@Test
@Deprecated
public void switchTo_switchWhileOldPolicyIsNotReady() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -368,6 +376,7 @@ public void switchTo_switchWhileOldPolicyIsNotReady() {
}

@Test
@Deprecated
public void switchTo_switchWhileOldPolicyGoesFromReadyToNotReady() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -398,6 +407,7 @@ public void switchTo_switchWhileOldPolicyGoesFromReadyToNotReady() {
}

@Test
@Deprecated
public void switchTo_switchWhileOldPolicyGoesFromReadyToNotReadyWhileNewPolicyStillIdle() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand Down Expand Up @@ -428,6 +438,7 @@ public void switchTo_switchWhileOldPolicyGoesFromReadyToNotReadyWhileNewPolicySt
}

@Test
@Deprecated
public void switchTo_newPolicyNameTheSameAsPendingPolicy_shouldHaveNoEffect() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand All @@ -445,6 +456,7 @@ public void switchTo_newPolicyNameTheSameAsPendingPolicy_shouldHaveNoEffect() {
}

@Test
@Deprecated
public void switchTo_newPolicyNameTheSameAsCurrentPolicy_shouldShutdownPendingLb() {
gracefulSwitchLb.switchTo(lbPolicies[0]);
LoadBalancer lb0 = balancers.get(lbPolicies[0]);
Expand All @@ -468,6 +480,7 @@ public void switchTo_newPolicyNameTheSameAsCurrentPolicy_shouldShutdownPendingLb


@Test
@Deprecated
public void switchTo_newLbFactoryEqualToOldOneShouldHaveNoEffect() {
final List<LoadBalancer> balancers = new ArrayList<>();

Expand Down

0 comments on commit 85e0a01

Please sign in to comment.