@Test public void shouldNotAssignWorkToDeniedAgent() throws Exception { AgentConfig deniedAgentConfig = AgentMother.localAgent(); deniedAgentConfig.disable(); Work assignedWork = buildAssignmentService.assignWorkToAgent(agent(deniedAgentConfig)); assertThat(assignedWork, instanceOf(DeniedAgentWork.class)); }
@Test public void shouldNotAssignDeniedAgentWorkToAgentsRegisteredInAgentRemoteHandler() { AgentConfig agentConfig = AgentMother.remoteAgent(); agentConfig.disable(); configHelper.addAgent(agentConfig); fixture.createPipelineWithFirstStageScheduled(); AgentRuntimeInfo info = AgentRuntimeInfo.fromServer(agentConfig, true, "location", 1000000l, "OS"); info.setCookie("cookie"); agentRemoteHandler.process(agent, new Message(Action.ping, info)); buildAssignmentService.onTimer(); assertThat(agent.messages.size(), is(0)); }