summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/common/arbiter/test_arbiter.py2
-rw-r--r--tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py83
-rw-r--r--tests/functional/common/provisioning/test_dynamic_provisioning_p0_cases.py4
3 files changed, 45 insertions, 44 deletions
diff --git a/tests/functional/common/arbiter/test_arbiter.py b/tests/functional/common/arbiter/test_arbiter.py
index 8b86c640..2567483c 100644
--- a/tests/functional/common/arbiter/test_arbiter.py
+++ b/tests/functional/common/arbiter/test_arbiter.py
@@ -196,7 +196,7 @@ class TestArbiterVolumeCreateExpandDelete(cns_baseclass.CnsBaseClass):
total_size, max_size,
"Volume has bigger size '%s' than expected - '%s'." % (
total_size, max_size))
- min_available_size = int(max_size * 0.95)
+ min_available_size = int(max_size * 0.93)
available_size = int(data[4])
self.assertLessEqual(
min_available_size, available_size,
diff --git a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py
index c28f455b..dbb72e9b 100644
--- a/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py
+++ b/tests/functional/common/heketi/heketi_tests/test_heketi_create_volume.py
@@ -1,4 +1,4 @@
-from glustolibs.gluster.exceptions import ExecutionError, ConfigError
+from glustolibs.gluster.exceptions import ExecutionError
from glusto.core import Glusto as g
from glustolibs.gluster.volume_ops import get_volume_list, get_volume_info
@@ -156,47 +156,52 @@ class TestHeketiVolume(HeketiClientSetupBaseClass):
g.log.info("All heketi cluster successfully listed")
def test_to_check_deletion_of_node(self):
- """
- Deletion of a node which contains devices
- """
-
- # List of heketi node
- g.log.info("List heketi nodes")
- heketi_node_id_list = heketi_node_list(
- self.heketi_client_node, self.heketi_server_url)
- self.assertTrue(heketi_node_id_list, ("List of node IDs is empty."))
+ """Deletion of a node which contains devices"""
+
+ # Create Heketi volume to make sure we have devices with usages
+ heketi_url = self.heketi_server_url
+ vol = heketi_volume_create(
+ self.heketi_client_node, heketi_url, 1, json=True)
+ self.assertTrue(vol, "Failed to create heketi volume.")
+ g.log.info("Heketi volume successfully created")
+ volume_id = vol["bricks"][0]["volume"]
+ self.addCleanup(self.delete_volumes, volume_id)
- g.log.info("Successfully got the list of nodes")
- for node_id in heketi_node_id_list:
- g.log.info("Retrieve the node info")
- node_info_dict = heketi_node_info(
- self.heketi_client_node, self.heketi_server_url,
- node_id, json=True)
- if not(node_info_dict["devices"][1]["storage"]["used"]):
- raise ConfigError("No device in node %s" % node_id)
- g.log.info("Used space in device %s" % node_info_dict[
- "devices"][1]["storage"]["used"])
- node_id = heketi_node_id_list[0]
-
- # Deleting a node
- g.log.info("Trying to delete a node which"
- " contains devices in it:"
- " Expected to fail")
- out = heketi_node_delete(self.heketi_client_node,
- self.heketi_server_url,
- node_id)
- self.assertFalse(out, ("Successfully deletes a "
- "node %s" % str(node_id)))
- g.log.info("Expected result: Unable to delete "
- "node %s because it contains devices")
-
- # To confrim deletion failed, check node list
- # TODO: fix following, it doesn't verify absence of the deleted nodes
+ # Pick up suitable node
+ node_ids = heketi_node_list(self.heketi_client_node, heketi_url)
+ self.assertTrue(node_ids)
+ for node_id in node_ids:
+ node_info = heketi_node_info(
+ self.heketi_client_node, heketi_url, node_id, json=True)
+ if (node_info['state'].lower() != 'online' or
+ not node_info['devices']):
+ continue
+ for device in node_info['devices']:
+ if device['state'].lower() != 'online':
+ continue
+ if device['storage']['used']:
+ node_id = node_info['id']
+ break
+ else:
+ self.assertTrue(
+ node_id,
+ "Failed to find online node with online device which "
+ "has some usages.")
+
+ # Try to delete the node by its ID
+ g.log.info("Trying to delete the node which contains devices in it. "
+ "Expecting failure.")
+ out = heketi_node_delete(self.heketi_client_node, heketi_url, node_id)
+ self.assertFalse(out, "Node '%s' got unexpectedly deleted." % node_id)
+
+ # Make sure our node hasn't been deleted
g.log.info("Listing heketi node list")
- node_list = heketi_node_list(self.heketi_client_node,
- self.heketi_server_url)
+ node_list = heketi_node_list(self.heketi_client_node, heketi_url)
self.assertTrue(node_list, ("Failed to list heketi nodes"))
- g.log.info("Successfully got the list of nodes")
+ self.assertIn(node_id, node_list)
+ node_info = heketi_node_info(
+ self.heketi_client_node, heketi_url, node_id, json=True)
+ self.assertEqual(node_info['state'].lower(), 'online')
def test_blockvolume_create_no_free_space(self):
"""Test case CNS-550"""
diff --git a/tests/functional/common/provisioning/test_dynamic_provisioning_p0_cases.py b/tests/functional/common/provisioning/test_dynamic_provisioning_p0_cases.py
index 9875e6dd..2f43ff1e 100644
--- a/tests/functional/common/provisioning/test_dynamic_provisioning_p0_cases.py
+++ b/tests/functional/common/provisioning/test_dynamic_provisioning_p0_cases.py
@@ -19,7 +19,6 @@ from cnslibs.common.openshift_ops import (
oc_delete,
oc_get_custom_resource,
oc_rsh,
- oc_version,
scale_dc_pod_amount_and_wait,
verify_pvc_status_is_bound,
wait_for_pod_be_ready,
@@ -422,9 +421,6 @@ class TestDynamicProvisioningP0(CnsBaseClass):
def test_pvc_deletion_while_pod_is_running(self):
# CNS-584 Verify PVC deletion while pod is running
- if "v3.11" in oc_version(self.node):
- self.skipTest("Blocked by BZ-1644696")
-
self._create_storage_class()
self._create_and_wait_for_pvc()