def test_allocate_when_unavailable_must_raise(self): h = Host(0, "n") h._set_unavailable() with pytest.raises(RuntimeError) as excinfo: h._allocate("job") assert "unavailable" in str(excinfo.value)
def test_start_computing_when_unavailable_must_raise(self): p1 = PowerState(1, PowerStateType.COMPUTATION, 10, 100) h = Host(0, "n", pstates=[p1]) h._allocate("job") h._set_unavailable() with pytest.raises(SystemError) as excinfo: h._start_computing() assert "Unavailable" in str(excinfo.value)
def test_set_unavailable_must_return_to_last_state(self): h = Host(0, "n") h._allocate("job") h._start_computing() h._set_unavailable() assert h.is_unavailable and not h.is_computing h._set_available() assert h.is_computing and not h.is_unavailable
def test_set_unavailable_when_already_allocated_must_not_raise(self): h = Host(0, "n") h._allocate("job") h._set_unavailable() assert h.is_unavailable and h.jobs
def test_set_available(self): h = Host(0, "n") h._set_unavailable() h._set_available() assert not h.is_unavailable