summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrachael-george <rgeorge@redhat.com>2020-02-10 15:22:48 +0530
committerVaibhav Mahajan <vamahaja@redhat.com>2020-03-23 10:06:05 +0000
commite4b0d342e12ecb8b767e65a06804b17746d1a47c (patch)
tree47072a68628fbb8e50a071eec002ce4ccb5d818e
parentfedf86e6b699d6c0392b2f7c3246722f1d99a8b0 (diff)
[Test] Add TC to validate deletion of device with bricks
Change-Id: I591ee6b5a3e0b56fa74bd520fc0e522662c812ce Signed-off-by: rachael-george <rgeorge@redhat.com>
-rwxr-xr-x[-rw-r--r--]tests/functional/heketi/test_heketi_device_operations.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_heketi_device_operations.py b/tests/functional/heketi/test_heketi_device_operations.py
index 9be4d3af..5c8f5fab 100644..100755
--- a/tests/functional/heketi/test_heketi_device_operations.py
+++ b/tests/functional/heketi/test_heketi_device_operations.py
@@ -543,3 +543,29 @@ class TestHeketiDeviceOperations(BaseClass):
self.assertIn(key, brick_keys)
self.assertEqual(brick[key], brick_from_t[key])
self.assertEqual(brick_match_count, len(device_info['bricks']))
+
+ @pytest.mark.tier1
+ def test_device_delete_with_bricks(self):
+ """Validate device deletion with existing bricks on the device"""
+ h_node, h_url = self.heketi_client_node, self.heketi_server_url
+
+ # Create volume
+ vol_size = 1
+ vol_info = heketi_volume_create(h_node, h_url, vol_size, json=True)
+ self.addCleanup(
+ heketi_volume_delete, h_node, h_url, vol_info['id'])
+ device_delete_id = vol_info['bricks'][0]['device']
+ node_id = vol_info['bricks'][0]['node']
+ device_info = heketi_device_info(
+ h_node, h_url, device_delete_id, json=True)
+ device_name = device_info['name']
+
+ # Disable the device
+ heketi_device_disable(h_node, h_url, device_delete_id)
+ self.addCleanup(heketi_device_enable, h_node, h_url, device_delete_id)
+
+ # Delete device with bricks
+ with self.assertRaises(AssertionError):
+ heketi_device_delete(h_node, h_url, device_delete_id)
+ self.addCleanup(
+ heketi_device_add, h_node, h_url, device_name, node_id)