mirror of
https://github.com/google/nomulus
synced 2026-07-25 01:22:52 +00: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:
@@ -73,19 +73,22 @@ public class EppCommitLogsTest extends ShardableTestCase {
|
||||
SessionMetadata sessionMetadata = new HttpSessionMetadata(new FakeHttpSession());
|
||||
sessionMetadata.setClientId("TheRegistrar");
|
||||
DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, TmchCaMode.PILOT))
|
||||
.fakesAndMocksModule(
|
||||
FakesAndMocksModule.create(
|
||||
clock, TmchCaMode.PILOT, EppMetric.builderForRequest("request-id-1", clock)))
|
||||
.build()
|
||||
.startRequest()
|
||||
.flowComponentBuilder()
|
||||
.flowModule(new FlowModule.Builder()
|
||||
.setSessionMetadata(sessionMetadata)
|
||||
.setCredentials(new PasswordOnlyTransportCredentials())
|
||||
.setEppRequestSource(EppRequestSource.UNIT_TEST)
|
||||
.setIsDryRun(false)
|
||||
.setIsSuperuser(false)
|
||||
.setInputXmlBytes(eppLoader.getEppXml().getBytes(UTF_8))
|
||||
.setEppInput(eppLoader.getEpp())
|
||||
.build())
|
||||
.flowModule(
|
||||
new FlowModule.Builder()
|
||||
.setSessionMetadata(sessionMetadata)
|
||||
.setCredentials(new PasswordOnlyTransportCredentials())
|
||||
.setEppRequestSource(EppRequestSource.UNIT_TEST)
|
||||
.setIsDryRun(false)
|
||||
.setIsSuperuser(false)
|
||||
.setInputXmlBytes(eppLoader.getEppXml().getBytes(UTF_8))
|
||||
.setEppInput(eppLoader.getEpp())
|
||||
.build())
|
||||
.build()
|
||||
.flowRunner()
|
||||
.run(EppMetric.builder());
|
||||
|
||||
Reference in New Issue
Block a user