summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-09-18 12:08:17 +0000
committerGerrit Code Review <review@openstack.org>2020-09-18 12:08:18 +0000
commit0cb127d24a63bc4c4185588aa377ac38139d6a22 (patch)
treef8fc2015b2adef9dd01dab9e795cf288386e1663
parentb6736593689d2392b77948507a7e7abfff917614 (diff)
parent97797197af1ebbee6d3ec3e1ea6dc1044aef6516 (diff)
downloadhorizon-0cb127d24a63bc4c4185588aa377ac38139d6a22.tar.gz
Merge "Add allow_delete_snapshot_before_volume config option"
-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()