xds: Avoid default locale and reset()

Found via linter
This commit is contained in:
Eric Anderson 2023-05-05 14:34:55 -07:00
parent 22366891de
commit 180b3e9092
2 changed files with 4 additions and 3 deletions

View File

@ -165,7 +165,8 @@ final class RoutingUtils {
} else if (pathMatcher.prefix() != null) {
return pathMatcher.caseSensitive()
? fullMethodName.startsWith(pathMatcher.prefix())
: fullMethodName.toLowerCase().startsWith(pathMatcher.prefix().toLowerCase());
: fullMethodName.toLowerCase(Locale.US).startsWith(
pathMatcher.prefix().toLowerCase(Locale.US));
}
return pathMatcher.regEx().matches(fullMethodName);
}

View File

@ -19,6 +19,7 @@ package io.grpc.xds.orca;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@ -115,7 +116,6 @@ public class OrcaServiceImplTest {
}
@Test
@SuppressWarnings("unchecked")
public void testReportingLifeCycle_serverShutdown() {
ClientCall<OrcaLoadReportRequest, OrcaLoadReport> call = channel.newCall(
OpenRcaServiceGrpc.getStreamCoreMetricsMethod(), CallOptions.DEFAULT);
@ -128,7 +128,7 @@ public class OrcaServiceImplTest {
OrcaLoadReport expect = OrcaLoadReport.newBuilder().putUtilization("buffer", 0.2).build();
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(1);
verify(listener).onMessage(eq(expect));
reset(listener);
verify(listener, never()).onClose(any(), any());
oobServer.shutdownNow();
assertThat(fakeClock.forwardTime(1, TimeUnit.SECONDS)).isEqualTo(0);
assertThat(((OrcaServiceImpl)orcaServiceImpl).clientCount.get()).isEqualTo(0);