Search in sources :

Example 6 with SchedulingPerformanceLogger

use of com.thoughtworks.go.server.perf.SchedulingPerformanceLogger in project gocd by gocd.

the class ScheduleServiceCachedIntegrationTest method shouldUpdateResultOfStageWhenJobCompletesOnTransactionCommitOnly.

@Test
public void shouldUpdateResultOfStageWhenJobCompletesOnTransactionCommitOnly() throws Exception {
    StageService stageService = mock(StageService.class);
    StageDao stageDao = mock(StageDao.class);
    SchedulingPerformanceLogger schedulingPerformanceLogger = mock(SchedulingPerformanceLogger.class);
    ScheduleService service = new ScheduleService(goConfigService, pipelineService, stageService, schedulingChecker, pipelineScheduledTopic, pipelineDao, stageDao, stageOrderService, securityService, pipelineScheduleQueue, jobInstanceService, jobInstanceDao, agentAssignment, environmentConfigService, pipelineLockService, serverHealthService, transactionTemplate, agentService, synchronizationManager, null, null, null, null, schedulingPerformanceLogger, null);
    Pipeline assigned = preCondition.createPipelineWithFirstStageAssigned();
    Stage stage = assigned.findStage(preCondition.devStage);
    when(stageService.stageById(stage.getId())).thenThrow(new RuntimeException("find fails"));
    try {
        service.updateJobStatus(stage.getFirstJob().getIdentifier(), JobState.Completed);
        fail("should have failed because stage lookup bombed");
    } catch (Exception e) {
    //ignore
    }
    verify(stageDao, never()).clearCachedAllStages(stage.getIdentifier().getPipelineName(), stage.getIdentifier().getPipelineCounter(), stage.getName());
}
Also used : StageDao(com.thoughtworks.go.server.dao.StageDao) Stage(com.thoughtworks.go.domain.Stage) SchedulingPerformanceLogger(com.thoughtworks.go.server.perf.SchedulingPerformanceLogger) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Example 7 with SchedulingPerformanceLogger

use of com.thoughtworks.go.server.perf.SchedulingPerformanceLogger in project gocd by gocd.

the class ScheduleServiceRescheduleHungJobsTest method setUp.

@Before
public void setUp() {
    agentService = mock(AgentService.class);
    jobInstanceService = mock(JobInstanceService.class);
    consoleActivityMonitor = mock(ConsoleActivityMonitor.class);
    SchedulingPerformanceLogger schedulingPerformanceLogger = mock(SchedulingPerformanceLogger.class);
    scheduleService = new ScheduleService(null, null, null, null, null, null, null, null, null, null, jobInstanceService, null, null, null, null, null, null, agentService, null, null, consoleActivityMonitor, null, null, schedulingPerformanceLogger, null);
}
Also used : SchedulingPerformanceLogger(com.thoughtworks.go.server.perf.SchedulingPerformanceLogger) Before(org.junit.Before)

Aggregations

SchedulingPerformanceLogger (com.thoughtworks.go.server.perf.SchedulingPerformanceLogger)7 Before (org.junit.Before)4 Pipeline (com.thoughtworks.go.domain.Pipeline)3 Stage (com.thoughtworks.go.domain.Stage)3 ServerHealthService (com.thoughtworks.go.serverhealth.ServerHealthService)3 Test (org.junit.Test)3 StageStatusListener (com.thoughtworks.go.server.domain.StageStatusListener)2 JobResultMessage (com.thoughtworks.go.server.messaging.JobResultMessage)2 JobResultTopic (com.thoughtworks.go.server.messaging.JobResultTopic)2 StageStatusMessage (com.thoughtworks.go.server.messaging.StageStatusMessage)2 StageStatusTopic (com.thoughtworks.go.server.messaging.StageStatusTopic)2 TestTransactionSynchronizationManager (com.thoughtworks.go.server.transaction.TestTransactionSynchronizationManager)2 TestTransactionTemplate (com.thoughtworks.go.server.transaction.TestTransactionTemplate)2 TimeProvider (com.thoughtworks.go.util.TimeProvider)2 CannotScheduleException (com.thoughtworks.go.domain.CannotScheduleException)1 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)1 Localizer (com.thoughtworks.go.i18n.Localizer)1 GoUnauthorizedException (com.thoughtworks.go.server.GoUnauthorizedException)1 StageDao (com.thoughtworks.go.server.dao.StageDao)1 TransactionCallback (com.thoughtworks.go.server.transaction.TransactionCallback)1