Browse Source

[Tempest] Fix tests for pre-existing share network

Currently tempest tests do not support creating and
adding Security Service to newly created share networks.
This causes CIFS multitenancy tests to fail on some
of the backends.
Therefore, having pre-existing share network helps
testing such scenarios.

When using a pre-existing share network,
we can still test the share network API and
create share networks, however, we shouldn't
create shares on such networks.
So, any tests that create new share networks
and use them to create shares need to be skipped.

- This patch makes sure that the pre-existing
share_network is not cleaned up.
- One share_server related test is skipped
to avoid deleting share network as part of test.
- One share network negative test is skipped
to avoid creating a share with new share network.

Change-Id: I272806b05c8b4d30451d0cf4b9dd3f366b8bf728
Closes-Bug: #1698429
(cherry picked from commit 29a52269aa)
yogesh 1 year ago
parent
commit
ed62a751c5

+ 3
- 0
manila_tempest_tests/tests/api/admin/test_share_servers.py View File

@@ -195,6 +195,9 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
195 195
 
196 196
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
197 197
     @ddt.data(True, False)
198
+    @testtools.skipIf(CONF.share.share_network_id != "",
199
+                      "This test is not suitable for pre-existing "
200
+                      "share_network.")
198 201
     def test_delete_share_server(self, delete_share_network):
199 202
         # Get network and subnet from existing share_network and reuse it
200 203
         # to be able to delete share_server after test ends.

+ 7
- 4
manila_tempest_tests/tests/api/base.py View File

@@ -406,7 +406,9 @@ class BaseSharesTest(test.BaseTestCase):
406 406
                       cleanup_in_class=True, is_public=False, **kwargs):
407 407
         client = client or cls.shares_v2_client
408 408
         description = description or "Tempest's share"
409
-        share_network_id = share_network_id or client.share_network_id or None
409
+        share_network_id = (share_network_id or
410
+                            CONF.share.share_network_id or
411
+                            client.share_network_id or None)
410 412
         metadata = metadata or {}
411 413
         size = size or CONF.share.share_size
412 414
         kwargs.update({
@@ -885,9 +887,10 @@ class BaseSharesTest(test.BaseTestCase):
885 887
                     elif res["type"] is "snapshot":
886 888
                         client.delete_snapshot(res_id)
887 889
                         client.wait_for_resource_deletion(snapshot_id=res_id)
888
-                    elif res["type"] is "share_network":
889
-                        client.delete_share_network(res_id)
890
-                        client.wait_for_resource_deletion(sn_id=res_id)
890
+                    elif (res["type"] is "share_network" and
891
+                            res_id != CONF.share.share_network_id):
892
+                            client.delete_share_network(res_id)
893
+                            client.wait_for_resource_deletion(sn_id=res_id)
891 894
                     elif res["type"] is "security_service":
892 895
                         client.delete_security_service(res_id)
893 896
                         client.wait_for_resource_deletion(ss_id=res_id)

+ 3
- 0
manila_tempest_tests/tests/api/test_share_networks_negative.py View File

@@ -111,6 +111,9 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
111 111
     @testtools.skipIf(not CONF.share.multitenancy_enabled,
112 112
                       'Can run only with drivers that do handle share servers '
113 113
                       'creation. Skipping.')
114
+    @testtools.skipIf(CONF.share.share_network_id != "",
115
+                      "This test is not suitable for pre-existing "
116
+                      "share_network.")
114 117
     def test_try_delete_share_network_with_existing_shares(self):
115 118
         # Get valid network data for successful share creation
116 119
         share_network = self.shares_client.get_share_network(

Loading…
Cancel
Save