Search in sources :

Example 1 with PerformanceLogger

use of com.google.gerrit.server.logging.PerformanceLogger in project gerrit by GerritCodeReview.

the class TraceIT method performanceLoggingForRestCall.

@Test
public void performanceLoggingForRestCall() throws Exception {
    PerformanceLogger testPerformanceLogger = mock(PerformanceLogger.class);
    try (Registration registration = extensionRegistry.newRegistration().add(testPerformanceLogger)) {
        RestResponse response = adminRestSession.put("/projects/new10");
        assertThat(response.getStatusCode()).isEqualTo(SC_CREATED);
        verify(testPerformanceLogger, timeout(5000).atLeastOnce()).log(anyString(), anyLong(), any());
    }
}
Also used : PerformanceLogger(com.google.gerrit.server.logging.PerformanceLogger) Registration(com.google.gerrit.acceptance.ExtensionRegistry.Registration) RestResponse(com.google.gerrit.acceptance.RestResponse) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 2 with PerformanceLogger

use of com.google.gerrit.server.logging.PerformanceLogger in project gerrit by GerritCodeReview.

the class TraceIT method performanceLoggingForPush.

@Test
public void performanceLoggingForPush() throws Exception {
    PerformanceLogger testPerformanceLogger = mock(PerformanceLogger.class);
    try (Registration registration = extensionRegistry.newRegistration().add(testPerformanceLogger)) {
        PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);
        PushOneCommit.Result r = push.to("refs/heads/master");
        r.assertOkStatus();
        verify(testPerformanceLogger, timeout(5000).atLeastOnce()).log(anyString(), anyLong(), any());
    }
}
Also used : PerformanceLogger(com.google.gerrit.server.logging.PerformanceLogger) Registration(com.google.gerrit.acceptance.ExtensionRegistry.Registration) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 3 with PerformanceLogger

use of com.google.gerrit.server.logging.PerformanceLogger in project gerrit by GerritCodeReview.

the class TraceIT method noPerformanceLoggingIfDisabled.

@Test
@GerritConfig(name = "tracing.performanceLogging", value = "false")
public void noPerformanceLoggingIfDisabled() throws Exception {
    PerformanceLogger testPerformanceLogger = mock(PerformanceLogger.class);
    try (Registration registration = extensionRegistry.newRegistration().add(testPerformanceLogger)) {
        RestResponse response = adminRestSession.put("/projects/new11");
        assertThat(response.getStatusCode()).isEqualTo(SC_CREATED);
        PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo);
        PushOneCommit.Result r = push.to("refs/heads/master");
        r.assertOkStatus();
        verifyNoInteractions(testPerformanceLogger);
    }
}
Also used : PerformanceLogger(com.google.gerrit.server.logging.PerformanceLogger) Registration(com.google.gerrit.acceptance.ExtensionRegistry.Registration) RestResponse(com.google.gerrit.acceptance.RestResponse) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)3 Registration (com.google.gerrit.acceptance.ExtensionRegistry.Registration)3 PerformanceLogger (com.google.gerrit.server.logging.PerformanceLogger)3 Test (org.junit.Test)3 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)2 RestResponse (com.google.gerrit.acceptance.RestResponse)2 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)1