From 0726cf5aa5a0d159f90cf4bd5c243e28ea5d9b8f Mon Sep 17 00:00:00 2001 From: zhaohua Date: Thu, 7 Jan 2016 17:04:33 +0800 Subject: [PATCH] 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 --- ...test_security_services_mapping_negative.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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 de0064cbff..834deb57d1 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 @@ import testtools # noqa from manila_tempest_tests.tests.api import base CONF = config.CONF +LOG = log.getLogger(__name__) class SecServicesMappingNegativeTest(base.BaseSharesTest): @@ -99,8 +102,21 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest): 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"],