def test_update_target(self): '''Test update of the target of an service''' serv = Service('A') act = Action('start', 'fortoy[5-10]', '/bin/true') serv.add_action(act) serv.update_target('aury[1-12]^fortoy[3-6]') self.assertTrue(serv.target == NodeSet('aury[1-12]^fortoy[3-6]')) self.assertTrue(act.target == NodeSet('aury[1-12]^fortoy[3-6]'))
def test_run_skipped_with_error_deps(self): """Test run with ERROR dependencies for a SKIPPED service""" # Distant service with empty target: should be skipped svc = Service('test_service', target="tempnode[1-2]") action = Action('start', command='/bin/true') action.inherits_from(svc) svc.add_action(action) svc.update_target("tempnode[1-2]", 'DIF') # A simple dep dep = Service('DEP_A') dep.add_action(Action('start', command='/bin/false')) svc.add_dep(dep) svc.run('start') self.assertEqual(svc.eval_deps_status(), DEP_ERROR) self.assertEqual(dep.status, ERROR) self.assertEqual(svc.status, SKIPPED)