Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 def test_set_available(self):
     h = Host(0, "n")
     h._set_unavailable()
     h._set_available()
     assert not h.is_unavailable