Beispiel #1
0
    def test_stop(self):
        unit_name = 'testing'
        runr = runner.Runner(unit_name)
        runr.stop()

        expected = (unit_name, )
        meth, args, kwargs = self.svdsm.__calls__[-1]
        self.assertEqual(meth, 'systemctl_stop')
        self.assertEqual(kwargs, {})
        self.assertEqual(args[-len(expected):], expected)
Beispiel #2
0
    def test_single_service(self):
        VM_UUID = 'd7a0005e-ee05-4e61-9fbe-d2e93d59327c'

        def fake_output(prefix):
            tmpl = conttestlib.read_test_data('systemctl_vdsm_service.txt')
            return tmpl % VM_UUID

        with MonkeyPatchScope([(command, 'systemctl_list', fake_output)]):
            runr = runner.Runner('testing')
            conts = list(runr.get_all())
            self.assertEqual(conts, [VM_UUID])
Beispiel #3
0
    def test_run_default_conf(self):
        unit_name = 'testing'
        runr = runner.Runner(unit_name)
        cmd = (
            '/bin/sleep',
            '42m',
        )
        runr.start(*cmd)
        self.assertTrue(runr.running)

        meth, args, kwargs = self.svdsm.__calls__[-1]
        self.assertEqual(meth, 'systemd_run')
        self.assertEqual(kwargs, {})
        self.assertEqual(args[-len(cmd):], cmd)
Beispiel #4
0
 def test_created_not_running(self):
     runr = runner.Runner('testing')
     self.assertFalse(runr.running)
Beispiel #5
0
 def test_no_output(self):
     runr = runner.Runner('testing')
     conts = list(runr.get_all())
     self.assertEqual(conts, [])