Skip to content

Commit

Permalink
ceph-volume: add tests for reduce_vg()
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamad Gebai <mgebai@suse.com>
(cherry picked from commit 1f07776)
  • Loading branch information
mogeb committed Apr 25, 2019
1 parent 016e46f commit 8325281
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/ceph-volume/ceph_volume/tests/api/test_lvm.py
Expand Up @@ -618,6 +618,30 @@ def test_uses_multiple_devices(self, monkeypatch, fake_run):
assert fake_run.calls[0]['args'][0] == expected


class TestReduceVG(object):

def setup(self):
self.foo_volume = api.VolumeGroup(vg_name='foo', lv_tags='')

def test_uses_single_device_in_list(self, monkeypatch, fake_run):
monkeypatch.setattr(api, 'get_vg', lambda **kw: True)
api.reduce_vg(self.foo_volume, ['/dev/sda'])
expected = ['vgreduce', '--force', '--yes', 'foo', '/dev/sda']
assert fake_run.calls[0]['args'][0] == expected

def test_uses_single_device(self, monkeypatch, fake_run):
monkeypatch.setattr(api, 'get_vg', lambda **kw: True)
api.reduce_vg(self.foo_volume, '/dev/sda')
expected = ['vgreduce', '--force', '--yes', 'foo', '/dev/sda']
assert fake_run.calls[0]['args'][0] == expected

def test_uses_multiple_devices(self, monkeypatch, fake_run):
monkeypatch.setattr(api, 'get_vg', lambda **kw: True)
api.reduce_vg(self.foo_volume, ['/dev/sda', '/dev/sdb'])
expected = ['vgreduce', '--force', '--yes', 'foo', '/dev/sda', '/dev/sdb']
assert fake_run.calls[0]['args'][0] == expected


class TestCreateVG(object):

def setup(self):
Expand Down

0 comments on commit 8325281

Please sign in to comment.