summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksii Petrenko <opetrenko@mirantis.com>2020-07-20 19:57:18 +0300
committerIvan Kolodyazhny <e0ne@e0ne.info>2020-09-17 16:57:26 +0300
commit97797197af1ebbee6d3ec3e1ea6dc1044aef6516 (patch)
tree4337921844375fca5cad23bb47831f429661e1a9
parentd9bf46371eb411f227ef4bbfd9e002ba7e5d2a4b (diff)
downloadhorizon-97797197af1ebbee6d3ec3e1ea6dc1044aef6516.tar.gz
Add allow_delete_snapshot_before_volume config option
Adds allow_delete_snapshot_before_volume config option, that controls whether to test only situation where first test deletes volume and then snapshot or also second situation, where first test deletes snapshot and then volume. Second situation is impossible with Ceph [1]. [1] https://docs.openstack.org/cinder/ussuri/drivers.html#rbddriver Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info> Change-Id: Ib422331892f077d78e3f2efbdd88abafc4c52b9a
-rw-r--r--openstack_dashboard/test/integration_tests/config.py9
-rw-r--r--openstack_dashboard/test/integration_tests/horizon.conf1
-rw-r--r--openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py58
3 files changed, 55 insertions, 13 deletions
diff --git a/openstack_dashboard/test/integration_tests/config.py b/openstack_dashboard/test/integration_tests/config.py
index 04dd50387..920497fd4 100644
--- a/openstack_dashboard/test/integration_tests/config.py
+++ b/openstack_dashboard/test/integration_tests/config.py
@@ -161,7 +161,14 @@ VolumeGroup = [
help='Default volume type'),
cfg.StrOpt('volume_size',
default='1',
- help='Default volume size ')
+ help='Default volume size '),
+ cfg.BoolOpt('allow_delete_snapshot_before_volume',
+ default=True,
+ help='Set to False to disallow running the volume test where '
+ 'first snapshot is deleted and then volume booted from '
+ 'this snapshot is deleted, but instead run only the test '
+ 'that deletes volume first and then snapshot. '
+ 'Set to True to run both tests.')
]
PluginGroup = [
diff --git a/openstack_dashboard/test/integration_tests/horizon.conf b/openstack_dashboard/test/integration_tests/horizon.conf
index 62332187c..1288f01b1 100644
--- a/openstack_dashboard/test/integration_tests/horizon.conf
+++ b/openstack_dashboard/test/integration_tests/horizon.conf
@@ -104,3 +104,4 @@ flavor=m1.tiny
[volume]
volume_type=lvmdriver-1
volume_size=1
+allow_delete_snapshot_before_volume=True \ No newline at end of file
diff --git a/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py b/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py
index 7d313fe05..7c5aea54f 100644
--- a/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py
+++ b/openstack_dashboard/test/integration_tests/tests/test_volume_snapshots.py
@@ -9,9 +9,14 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+import pytest
+
+from openstack_dashboard.test.integration_tests import config
from openstack_dashboard.test.integration_tests import helpers
from openstack_dashboard.test.integration_tests.regions import messages
+CONFIG = config.get_config()
+
class TestVolumeSnapshotsBasic(helpers.TestCase):
"""Login as demo user"""
@@ -214,18 +219,7 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
self.addCleanup(cleanup)
- def test_create_volume_from_snapshot(self):
- """Test checks possibility to create volume from snapshot
-
- Steps:
- 1. Login to Horizon Dashboard as regular user
- 2. Navigate to Project -> Volumes -> Volumes page
- 3. Create snapshot for existed volume
- 4. Create new volume from snapshot
- 5. Check the volume is created and has 'Available' status
- 6. Delete volume snapshot
- 7. Delete volume
- """
+ def create_volume_from_snapshot(self):
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_snapshot_page = volumes_page.create_volume_snapshot(
self.VOLUME_NAME, self.VOLUME_SNAPSHOT_NAME)
@@ -239,7 +233,9 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
self.VOLUME_SNAPSHOT_NAME, new_volume)
self.assertTrue(volumes_page.is_volume_present(new_volume))
self.assertTrue(volumes_page.is_volume_status(new_volume, 'Available'))
+ return new_volume
+ def delete_snapshot(self):
volumes_snapshot_page = self.volumes_snapshot_page
volumes_snapshot_page.delete_volume_snapshot(self.VOLUME_SNAPSHOT_NAME)
self.assertTrue(
@@ -249,9 +245,47 @@ class TestVolumeSnapshotsAdvanced(helpers.TestCase):
self.assertTrue(volumes_snapshot_page.is_volume_snapshot_deleted(
self.VOLUME_SNAPSHOT_NAME))
+ def delete_volume(self, new_volume):
volumes_page = self.home_pg.go_to_project_volumes_volumespage()
volumes_page.delete_volume(new_volume)
self.assertTrue(
volumes_page.find_message_and_dismiss(messages.INFO))
self.assertFalse(volumes_page.find_message_and_dismiss(messages.ERROR))
self.assertTrue(volumes_page.is_volume_deleted(new_volume))
+
+ @pytest.mark.skipif(
+ not CONFIG.volume.allow_delete_snapshot_before_volume,
+ reason="Skipped due to allow_delete_snapshot_before_volume=False")
+ def test_create_volume_from_snapshot(self):
+ """Test checks possibility to create volume from snapshot
+
+ Steps:
+ 1. Login to Horizon Dashboard as regular user
+ 2. Navigate to Project -> Volumes -> Volumes page
+ 3. Create snapshot for existed volume
+ 4. Create new volume from snapshot
+ 5. Check the volume is created and has 'Available' status
+ 6. Delete volume snapshot
+ 7. Delete volume
+ """
+ new_volume = self.create_volume_from_snapshot()
+
+ self.delete_snapshot()
+ self.delete_volume(new_volume)
+
+ def test_create_volume_from_snapshot_delete_volume_first(self):
+ """Test checks possibility to create volume from snapshot
+
+ Steps:
+ 1. Login to Horizon Dashboard as regular user
+ 2. Navigate to Project -> Volumes -> Volumes page
+ 3. Create snapshot for existed volume
+ 4. Create new volume from snapshot
+ 5. Check the volume is created and has 'Available' status
+ 6. Delete volume
+ 7. Delete volume snapshot
+ """
+ new_volume = self.create_volume_from_snapshot()
+
+ self.delete_volume(new_volume)
+ self.delete_snapshot()