summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvamahaja <vamahaja@redhat.com>2019-11-11 10:41:49 +0530
committervamahaja <vamahaja@redhat.com>2019-11-19 14:44:09 +0530
commit87b8bd30728f013dd114e449c7595eedb33f0ce9 (patch)
tree4775a441e76e98daf64c1ae8dc43fde0036e3316
parenta9b27974c785db4d52ec16faaaa4778d26c42dbb (diff)
Add test case to automate heketi add node to a invalid cluster
Change-Id: I482ac6ebed181546a18595c6a6b21d2115782b3a Signed-off-by: vamahaja <vamahaja@redhat.com>
-rw-r--r--tests/functional/heketi/test_heketi_node_operations.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_heketi_node_operations.py b/tests/functional/heketi/test_heketi_node_operations.py
index 6b06a2d..4870bc1 100644
--- a/tests/functional/heketi/test_heketi_node_operations.py
+++ b/tests/functional/heketi/test_heketi_node_operations.py
@@ -1,5 +1,6 @@
from glusto.core import Glusto as g
from glustolibs.gluster import peer_ops
+import six
from openshiftstoragelibs import baseclass
from openshiftstoragelibs import exceptions
@@ -7,6 +8,7 @@ from openshiftstoragelibs import heketi_ops
from openshiftstoragelibs import openshift_ops
from openshiftstoragelibs import openshift_storage_version
from openshiftstoragelibs import podcmd
+from openshiftstoragelibs import utils
class TestHeketiNodeOperations(baseclass.BaseClass):
@@ -228,3 +230,18 @@ class TestHeketiNodeOperations(baseclass.BaseClass):
err_msg = "Hostname %s not present in endpoints %s" % (
storage_ip, ep_addresses)
self.assertIn(storage_ip, ep_addresses, err_msg)
+
+ def test_heketi_node_add_with_invalid_cluster(self):
+ """Test heketi node add operation with invalid cluster id"""
+ storage_hostname, cluster_id = None, utils.get_random_str(size=33)
+ try:
+ storage_hostname, _ = self.add_heketi_node_to_cluster(cluster_id)
+ except AssertionError as e:
+ err_msg = ("validation failed: cluster: %s is not a valid UUID" %
+ cluster_id)
+ if err_msg not in six.text_type(e):
+ raise
+
+ err_msg = ("Unexpectedly node %s got added to cluster %s" % (
+ storage_hostname, cluster_id))
+ self.assertFalse(storage_hostname, err_msg)