]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: fix tests after batch sizing was fixed
authorJan Fajerski <jfajerski@suse.com>
Thu, 12 Dec 2019 12:45:44 +0000 (13:45 +0100)
committerJan Fajerski <jfajerski@suse.com>
Thu, 27 Feb 2020 12:53:56 +0000 (13:53 +0100)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit 405112970ec62fca345d10040c1648b7e629d11a)

src/ceph-volume/ceph_volume/tests/api/test_lvm.py
src/ceph-volume/ceph_volume/tests/devices/lvm/strategies/test_bluestore.py
src/ceph-volume/ceph_volume/tests/devices/lvm/strategies/test_filestore.py

index a3b83a9e6bd16ee824d12ff12caa929a2b916111..43125471bac893e1c665aafa924cd907e91f2764 100644 (file)
@@ -43,12 +43,12 @@ class TestGetAPIVgs(object):
         assert api.get_api_vgs() == [{'vg_name': 'VolGroup00'}]
 
     def test_report_has_stuff_with_empty_attrs(self, monkeypatch):
-        report = ['  VolGroup00 ;;;;;;9g']
+        report = ['  VolGroup00 ;;;;;;4194304']
         monkeypatch.setattr(api.process, 'call', lambda x, **kw: (report, '', 0))
         result = api.get_api_vgs()[0]
         assert len(result.keys()) == 7
         assert result['vg_name'] == 'VolGroup00'
-        assert result['vg_free'] == '9g'
+        assert result['vg_extent_size'] == '4194304'
 
     def test_report_has_multiple_items(self, monkeypatch):
         report = ['   VolGroup00;;;;;;;', '    ceph_vg;;;;;;;']
@@ -373,59 +373,48 @@ class TestVolumeGroupFree(object):
 
 class TestCreateLVs(object):
 
+    def setup(self):
+        self.vg = api.VolumeGroup(vg_name='ceph',
+                                         vg_extent_size=1073741824,
+                                         vg_extent_count=99999999,
+                                         vg_free_count=999)
+
     def test_creates_correct_lv_number_from_parts(self, monkeypatch):
         monkeypatch.setattr('ceph_volume.api.lvm.create_lv', lambda *a, **kw: (a, kw))
-        vg = api.VolumeGroup(
-            vg_name='ceph', vg_free='1024g',
-            vg_size='99999999g', vg_free_count='999'
-        )
-        lvs = api.create_lvs(vg, parts=4)
+        lvs = api.create_lvs(self.vg, parts=4)
         assert len(lvs) == 4
 
     def test_suffixes_the_size_arg(self, monkeypatch):
         monkeypatch.setattr('ceph_volume.api.lvm.create_lv', lambda *a, **kw: (a, kw))
-        vg = api.VolumeGroup(
-            vg_name='ceph', vg_free='1024g',
-            vg_size='99999999g', vg_free_count='999'
-        )
-        lvs = api.create_lvs(vg, parts=4)
+        lvs = api.create_lvs(self.vg, parts=4)
         assert lvs[0][1]['extents'] == 249
 
     def test_only_uses_free_size(self, monkeypatch):
         monkeypatch.setattr('ceph_volume.api.lvm.create_lv', lambda *a, **kw: (a, kw))
-        vg = api.VolumeGroup(
-            vg_name='ceph', vg_free='1024g',
-            vg_size='99999999g', vg_free_count='1000'
-        )
+        vg = api.VolumeGroup(vg_name='ceph',
+                             vg_extent_size=1073741824,
+                             vg_extent_count=99999999,
+                             vg_free_count=1000)
         lvs = api.create_lvs(vg, parts=4)
         assert lvs[0][1]['extents'] == 250
 
     def test_null_tags_are_set_by_default(self, monkeypatch):
         monkeypatch.setattr('ceph_volume.api.lvm.create_lv', lambda *a, **kw: (a, kw))
-        vg = api.VolumeGroup(
-            vg_name='ceph', vg_free='1024g',
-            vg_size='99999999g', vg_free_count='999'
-        )
-        kwargs = api.create_lvs(vg, parts=4)[0][1]
+        kwargs = api.create_lvs(self.vg, parts=4)[0][1]
         assert list(kwargs['tags'].values()) == ['null', 'null', 'null', 'null']
 
     def test_fallback_to_one_part(self, monkeypatch):
         monkeypatch.setattr('ceph_volume.api.lvm.create_lv', lambda *a, **kw: (a, kw))
-        vg = api.VolumeGroup(
-            vg_name='ceph', vg_free='1024g',
-            vg_size='99999999g', vg_free_count='999'
-        )
-        lvs = api.create_lvs(vg)
+        lvs = api.create_lvs(self.vg)
         assert len(lvs) == 1
 
 
 class TestVolumeGroupSizing(object):
 
     def setup(self):
-        self.vg = api.VolumeGroup(
-            vg_name='ceph', vg_free='1024g',
-            vg_free_count='261129'
-        )
+        self.vg = api.VolumeGroup(vg_name='ceph',
+                                         vg_extent_size=1073741824,
+                                         vg_free_count=1024)
 
     def test_parts_and_size_errors(self):
         with pytest.raises(ValueError) as error:
@@ -460,8 +449,7 @@ class TestVolumeGroupSizing(object):
 
     def test_extents_are_halfed_rounded_down(self):
         result = self.vg.sizing(size=512)
-        # the real extents would've given 130564.5
-        assert result['extents'] == 130564
+        assert result['extents'] == 512
 
     def test_bit_less_size_rounds_down(self):
         result = self.vg.sizing(size=129)
index 2bfe8327db0b8cda5f7b8b38f240ee5b63c719c7..98e8aa13c157d2f431be4555cc2c59b3d33ea38b 100644 (file)
@@ -14,7 +14,7 @@ class TestSingleType(object):
         computed_osd = bluestore.SingleType.with_auto_devices(args, devices).computed['osds'][0]
         assert computed_osd['data']['percentage'] == 100
         assert computed_osd['data']['parts'] == 1
-        assert computed_osd['data']['human_readable_size'] == '5.66 GB'
+        assert computed_osd['data']['human_readable_size'] == '5.00 GB'
         assert computed_osd['data']['path'] == '/dev/sda'
 
     def test_sdd_device_is_large_enough(self, fakedevice, factory):
@@ -26,7 +26,7 @@ class TestSingleType(object):
         computed_osd = bluestore.SingleType.with_auto_devices(args, devices).computed['osds'][0]
         assert computed_osd['data']['percentage'] == 100
         assert computed_osd['data']['parts'] == 1
-        assert computed_osd['data']['human_readable_size'] == '5.66 GB'
+        assert computed_osd['data']['human_readable_size'] == '5.00 GB'
         assert computed_osd['data']['path'] == '/dev/sda'
 
     def test_device_cannot_have_many_osds_per_device(self, fakedevice, factory):
index bc9afb7068192651e4f318074094c2d9cd940724..710c09288b77aaa8468ebd4a2ba1f31522d86a02 100644 (file)
@@ -165,8 +165,9 @@ class TestMixedType(object):
         # when get_api_vgs() gets called, it will return this one VG
         stub_vgs([
             dict(
-                vg_free='7g', vg_name='fast', lv_name='foo',
-                lv_path='/dev/vg/foo', lv_tags="ceph.type=data"
+                vg_name='fast', lv_name='foo',
+                lv_path='/dev/vg/foo', lv_tags="ceph.type=data",
+                vg_extent_size=1024*1024*1024, vg_free_count=7
             )
         ])