@Test(expected = MaxPendingAgentsLimitReachedException.class) public void registerShouldErrorOutIfMaxPendingAgentsLimitIsReached() { AgentConfig agentConfig = new AgentConfig("uuid2", "CCeDev01", "10.18.5.1"); AgentInstances agentInstances = new AgentInstances(null, systemEnvironment, AgentInstanceMother.pending()); when(systemEnvironment.get(SystemEnvironment.MAX_PENDING_AGENTS_ALLOWED)).thenReturn(1); agentInstances.register( AgentRuntimeInfo.fromServer(agentConfig, false, "/var/lib", 0L, "linux", false)); }
@Before public void setUp() throws Exception { initMocks(this); virtual = AgentInstanceMother.virtual(); idle = AgentInstanceMother.idle(new Date(), "CCeDev01", systemEnvironment); AgentInstanceMother.updateOS(idle, "linux"); building = AgentInstanceMother.building("buildLocator", systemEnvironment); AgentInstanceMother.updateOS(building, "macOS"); pending = AgentInstanceMother.pending(systemEnvironment); AgentInstanceMother.updateOS(pending, "windows"); disabled = AgentInstanceMother.disabled("10.18.5.4", systemEnvironment); local = AgentInstanceMother.local(systemEnvironment); }