Ejemplo n.º 1
0
    def test__waits_alt(self):
        blockdevice = factory.make_name('blockdevice')
        test = factory.make_name('test')
        device = factory.make_name('device')
        mock_sleep = self.patch(smartctl, 'sleep')
        mock_run_smartctl = self.patch(smartctl, 'run_smartctl')
        mock_run_smartctl.side_effect = (
            'Background %s Self test in progress' % test,
            'Background %s Self test in progress' % test,
            '',
        )

        smartctl.wait_smartctl_selftest(blockdevice, test, device)

        self.assertThat(
            mock_run_smartctl,
            MockCallsMatch(call(blockdevice, ['-c'], device),
                           call(blockdevice, ['--all'], device),
                           call(blockdevice, ['--all'], device)))
        self.assertThat(mock_sleep, MockCalledOnceWith(30))
Ejemplo n.º 2
0
    def test__waits(self):
        blockdevice = factory.make_name('blockdevice')
        test = factory.make_name('test')
        device = factory.make_name('device')
        mock_sleep = self.patch(smartctl, 'sleep')
        mock_run_smartctl = self.patch(smartctl, 'run_smartctl')
        mock_run_smartctl.side_effect = (
            'Self-test execution status: (42) Self-test routine in progress',
            '',
            '',
        )

        smartctl.wait_smartctl_selftest(blockdevice, test, device)

        self.assertThat(
            mock_run_smartctl,
            MockCallsMatch(call(blockdevice, ['-c'], device),
                           call(blockdevice, ['-c'], device),
                           call(blockdevice, ['--all'], device)))
        self.assertThat(mock_sleep, MockCalledOnceWith(30))
Ejemplo n.º 3
0
    def test_waits_alt(self):
        blockdevice = factory.make_name("blockdevice")
        test = factory.make_name("test")
        device = factory.make_name("device")
        mock_sleep = self.patch(smartctl, "sleep")
        mock_run_smartctl = self.patch(smartctl, "run_smartctl")
        mock_run_smartctl.side_effect = (
            "Background %s Self test in progress" % test,
            "Background %s Self test in progress" % test,
            "",
        )

        smartctl.wait_smartctl_selftest(blockdevice, test, device)

        self.assertThat(
            mock_run_smartctl,
            MockCallsMatch(
                call(blockdevice, ["-c"], device),
                call(blockdevice, ["--all"], device),
                call(blockdevice, ["--all"], device),
            ),
        )
        self.assertThat(mock_sleep, MockCalledOnceWith(30))
Ejemplo n.º 4
0
    def test_waits(self):
        blockdevice = factory.make_name("blockdevice")
        test = factory.make_name("test")
        device = factory.make_name("device")
        mock_sleep = self.patch(smartctl, "sleep")
        mock_run_smartctl = self.patch(smartctl, "run_smartctl")
        mock_run_smartctl.side_effect = (
            "Self-test execution status: (42) Self-test routine in progress",
            "",
            "",
        )

        smartctl.wait_smartctl_selftest(blockdevice, test, device)

        self.assertThat(
            mock_run_smartctl,
            MockCallsMatch(
                call(blockdevice, ["-c"], device),
                call(blockdevice, ["-c"], device),
                call(blockdevice, ["--all"], device),
            ),
        )
        self.assertThat(mock_sleep, MockCalledOnceWith(30))