@Test public void shouldNotAssignWorkToCanceledAgentsRegisteredInAgentRemoteHandler() { AgentConfig agentConfig = AgentMother.remoteAgent(); 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)); AgentInstance agentInstance = agentService.findAgentAndRefreshStatus(info.getUUId()); agentInstance.cancel(); buildAssignmentService.onTimer(); assertThat( "Should not assign work when agent status is Canceled", agent.messages.size(), is(0)); }