summaryrefslogtreecommitdiffstats
path: root/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py')
-rw-r--r--tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py40
1 files changed, 13 insertions, 27 deletions
diff --git a/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py b/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py
index 8c0f7a7f2..7eeb5f93d 100644
--- a/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py
+++ b/tests/functional/glusterd/test_glusterd_snap_info_on_detached_node.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Red Hat, Inc. <http://www.redhat.com>
+# Copyright (C) 2017-2020 Red Hat, Inc. <http://www.redhat.com>
#
# 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
@@ -14,15 +14,17 @@
# 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 time import sleep
from glusto.core import Glusto as g
from glustolibs.gluster.exceptions import ExecutionError
from glustolibs.gluster.gluster_base_class import GlusterBaseClass, runs_on
+from glustolibs.gluster.glusterfile import file_exists
from glustolibs.gluster.lib_utils import form_bricks_list
from glustolibs.gluster.volume_ops import (volume_create,
set_volume_options, volume_start)
from glustolibs.gluster.snap_ops import snap_create, snap_activate
-from glustolibs.gluster.peer_ops import peer_detach_servers, peer_probe
+from glustolibs.gluster.peer_ops import (
+ peer_detach_servers,
+ peer_probe_servers)
@runs_on([['distributed'], ['glusterfs']])
@@ -30,6 +32,10 @@ class TestSnapInfoOnPeerDetachedNode(GlusterBaseClass):
def tearDown(self):
+ ret = peer_probe_servers(self.mnode, self.servers)
+ if not ret:
+ raise ExecutionError("Failed to peer probe servers")
+
# stopping the volume and Cleaning up the volume
ret = self.cleanup_volume()
if not ret:
@@ -37,7 +43,7 @@ class TestSnapInfoOnPeerDetachedNode(GlusterBaseClass):
g.log.info("Volume deleted successfully : %s", self.volname)
# Calling GlusterBaseClass tearDown
- GlusterBaseClass.tearDown.im_func(self)
+ self.get_super_method(self, 'tearDown')()
def test_snap_info_from_detached_node(self):
# pylint: disable=too-many-statements
@@ -100,12 +106,10 @@ class TestSnapInfoOnPeerDetachedNode(GlusterBaseClass):
# Validate files /var/lib/glusterd/snaps on all the servers is same
self.pathname = "/var/lib/glusterd/snaps/%s" % self.snapname
for server in self.servers:
- conn = g.rpyc_get_connection(server)
- ret = conn.modules.os.path.isdir(self.pathname)
+ ret = file_exists(server, self.pathname)
self.assertTrue(ret, "%s directory doesn't exist on node %s" %
(self.pathname, server))
g.log.info("%s path exists on node %s", self.pathname, server)
- g.rpyc_close_deployed_servers()
# Peer detach one node
self.random_node_peer_detach = random.choice(self.servers[1:])
@@ -116,28 +120,10 @@ class TestSnapInfoOnPeerDetachedNode(GlusterBaseClass):
g.log.info("Peer detach succeeded")
# /var/lib/glusterd/snaps/<snapname> directory should not present
- conn = g.rpyc_get_connection(self.random_node_peer_detach)
- ret = conn.modules.os.path.isdir(self.pathname)
+
+ ret = file_exists(self.random_node_peer_detach, self.pathname)
self.assertFalse(ret, "%s directory should not exist on the peer"
"which is detached from cluster%s" % (
self.pathname, self.random_node_peer_detach))
g.log.info("Expected: %s path doesn't exist on peer detached node %s",
self.pathname, self.random_node_peer_detach)
- g.rpyc_close_deployed_servers()
-
- # Peer probe the detached node
- ret, _, _ = peer_probe(self.mnode, self.random_node_peer_detach)
- self.assertEqual(ret, 0, "Peer probe of node: %s failed" %
- self.random_node_peer_detach)
- g.log.info("Peer probe succeeded")
-
- # Validating peers are in connected state
- count = 0
- while count < 10:
- sleep(2)
- ret = self.validate_peers_are_connected()
- if ret:
- break
- count += 1
- self.assertTrue(ret, "Peers are not in connected state")
- g.log.info("Peer are in connected state")