예제 #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)
예제 #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])
예제 #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)
예제 #4
0
 def test_created_not_running(self):
     runr = runner.Runner('testing')
     self.assertFalse(runr.running)
예제 #5
0
 def test_no_output(self):
     runr = runner.Runner('testing')
     conts = list(runr.get_all())
     self.assertEqual(conts, [])