Skip to content

Commit

Permalink
rename to assertCdsPolicy()
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 committed Apr 3, 2020
1 parent 1ec07ca commit 0d8b4ba
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ public void resolve_resourceUpdated_multipleRoutes() {
assertThat((Map<String, ?>) routes.get(4).get("methodName"))
.containsExactly("service", "", "method", "");
String action4 = (String) routes.get(4).get("action");
assertRouteActionIsCdsPolicy(actions.get(action0), "cluster-hello.googleapis.com");
assertRouteActionIsCdsPolicy(actions.get(action1), "cluster-foo.googleapis.com");
assertCdsPolicy(actions.get(action0), "cluster-hello.googleapis.com");
assertCdsPolicy(actions.get(action1), "cluster-foo.googleapis.com");
assertRouteActionIsWeightedTargetPolicy(
actions.get(action2),
ImmutableMap.of(
Expand Down Expand Up @@ -477,8 +477,9 @@ public void resolve_resourceUpdated_multipleRoutes() {
"cluster-foo.googleapis.com", 20, "cluster-bar.googleapis.com", 80));
}

/** Asserts that the given action contains a single CDS policy with the given cluster name. */
@SuppressWarnings("unchecked")
private static void assertRouteActionIsCdsPolicy(Map<String, ?> action, String clusterName) {
private static void assertCdsPolicy(Map<String, ?> action, String clusterName) {
assertThat(action.keySet()).containsExactly("childPolicy");
Map<String, ?> lbConfig =
Iterables.getOnlyElement((List<Map<String, ?>>) action.get("childPolicy"));
Expand Down

0 comments on commit 0d8b4ba

Please sign in to comment.