Skip to content

Commit 058769c

Browse files
qa/cephfs: separate the tests for "ceph fs volume create" cmd
Signed-off-by: Rishabh Dave <[email protected]>
1 parent e794a19 commit 058769c

File tree

2 files changed

+32
-26
lines changed

2 files changed

+32
-26
lines changed

qa/suites/fs/volumes/tasks/volumes/test/basic.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ tasks:
33
fail_on_skip: false
44
modules:
55
- tasks.cephfs.test_volumes.TestVolumes
6+
- tasks.cephfs.test_volumes.TestVolumeCreate
67
- tasks.cephfs.test_volumes.TestSubvolumeGroups
78
- tasks.cephfs.test_volumes.TestSubvolumes
89
- tasks.cephfs.test_subvolume

qa/tasks/cephfs/test_volumes.py

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -454,32 +454,6 @@ def tearDown(self):
454454

455455
class TestVolumes(TestVolumesHelper):
456456
"""Tests for FS volume operations."""
457-
def test_volume_create(self):
458-
"""
459-
That the volume can be created and then cleans up
460-
"""
461-
volname = self._gen_vol_name()
462-
self._fs_cmd("volume", "create", volname)
463-
volumels = json.loads(self._fs_cmd("volume", "ls"))
464-
465-
if not (volname in ([volume['name'] for volume in volumels])):
466-
raise RuntimeError("Error creating volume '{0}'".format(volname))
467-
468-
# check that the pools were created with the correct config
469-
pool_details = json.loads(self._raw_cmd("osd", "pool", "ls", "detail", "--format=json"))
470-
pool_flags = {}
471-
for pool in pool_details:
472-
pool_flags[pool["pool_id"]] = pool["flags_names"].split(",")
473-
474-
volume_details = json.loads(self._fs_cmd("get", volname, "--format=json"))
475-
for data_pool_id in volume_details['mdsmap']['data_pools']:
476-
self.assertIn("bulk", pool_flags[data_pool_id])
477-
meta_pool_id = volume_details['mdsmap']['metadata_pool']
478-
self.assertNotIn("bulk", pool_flags[meta_pool_id])
479-
480-
# clean up
481-
self._fs_cmd("volume", "rm", volname, "--yes-i-really-mean-it")
482-
483457
def test_volume_ls(self):
484458
"""
485459
That the existing and the newly created volumes can be listed and
@@ -678,6 +652,37 @@ def test_volume_info_with_human_readable_flag_without_subvolumegroup(self):
678652
" of subvolumegroup")
679653

680654

655+
class TestVolumeCreate(TestVolumesHelper):
656+
'''
657+
Contains test for "ceph fs volume create" command.
658+
'''
659+
660+
def test_volume_create(self):
661+
"""
662+
That the volume can be created and then cleans up
663+
"""
664+
volname = self._gen_vol_name()
665+
self._fs_cmd("volume", "create", volname)
666+
volumels = json.loads(self._fs_cmd("volume", "ls"))
667+
668+
if not (volname in ([volume['name'] for volume in volumels])):
669+
raise RuntimeError("Error creating volume '{0}'".format(volname))
670+
671+
# check that the pools were created with the correct config
672+
pool_details = json.loads(self._raw_cmd("osd", "pool", "ls", "detail", "--format=json"))
673+
pool_flags = {}
674+
for pool in pool_details:
675+
pool_flags[pool["pool_id"]] = pool["flags_names"].split(",")
676+
677+
volume_details = json.loads(self._fs_cmd("get", volname, "--format=json"))
678+
for data_pool_id in volume_details['mdsmap']['data_pools']:
679+
self.assertIn("bulk", pool_flags[data_pool_id])
680+
meta_pool_id = volume_details['mdsmap']['metadata_pool']
681+
self.assertNotIn("bulk", pool_flags[meta_pool_id])
682+
683+
# clean up
684+
self._fs_cmd("volume", "rm", volname, "--yes-i-really-mean-it")
685+
681686
class TestRenameCmd(TestVolumesHelper):
682687

683688
def test_volume_rename(self):

0 commit comments

Comments
 (0)