diff options
Diffstat (limited to 'tests/functional/nfs_ganesha/test_nfs_ganesha_run_io_multiple_clients.py')
-rw-r--r-- | tests/functional/nfs_ganesha/test_nfs_ganesha_run_io_multiple_clients.py | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/tests/functional/nfs_ganesha/test_nfs_ganesha_run_io_multiple_clients.py b/tests/functional/nfs_ganesha/test_nfs_ganesha_run_io_multiple_clients.py index b6a1a4391..0f9c17156 100644 --- a/tests/functional/nfs_ganesha/test_nfs_ganesha_run_io_multiple_clients.py +++ b/tests/functional/nfs_ganesha/test_nfs_ganesha_run_io_multiple_clients.py @@ -20,9 +20,8 @@ """ from glusto.core import Glusto as g -from glustolibs.gluster.gluster_base_class import runs_on +from glustolibs.gluster.gluster_base_class import runs_on, GlusterBaseClass from glustolibs.gluster.exceptions import ExecutionError -from glustolibs.gluster.nfs_ganesha_libs import NfsGaneshaVolumeBaseClass from glustolibs.gluster.lib_utils import install_epel from glustolibs.io.utils import run_bonnie, run_fio, run_mixed_io @@ -30,19 +29,37 @@ from glustolibs.io.utils import run_bonnie, run_fio, run_mixed_io @runs_on([['replicated', 'distributed', 'distributed-replicated', 'dispersed', 'distributed-dispersed'], ['nfs']]) -class TestNfsGaneshaWithDifferentIOPatterns(NfsGaneshaVolumeBaseClass): +class TestNfsGaneshaWithDifferentIOPatterns(GlusterBaseClass): """ Tests Nfs Ganesha stability by running different IO Patterns """ @classmethod def setUpClass(cls): - NfsGaneshaVolumeBaseClass.setUpClass.im_func(cls) + """ + Setup nfs-ganesha if not exists. + """ + cls.get_super_method(cls, 'setUpClass')() + + # Install epel if not install_epel(cls.clients): raise ExecutionError("Failed to install epel") - def test_run_bonnie_from_multiple_clients(self): + def setUp(self): + """ + Setup and mount volume + """ + g.log.info("Starting to setup and mount volume %s", self.volname) + ret = self.setup_volume_and_mount_volume(mounts=self.mounts) + if not ret: + raise ExecutionError("Failed to setup and mount volume %s" + % self.volname) + g.log.info("Successful in setup and mount volume %s", self.volname) + def test_run_bonnie_from_multiple_clients(self): + """ + Run bonnie test + """ directory_to_run = [] for mount in self.mounts: directory_to_run.append(mount.mountpoint) @@ -56,7 +73,9 @@ class TestNfsGaneshaWithDifferentIOPatterns(NfsGaneshaVolumeBaseClass): _, _, _ = g.run(self.servers[0], "pcs status") def test_run_fio_from_multiple_clients(self): - + """ + Run fio + """ directory_to_run = [] for mount in self.mounts: directory_to_run.append(mount.mountpoint) @@ -70,7 +89,9 @@ class TestNfsGaneshaWithDifferentIOPatterns(NfsGaneshaVolumeBaseClass): _, _, _ = g.run(self.servers[0], "pcs status") def test_run_mixed_io_from_multiple_clients(self): - + """ + Run multiple IOs + """ directory_to_run = [] for mount in self.mounts: directory_to_run.append(mount.mountpoint) @@ -79,8 +100,24 @@ class TestNfsGaneshaWithDifferentIOPatterns(NfsGaneshaVolumeBaseClass): # TODO: parametrizing io_tools and get the inputs from user. io_tools = ['bonnie', 'fio'] ret = run_mixed_io(self.clients, io_tools, directory_to_run) - self.assertTrue(ret, ("fio test failed while running tests on %s" - % self.clients)) + self.assertTrue(ret, "IO failed on one or more clients.") # pcs status output _, _, _ = g.run(self.servers[0], "pcs status") + + def tearDown(self): + """ + Unmount and cleanup volume + """ + # Unmount volume + ret = self.unmount_volume(self.mounts) + if ret: + g.log.info("Successfully unmounted the volume") + else: + g.log.error("Failed to unmount volume") + + # Cleanup volume + ret = self.cleanup_volume() + if not ret: + raise ExecutionError("Failed to cleanup volume") + g.log.info("Cleanup volume %s completed successfully", self.volname) |