summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2019-06-27 15:14:21 +0530
committerBala Konda Reddy M <bmekala@redhat.com>2019-07-08 08:58:35 +0000
commit2acb2274d0ebb412efa4ebe92be2381e7668361c (patch)
tree49ffeb3415fd4c28d1fd570347b12112d2c3d9df
parent5678e843eb5367a4587f9058adb58d45000e23b0 (diff)
Adding code to not stop glusterd on mnode.
This test case was failing in a test run as the mnode was not removed from the list self.servers because of which there were runs where glusterd was stoppped instead and command was executed on mnod.As well as adding code to check and start glusterd on the node in instances where the test case fails. Change-Id: Id203102d3f0ec82af0ac215f0ecaf7ae22b630f5 Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
-rw-r--r--tests/functional/glusterd/test_volume_set_with_quorum_enabled.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py b/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py
index c4983ed..24865d2 100644
--- a/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py
+++ b/tests/functional/glusterd/test_volume_set_with_quorum_enabled.py
@@ -13,7 +13,7 @@
# 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.
-import random
+from random import choice
from time import sleep
from glusto.core import Glusto as g
from glustolibs.gluster.exceptions import ExecutionError
@@ -40,11 +40,33 @@ class TestVolumeSetOpWithQuorum(GlusterBaseClass):
def tearDown(self):
+ # Check and start if glusterd isn't running.
+ if not self.validate_peers_are_connected():
+
+ # Starting glusterd on node where stopped.
+ ret = start_glusterd(self.node_on_glusterd_to_stop)
+ if ret:
+ raise ExecutionError("Failed to start glusterd.")
+ g.log.info("Successfully started glusterd.")
+
+ # Checking if peer is connected.
+ counter = 0
+ while counter < 30:
+ ret = self.validate_peers_are_connected()
+ counter += 1
+ if ret:
+ break
+ sleep(3)
+ if not ret:
+ raise ExecutionError("Peer is not in connected state.")
+ g.log.info("Peers is in connected state.")
+
# Setting Quorum ratio to 51%
self.quorum_perecent = {'cluster.server-quorum-ratio': '51%'}
ret = set_volume_options(self.mnode, 'all', self.quorum_perecent)
- self.assertTrue(ret, "gluster volume set all cluster.server-quorum-rat"
- "io percentage Failed :%s" % self.servers)
+ if not ret:
+ raise ExecutionError("gluster volume set all cluster.server-quorum"
+ "-ratio percentage Failed :%s" % self.servers)
g.log.info("gluster volume set all cluster.server-quorum-ratio 51 "
"percentage enabled successfully on :%s", self.servers)
@@ -85,7 +107,7 @@ class TestVolumeSetOpWithQuorum(GlusterBaseClass):
"percentage enabled successfully on :%s", self.servers)
# Stop glusterd on one of the node randomly
- self.node_on_glusterd_to_stop = random.choice(self.servers)
+ self.node_on_glusterd_to_stop = choice(self.servers[1:])
ret = stop_glusterd(self.node_on_glusterd_to_stop)
self.assertTrue(ret, "glusterd stop on the node failed")
g.log.info("glusterd stop on the node: % "
@@ -103,11 +125,11 @@ class TestVolumeSetOpWithQuorum(GlusterBaseClass):
"stopping glusterd on one node")
# Setting volume option when quorum is not met
- self.new_servers = self.servers[:]
+ self.new_servers = self.servers[1:]
self.new_servers.remove(self.node_on_glusterd_to_stop)
self.nfs_options = {"nfs.disable": "off"}
ret = set_volume_options(
- random.choice(self.new_servers), self.volname, self.nfs_options)
+ choice(self.new_servers), self.volname, self.nfs_options)
self.assertFalse(ret, "gluster volume set %s nfs.disable off "
"succeeded" % self.volname)
g.log.info("gluster volume set %s nfs.disable off"