From c9ed3914657747baa27cbb8e0eb963133c79dd23 Mon Sep 17 00:00:00 2001 From: Sanoj Unnikrishnan Date: Fri, 8 Jun 2018 14:52:20 +0530 Subject: Quota: Fixing quota libs in glusto - added quota_libs.py with quota_validate library - Removed redundant function in quota_ops. - changed naming of quota_ops to be consistent and intutive w.r.t cli Change-Id: I4faf448ea308c9e04b548d6174d900fcf56978a5 Signed-off-by: Sanoj Unnikrishnan --- tests/functional/quota/list_path_values.py | 16 ++++++++-------- tests/functional/quota/test_negative_quota.py | 14 +++++++------- tests/functional/quota/test_non_existent_dir.py | 10 +++++----- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'tests/functional/quota') diff --git a/tests/functional/quota/list_path_values.py b/tests/functional/quota/list_path_values.py index 29dd167d7..5c9bf81d4 100644 --- a/tests/functional/quota/list_path_values.py +++ b/tests/functional/quota/list_path_values.py @@ -17,9 +17,9 @@ from glusto.core import Glusto as g from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) -from glustolibs.gluster.quota_ops import (enable_quota, - set_quota_limit_usage, - get_quota_list) +from glustolibs.gluster.quota_ops import (quota_enable, + quota_limit_usage, + quota_fetch_list) from glustolibs.gluster.exceptions import ExecutionError @@ -85,7 +85,7 @@ class QuotaListPathValues(GlusterBaseClass): # Enable Quota g.log.info("Enabling quota on the volume %s", self.volname) - ret, _, _ = enable_quota(self.mnode, self.volname) + ret, _, _ = quota_enable(self.mnode, self.volname) self.assertEqual(ret, 0, ("Failed to enable quota on the volume " "%s", self.volname)) g.log.info("Successfully enabled quota on the volume %s", self.volname) @@ -96,8 +96,8 @@ class QuotaListPathValues(GlusterBaseClass): # Set Quota limit on the root of the volume g.log.info("Set Quota Limit on the path %s of the volume %s", path, self.volname) - ret, _, _ = set_quota_limit_usage(self.mnode, self.volname, - path=path, limit="2GB") + ret, _, _ = quota_limit_usage(self.mnode, self.volname, + path=path, limit="2GB") self.assertEqual(ret, 0, ("Failed to set quota limit on path %s of " " the volume %s", path, self.volname)) g.log.info("Successfully set the Quota limit on %s of the volume " @@ -116,7 +116,7 @@ class QuotaListPathValues(GlusterBaseClass): # Get Quota list without specifying the path g.log.info("Get Quota list for the volume %s", self.volname) - quota_list1 = get_quota_list(self.mnode, self.volname, path=None) + quota_list1 = quota_fetch_list(self.mnode, self.volname, path=None) self.assertIsNotNone(quota_list1, ("Failed to get the quota list for " "the volume %s", self.volname)) self.assertIn(path, quota_list1.keys(), @@ -129,7 +129,7 @@ class QuotaListPathValues(GlusterBaseClass): # Get Quota List with path mentioned in the command g.log.info("Get Quota list for path %s of the volume %s", path, self.volname) - quota_list2 = get_quota_list(self.mnode, self.volname, path=path) + quota_list2 = quota_fetch_list(self.mnode, self.volname, path=path) self.assertIsNotNone(quota_list2, ("Failed to get the quota list for " "path %s of the volume %s", path, self.volname)) diff --git a/tests/functional/quota/test_negative_quota.py b/tests/functional/quota/test_negative_quota.py index d1bb807ff..d420dd153 100644 --- a/tests/functional/quota/test_negative_quota.py +++ b/tests/functional/quota/test_negative_quota.py @@ -18,9 +18,9 @@ import uuid from glusto.core import Glusto as g from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, runs_on) -from glustolibs.gluster.quota_ops import (enable_quota, - set_quota_soft_timeout, - set_quota_hard_timeout) +from glustolibs.gluster.quota_ops import (quota_enable, + quota_set_soft_timeout, + quota_set_hard_timeout) from glustolibs.gluster.exceptions import ExecutionError @@ -91,7 +91,7 @@ class TestNegativeQuota(GlusterBaseClass): """ g.log.info("enabling quota for %s volume", self.volname) - ret, _, _ = enable_quota(self.mnode, self.volname) + ret, _, _ = quota_enable(self.mnode, self.volname) self.assertEqual(ret, 0, "Error in enabling quota") # test to disable quota by spell mistake @@ -117,14 +117,14 @@ class TestNegativeQuota(GlusterBaseClass): """ This testcase try to enable soft/hard timeouts by giving huge value , all cases has to return false """ - ret, _, err = enable_quota(self.mnode, self.volname) + ret, _, err = quota_enable(self.mnode, self.volname) self.assertEqual(ret, 0, "Error in enabling quota for %s" % (self.volname)) # now try to enable timeout with more time time_in_secs = 100 * 60 * 60 g.log.info("Setting up soft timeout with %d secs", time_in_secs) - ret, _, err = set_quota_soft_timeout(self.mnode, + ret, _, err = quota_set_soft_timeout(self.mnode, self.volname, str(time_in_secs)) errmsg = ("quota command failed : '%d' in " @@ -135,7 +135,7 @@ class TestNegativeQuota(GlusterBaseClass): # now try to enable hard timeout with more time g.log.info("Setting up hard timeout with %d secs", time_in_secs) - ret, _, err = set_quota_hard_timeout(self.mnode, + ret, _, err = quota_set_hard_timeout(self.mnode, self.volname, str(time_in_secs)) errmsg = ("quota command failed : '%d' in " diff --git a/tests/functional/quota/test_non_existent_dir.py b/tests/functional/quota/test_non_existent_dir.py index 666e75279..380576ac1 100644 --- a/tests/functional/quota/test_non_existent_dir.py +++ b/tests/functional/quota/test_non_existent_dir.py @@ -17,8 +17,8 @@ from glusto.core import Glusto as g from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on from glustolibs.gluster.volume_libs import log_volume_info_and_status -from glustolibs.gluster.quota_ops import (enable_quota, - set_quota_limit_usage) +from glustolibs.gluster.quota_ops import (quota_enable, + quota_limit_usage) from glustolibs.gluster.exceptions import ExecutionError @@ -53,7 +53,7 @@ class QuotaNonExistentDir(GlusterBaseClass): # Enable Quota g.log.info("Enabling quota on the volume %s", self.volname) - ret, _, _ = enable_quota(self.mnode, self.volname) + ret, _, _ = quota_enable(self.mnode, self.volname) self.assertEqual(ret, 0, ("Failed to enable quota on the volume %s", self.volname)) g.log.info("Successfully enabled quota on the volume %s", self.volname) @@ -64,8 +64,8 @@ class QuotaNonExistentDir(GlusterBaseClass): # Set Quota limit on the root of the volume g.log.info("Set Quota Limit on the path %s of the volume %s", path, self.volname) - ret, _, err = set_quota_limit_usage(self.mnode, self.volname, - path=path, limit="1GB") + ret, _, err = quota_limit_usage(self.mnode, self.volname, + path=path, limit="1GB") self.assertIn("No such file or directory", err, "Quota limit set " "on path /foo which does not exist") -- cgit