summaryrefslogtreecommitdiffstats
path: root/tests/functional/bvt/test_cvt.py
diff options
context:
space:
mode:
authorShwethaHP <spandura@redhat.com>2017-12-11 17:12:33 +0530
committerShwethaHP <spandura@redhat.com>2017-12-13 03:17:22 +0530
commitfe9a239bf4b3b3569553d18ae33b052679b51357 (patch)
tree2a6a98120f91c03ca590b925523bf36ec03baf14 /tests/functional/bvt/test_cvt.py
parent2aa9168752032c67d3dcc9ec9d824abccc877b2d (diff)
Modifying gluster_base_class to have static methods for :
1. setup_volume 2. mount_volume 3. setup_volume_and_mount 4. cleanup_volume 5. unmount_volume 6. unmount_and_cleanup_volume These are added as static methods to give the test developer the flexibility to call the setup/cleanup's or any other function from any where in the testclass which inherits GlusterBaseClass Also, this will remove the need for GlusterVolumeBaseClass and hence removing the hardcoding of creattion of volume, mouting in setUpClass of GlusterVolumeBaseClass. This will also help in writing new baseclasses for example: Block which can have class funcitons specific to block and inherit all the functions from GlusterBaseClass Change-Id: I3f0709af75e5bb242d265d04ada3a747c155211d Signed-off-by: ShwethaHP <spandura@redhat.com>
Diffstat (limited to 'tests/functional/bvt/test_cvt.py')
-rw-r--r--tests/functional/bvt/test_cvt.py66
1 files changed, 44 insertions, 22 deletions
diff --git a/tests/functional/bvt/test_cvt.py b/tests/functional/bvt/test_cvt.py
index ff6d3f2ec..2306c4c7e 100644
--- a/tests/functional/bvt/test_cvt.py
+++ b/tests/functional/bvt/test_cvt.py
@@ -34,8 +34,7 @@
import time
import pytest
from glusto.core import Glusto as g
-from glustolibs.gluster.gluster_base_class import (GlusterVolumeBaseClass,
- runs_on)
+from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on)
from glustolibs.gluster.volume_libs import enable_and_validate_volume_options
from glustolibs.gluster.volume_libs import (
verify_all_process_of_volume_are_online)
@@ -57,31 +56,35 @@ from glustolibs.gluster.quota_ops import (enable_quota, disable_quota,
from glustolibs.gluster.snap_ops import (snap_create, get_snap_list,
snap_activate, snap_deactivate)
from glustolibs.misc.misc_libs import upload_scripts
-from glustolibs.io.utils import (validate_io_procs, log_mounts_info,
+from glustolibs.io.utils import (validate_io_procs,
list_all_files_and_dirs_mounts,
view_snaps_from_mount,
wait_for_io_to_complete)
from glustolibs.gluster.exceptions import ExecutionError
-class GlusterBasicFeaturesSanityBaseClass(GlusterVolumeBaseClass):
+class GlusterBasicFeaturesSanityBaseClass(GlusterBaseClass):
""" BaseClass for all the gluster basic features sanity tests. """
@classmethod
def setUpClass(cls):
- """Setup Volume, Create Mounts and upload the necessary scripts to run
- tests.
+ """Upload the necessary scripts to run tests.
"""
- # Sets up volume, mounts
- GlusterVolumeBaseClass.setUpClass.im_func(cls)
+ # Calling GlusterBaseClass setUpClass
+ GlusterBaseClass.setUpClass.im_func(cls)
# Upload io scripts for running IO on mounts
+ g.log.info("Upload io scripts to clients %s for running IO on "
+ "mounts", cls.clients)
script_local_path = ("/usr/share/glustolibs/io/scripts/"
"file_dir_ops.py")
cls.script_upload_path = ("/usr/share/glustolibs/io/scripts/"
"file_dir_ops.py")
ret = upload_scripts(cls.clients, script_local_path)
if not ret:
- raise ExecutionError("Failed to upload IO scripts")
+ raise ExecutionError("Failed to upload IO scripts to clients %s",
+ cls.clients)
+ g.log.info("Successfully uploaded IO scripts to clients %s",
+ cls.clients)
cls.counter = 1
"""int: Value of counter is used for dirname-start-num argument for
@@ -99,16 +102,27 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterVolumeBaseClass):
"""
def setUp(self):
- """setUp starts the io from all the mounts.
- IO creates deep dirs and files.
"""
- # Calling BaseClass setUp
- GlusterVolumeBaseClass.setUp.im_func(self)
+ - Setup Volume and Mount Volume
+ - setUp starts the io from all the mounts.
+ - IO creates deep dirs and files.
+ """
+ # Calling GlusterBaseClass setUp
+ GlusterBaseClass.setUp.im_func(self)
+
+ # Setup Volume and Mount Volume
+ g.log.info("Starting to Setup Volume and Mount Volume")
+ ret = self.setup_volume_and_mount_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Setup_Volume and Mount_Volume")
+ g.log.info("Successful in Setup Volume and Mount Volume")
# Start IO on mounts
g.log.info("Starting IO on all mounts...")
self.all_mounts_procs = []
for mount_obj in self.mounts:
+ g.log.info("Starting IO on %s:%s", mount_obj.client_system,
+ mount_obj.mountpoint)
cmd = ("python %s create_deep_dirs_with_files "
"--dirname-start-num %d "
"--dir-depth 2 "
@@ -130,6 +144,8 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterVolumeBaseClass):
def tearDown(self):
"""If test method failed before validating IO, tearDown waits for the
IO's to complete and checks for the IO exit status
+
+ Unmount Volume and Cleanup Volume
"""
# Wait for IO to complete if io validation is not executed in the
# test method
@@ -140,17 +156,23 @@ class GlusterBasicFeaturesSanityBaseClass(GlusterVolumeBaseClass):
if not ret:
raise ExecutionError("IO failed on some of the clients")
g.log.info("IO is successful on all mounts")
- GlusterVolumeBaseClass.tearDown.im_func(self)
- @classmethod
- def tearDownClass(cls):
- """Cleanup data from mount and cleanup volume.
- """
- # Log Mounts info
- g.log.info("Log mounts info")
- log_mounts_info(cls.mounts)
+ # List all files and dirs created
+ g.log.info("List all files and directories:")
+ ret = list_all_files_and_dirs_mounts(self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to list all files and dirs")
+ g.log.info("Listing all files and directories is successful")
+
+ # Unmount Volume and Cleanup Volume
+ g.log.info("Starting to Unmount Volume and Cleanup Volume")
+ ret = self.unmount_volume_and_cleanup_volume(mounts=self.mounts)
+ if not ret:
+ raise ExecutionError("Failed to Unmount Volume and Cleanup Volume")
+ g.log.info("Successful in Unmount Volume and Cleanup Volume")
- GlusterVolumeBaseClass.tearDownClass.im_func(cls)
+ # Calling GlusterBaseClass tearDown
+ GlusterBaseClass.tearDown.im_func(self)
@runs_on([['replicated', 'distributed', 'distributed-replicated',