Skip to content

Commit

Permalink
xds: Don't end status with '.' in XdsNameResolver (#8958) (#8965)
Browse files Browse the repository at this point in the history
2a45524 introduced '.' to the end of some status descriptions. We
typically don't end status descriptiosn in periods, but that's minor. In
this case though if the causal status ends in period then the new status
will end in two periods, which could easily be confusing to users.

Co-authored-by: Eric Anderson <ejona@google.com>
  • Loading branch information
YifeiZhuang and ejona86 committed Mar 8, 2022
1 parent 62073d9 commit 6844f06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions xds/src/main/java/io/grpc/xds/XdsNameResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public void run() {
return;
}
listener.onError(Status.UNAVAILABLE.withCause(error.getCause()).withDescription(
String.format("Unable to load LDS %s. xDS server returned: %s: %s.",
String.format("Unable to load LDS %s. xDS server returned: %s: %s",
ldsResourceName, error.getCode(), error.getDescription())));
}
});
Expand Down Expand Up @@ -923,7 +923,7 @@ public void run() {
return;
}
listener.onError(Status.UNAVAILABLE.withCause(error.getCause()).withDescription(
String.format("Unable to load RDS %s. xDS server returned: %s: %s.",
String.format("Unable to load RDS %s. xDS server returned: %s: %s",
resourceName, error.getCode(), error.getDescription())));
}
});
Expand Down
8 changes: 4 additions & 4 deletions xds/src/test/java/io/grpc/xds/XdsNameResolverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public void resolving_encounterErrorLdsWatcherOnly() {
Status error = errorCaptor.getValue();
assertThat(error.getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(error.getDescription()).isEqualTo("Unable to load LDS " + AUTHORITY
+ ". xDS server returned: UNAVAILABLE: server unreachable.");
+ ". xDS server returned: UNAVAILABLE: server unreachable");
}

@Test
Expand All @@ -444,7 +444,7 @@ public void resolving_translateErrorLds() {
Status error = errorCaptor.getValue();
assertThat(error.getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(error.getDescription()).isEqualTo("Unable to load LDS " + AUTHORITY
+ ". xDS server returned: NOT_FOUND: server unreachable.");
+ ". xDS server returned: NOT_FOUND: server unreachable");
assertThat(error.getCause()).isNull();
}

Expand All @@ -458,11 +458,11 @@ public void resolving_encounterErrorLdsAndRdsWatchers() {
Status error = errorCaptor.getAllValues().get(0);
assertThat(error.getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(error.getDescription()).isEqualTo("Unable to load LDS " + AUTHORITY
+ ". xDS server returned: UNAVAILABLE: server unreachable.");
+ ". xDS server returned: UNAVAILABLE: server unreachable");
error = errorCaptor.getAllValues().get(1);
assertThat(error.getCode()).isEqualTo(Code.UNAVAILABLE);
assertThat(error.getDescription()).isEqualTo("Unable to load RDS " + RDS_RESOURCE_NAME
+ ". xDS server returned: UNAVAILABLE: server unreachable.");
+ ". xDS server returned: UNAVAILABLE: server unreachable");
}

@Test
Expand Down

0 comments on commit 6844f06

Please sign in to comment.