def test_check_instance_host_is_up_fails_if_not_up(self):
    self.mox.StubOutWithMock(db, 'service_get_by_compute_host')
    self.mox.StubOutWithMock(self.task.servicegroup_api, 'service_is_up')
    db.service_get_by_compute_host(self.context, 'host').AndReturn('service')
    self.task.servicegroup_api.service_is_up('service').AndReturn(False)
    self.mox.ReplayAll()
    self.assertRaises(exception.ComputeServiceUnavailable, self.task._check_host_is_up, 'host')
def test_check_instance_host_is_up_fails_if_not_up(self):
    self.mox.StubOutWithMock(db, 'service_get_by_compute_host')
    self.mox.StubOutWithMock(self.task.servicegroup_api, 'service_is_up')
    db.service_get_by_compute_host(self.context, 'host').AndReturn('service')
    self.task.servicegroup_api.service_is_up('service').AndReturn(False)
    self.mox.ReplayAll()
    self.assertRaises(exception.ComputeServiceUnavailable, self.task._check_host_is_up, 'host')