Add RDAP metrics for non-search endpoints

This CL uses the previously-defined RDAP metrics class to record basic metrics
for all RDAP endpoints, and handles testing of non-search endpoints. Searches
are more complicated, and will be handled in future CLs.

The default wildcard type is now INVALID rather than NO_WILDCARD.

A change to getMatchingResources() (adding an additional parameter) is also included in this CL, as it was needed to set the incompleteness warning type correctly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175719265
This commit is contained in:
mountford 2017-11-14 12:36:06 -08:00 committed by jianglai
parent 0ffd3553c3
commit 358fe68f09
14 changed files with 288 additions and 31 deletions

View file

@ -38,6 +38,7 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.host.HostResource;
import google.registry.model.ofy.Ofy;
import google.registry.model.registrar.Registrar;
import google.registry.request.Action;
import google.registry.request.auth.AuthLevel;
import google.registry.request.auth.AuthResult;
import google.registry.request.auth.UserAuthInfo;
@ -73,6 +74,7 @@ public class RdapNameserverSearchActionTest {
private final UserAuthInfo userAuthInfo = UserAuthInfo.create(user, false);
private final UserAuthInfo adminUserAuthInfo = UserAuthInfo.create(user, true);
private final RdapNameserverSearchAction action = new RdapNameserverSearchAction();
private final RdapMetrics rdapMetrics = mock(RdapMetrics.class);
private DomainResource domainCatLol;
private HostResource hostNs1CatLol;
@ -144,6 +146,7 @@ public class RdapNameserverSearchActionTest {
action.fullServletPath = "https://example.tld/rdap";
action.requestPath = RdapNameserverSearchAction.PATH;
action.request = request;
action.requestMethod = Action.Method.GET;
action.response = response;
action.rdapJsonFormatter = RdapTestHelper.getTestRdapJsonFormatter();
action.rdapResultSetMaxSize = 4;
@ -154,6 +157,7 @@ public class RdapNameserverSearchActionTest {
action.includeDeletedParam = Optional.empty();
action.authResult = AuthResult.create(AuthLevel.USER, userAuthInfo);
action.sessionUtils = sessionUtils;
action.rdapMetrics = rdapMetrics;
}
private Object generateExpectedJson(String expectedOutputFile) {