mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 11:46:53 +00:00
Limit cardinality of HTTP methods in request metrics
This commit is contained in:
1 parent
0d42f37a5c
commit
070aa5f0cd
3 files changed
+32
-3
No files matched your search
+17
@@ -30,9 +30,12 @@ import org.glassfish.jersey.server.ExtendedUriInfo;
|
||||
import org.glassfish.jersey.uri.UriTemplate;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.whispersystems.textsecuregcm.storage.ClientReleaseManager;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
class MetricsHttpChannelListenerTest {
|
||||
|
||||
@@ -170,7 +173,21 @@ class MetricsHttpChannelListenerTest {
|
||||
} else {
|
||||
verifyNoInteractions(requestsByVersionCounter);
|
||||
}
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource
|
||||
void normalizeMethod(@Nullable final String originalMethod, final String expectedMethod) {
|
||||
assertEquals(expectedMethod, MetricsHttpChannelListener.normalizeMethod(originalMethod));
|
||||
}
|
||||
|
||||
private static List<Arguments> normalizeMethod() {
|
||||
return List.of(
|
||||
Arguments.arguments(null, "unknown"),
|
||||
Arguments.arguments("", "unknown"),
|
||||
Arguments.arguments("UNEXPECTED_METHOD", "unknown"),
|
||||
Arguments.arguments("GET", "GET"),
|
||||
Arguments.arguments("get", "get")
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user