Beispiel #1
0
 def test_get_volume_size(self, mock_execute):
     mock_execute.return_value = 123456789, None
     size = lvm.get_volume_size('/dev/foo')
     mock_execute.assert_has_calls([
         mock.call('blockdev', '--getsize64', '/dev/foo', run_as_root=True)
     ])
     self.assertEqual(123456789, size)
Beispiel #2
0
 def test_get_volume_size(self, mock_execute):
     mock_execute.return_value = 123456789, None
     size = lvm.get_volume_size('/dev/foo')
     mock_execute.assert_has_calls(
         [mock.call('blockdev', '--getsize64', '/dev/foo',
                    run_as_root=True)])
     self.assertEqual(123456789, size)
Beispiel #3
0
    def test_get_volume_size(self):
        executes = []

        def fake_execute(*cmd, **kwargs):
            executes.append(cmd)
            return 123456789, None

        expected_commands = [('blockdev', '--getsize64', '/dev/foo')]
        self.stubs.Set(utils, 'execute', fake_execute)
        size = lvm.get_volume_size('/dev/foo')
        self.assertEqual(expected_commands, executes)
        self.assertEqual(size, 123456789)
Beispiel #4
0
    def test_get_volume_size(self):
        executes = []

        def fake_execute(*cmd, **kwargs):
            executes.append(cmd)
            return 123456789, None

        expected_commands = [('blockdev', '--getsize64', '/dev/foo')]
        self.stub_out('nova.utils.execute', fake_execute)
        size = lvm.get_volume_size('/dev/foo')
        self.assertEqual(expected_commands, executes)
        self.assertEqual(123456789, size)
Beispiel #5
0
 def test_get_volume_size(self, mock_blockdev_size):
     mock_blockdev_size.return_value = '123456789', None
     size = lvm.get_volume_size('/dev/foo')
     self.assertEqual(123456789, size)