diff options
author | Valerii Ponomarov <vponomar@redhat.com> | 2019-03-06 16:15:25 +0530 |
---|---|---|
committer | Valerii Ponomarov <vponomar@redhat.com> | 2019-03-06 16:28:52 +0530 |
commit | 3de9a4ea9623cd3a928ce30cbae3364beeac5edb (patch) | |
tree | 1746204da26e4648d20b656b2421ef42c78044a4 /tests/functional/heketi/test_heketi_volume_operations.py | |
parent | 3d4ab96edfa54ec7f2dd9682d1ee3e3077dfa79c (diff) |
Reorder test files removing redundant dirs
Move all the files of 'tests/functional/common/' dir
to the 'tests/functional/', because 'common' is the only
dir there, which doesn't really makes sense.
Do the same about 'tests/functional/common/heketi/heketi_tests'
and 'tests/functional/common/heketi/'.
Change-Id: I1fa55e2e7bf09e9b9115629b06e1fd160e291a36
Diffstat (limited to 'tests/functional/heketi/test_heketi_volume_operations.py')
-rw-r--r-- | tests/functional/heketi/test_heketi_volume_operations.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/functional/heketi/test_heketi_volume_operations.py b/tests/functional/heketi/test_heketi_volume_operations.py new file mode 100644 index 00000000..d7b9aa18 --- /dev/null +++ b/tests/functional/heketi/test_heketi_volume_operations.py @@ -0,0 +1,68 @@ +from cnslibs.common.heketi_ops import (heketi_volume_delete, + heketi_volume_create, + heketi_volume_expand, + heketi_volume_info) +from cnslibs.common.baseclass import BaseClass + + +class TestHeketiVolumeOperations(BaseClass): + """ + Class to test heketi volume operations - create, expand + """ + + @classmethod + def setUpClass(cls): + super(TestHeketiVolumeOperations, cls).setUpClass() + cls.volume_size = 1 + + def test_heketi_with_default_options(self): + """ + Test to create volume with default options. + """ + + vol_info = heketi_volume_create(self.heketi_client_node, + self.heketi_server_url, + self.volume_size, json=True) + self.assertTrue(vol_info, ("Failed to create heketi volume of size %s" + % self.volume_size)) + self.addCleanup( + heketi_volume_delete, + self.heketi_client_node, self.heketi_server_url, vol_info['id']) + + self.assertEqual(vol_info['size'], self.volume_size, + ("Failed to create volume with default options." + "Expected Size: %s, Actual Size: %s" + % (self.volume_size, vol_info['size']))) + + def test_heketi_with_expand_volume(self): + """ + Test volume expand and size if updated correctly in heketi-cli info + """ + + vol_info = heketi_volume_create(self.heketi_client_node, + self.heketi_server_url, + self.volume_size, json=True) + self.assertTrue(vol_info, ("Failed to create heketi volume of size %s" + % self.volume_size)) + self.addCleanup( + heketi_volume_delete, + self.heketi_client_node, self.heketi_server_url, vol_info['id']) + self.assertEqual(vol_info['size'], self.volume_size, + ("Failed to create volume." + "Expected Size: %s, Actual Size: %s" + % (self.volume_size, vol_info['size']))) + volume_id = vol_info["id"] + expand_size = 2 + ret = heketi_volume_expand(self.heketi_client_node, + self.heketi_server_url, volume_id, + expand_size) + self.assertTrue(ret, ("Failed to expand heketi volume of id %s" + % volume_id)) + volume_info = heketi_volume_info(self.heketi_client_node, + self.heketi_server_url, + volume_id, json=True) + expected_size = self.volume_size + expand_size + self.assertEqual(volume_info['size'], expected_size, + ("Volume Expansion failed Expected Size: %s, Actual " + "Size: %s" % (str(expected_size), + str(volume_info['size'])))) |