mirror of
https://github.com/google/nomulus.git
synced 2025-07-11 21:48:18 +02:00
Correctly set clientId on EPP metrics in LoginFlow
This wasn't being recorded correctly because the clientId is only set in LoginFlow after the flow succeeds, whereas we were previously logging the clientId before executing the flow. This adds special handling for LoginFlow. Note that we only set the metric label to the clientId for valid registrar logins, to ensure that metric cardinality doesn't grow unbounded (as it might if we used every arbitrary string passed in as an attempted login). This also refactors creation and handling of FakesAndMocksModule so as to be able to make test assertions about EPP metrics from integration flow tests. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=154048280
This commit is contained in:
parent
7dc3ddfc14
commit
c1643fa3cd
7 changed files with 98 additions and 35 deletions
40
javatests/google/registry/flows/EppLifecycleLoginTest.java
Normal file
40
javatests/google/registry/flows/EppLifecycleLoginTest.java
Normal file
|
@ -0,0 +1,40 @@
|
|||
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.flows;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
/** Tests for login lifecycle. */
|
||||
@RunWith(JUnit4.class)
|
||||
public class EppLifecycleLoginTest extends EppTestCase {
|
||||
|
||||
@Rule
|
||||
public final AppEngineRule appEngine =
|
||||
AppEngineRule.builder().withDatastore().withTaskQueue().build();
|
||||
|
||||
@Test
|
||||
public void testLoginAndLogout_recordClientIdInEppMetric() throws Exception {
|
||||
assertCommandAndResponse("login_valid.xml", "login_response.xml");
|
||||
assertThat(getRecordedEppMetric().getClientId()).hasValue("NewRegistrar");
|
||||
assertCommandAndResponse("logout.xml", "logout_response.xml");
|
||||
assertThat(getRecordedEppMetric().getClientId()).hasValue("NewRegistrar");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue