From f004fa35251db383f8f48aa83b8ed6a331a2770c Mon Sep 17 00:00:00 2001 From: ubansal Date: Thu, 21 Jun 2018 13:27:29 +0530 Subject: This TC is to verify that auth allow fails with blank string for volumes and subdir Change-Id: I8c71470a67fef17d54d5fdfbcf0d36eb156c07dd Signed-off-by: ubansal --- .../test_authentication_allow_blank.py | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 tests/functional/authentication/test_authentication_allow_blank.py (limited to 'tests/functional/authentication') diff --git a/tests/functional/authentication/test_authentication_allow_blank.py b/tests/functional/authentication/test_authentication_allow_blank.py new file mode 100644 index 000000000..d9b87ed5f --- /dev/null +++ b/tests/functional/authentication/test_authentication_allow_blank.py @@ -0,0 +1,80 @@ +# Copyright (C) 2017-2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +""" Description +Test Case in this module is to set value of auth.allow to empty string +and check if it throws an error +""" +from glusto.core import Glusto as g +from glustolibs.gluster.gluster_base_class import (GlusterBaseClass, + runs_on) +from glustolibs.gluster.exceptions import ExecutionError +from glustolibs.gluster.gluster_init import is_glusterd_running +from glustolibs.gluster.volume_ops import set_volume_options +from glustolibs.gluster.volume_libs import cleanup_volume + + +@runs_on([['replicated', 'distributed-replicated', 'dispersed', + 'distributed-dispersed'], + ['glusterfs']]) +class AuthAllowEmptyString(GlusterBaseClass): + """ + Tests to verify auth.allow functionality on Volume and Fuse subdir + """ + def setUp(self): + """ + Setup Volume + """ + ret = self.setup_volume() + if not ret: + raise ExecutionError("Failed to setup volume") + g.log.info("Volume %s has been setup successfully", self.volname) + + # Calling GlusterBaseClass Setup + GlusterBaseClass.setUp.im_func(self) + + def test_validate_authallow(self): + """ + -Set Authentication allow as empty string for volume + -Check if glusterd is running + """ + # pylint: disable=too-many-statements + + # Set Authentication to blank string for volume + option = {"auth.allow": " "} + ret = set_volume_options(self.mnode, self.volname, + option) + self.assertFalse(ret, ("Unexpected: Authentication set successfully " + "for Volume with option: %s" % option)) + g.log.info("Expected: Failed to set authentication for Volume with " + "option: %s", option) + + # Check if glusterd is running + ret = is_glusterd_running(self.servers) + self.assertEqual(ret, 0, "Glusterd service not running") + g.log.info("Expected : Glusterd service running") + + def tearDown(self): + """ + TearDown for Volume + Volume Cleanup + """ + ret = cleanup_volume(self.mnode, self.volname) + if not ret: + raise ExecutionError("Failed to Cleanup the " + "Volume %s" % self.volname) + g.log.info("Volume deleted successfully " + ": %s", self.volname) -- cgit