Fix tempest case "test_delete_ss_from_sn_used_by_share_server"
The case use fake data in security service, which may cause backend driver
fail.
Refer to the case "test_try_update_valid_keys_sh_server_exists", just ignore
the error of the backend driver procedure.
Change-Id: I783652486fcf92b543c0a620409c9e41d33cab56
Closes-Bug: #1531758
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index de0064c..834deb5 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_log import log # noqa
+import six # noqa
from tempest import config # noqa
from tempest import test # noqa
from tempest_lib import exceptions as lib_exc # noqa
@@ -21,6 +23,7 @@
from manila_tempest_tests.tests.api import base
CONF = config.CONF
+LOG = log.getLogger(__name__)
class SecServicesMappingNegativeTest(base.BaseSharesTest):
@@ -99,8 +102,21 @@
self.shares_client.add_sec_service_to_share_network(
fresh_sn["id"], self.ss["id"])
- self.create_share(
- share_network_id=fresh_sn["id"], cleanup_in_class=False)
+
+ # Security service with fake data is used, so if we use backend driver
+ # that fails on wrong data, we expect error here.
+ # We require any share that uses our share-network.
+ try:
+ self.create_share(
+ share_network_id=fresh_sn["id"], cleanup_in_class=False)
+ except Exception as e:
+ # we do wait for either 'error' or 'available' status because
+ # it is the only available statuses for proper deletion.
+ LOG.warning("Caught exception. It is expected in case backend "
+ "fails having security-service with improper data "
+ "that leads to share-server creation error. "
+ "%s" % six.text_type(e))
+
self.assertRaises(lib_exc.Forbidden,
self.cl.remove_sec_service_from_share_network,
fresh_sn["id"],