Fix two functional tests within tempest_plugin

Couple of functional tests within tempest plugin are generic driver specific,
it verifies API actions of security-services, but for reproducing test cases
tries create shares and share creation fails if enabled backend driver raises
exception in case security-service has fake/improper data.

Change-Id: Ib8915f1f7d52a6abc2f34cac4bba18a6ad7eaf46
Closes-Bug: #1371552
This commit is contained in:
Your Name 2014-09-19 06:43:20 -04:00
parent 2ab3e7da43
commit 4b0e452b0d
2 changed files with 36 additions and 6 deletions

View File

@ -13,9 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import six # noqa
from tempest.api.share import base
from tempest.openstack.common import log as logging
from tempest import test
LOG = logging.getLogger(__name__)
class SecurityServicesTest(base.BaseSharesTest):
@ -76,9 +81,19 @@ class SecurityServicesTest(base.BaseSharesTest):
fresh_sn["id"], ss["id"])
self.assertIn(int(resp["status"]), test.HTTP_SUCCESS)
resp, share = self.create_share(share_network_id=fresh_sn["id"],
cleanup_in_class=False)
self.assertIn(int(resp["status"]), test.HTTP_SUCCESS)
# 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:
resp, share = 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))
update_data = {
"name": "name",

View File

@ -13,10 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
import six # noqa
from tempest.api.share import base
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
LOG = logging.getLogger(__name__)
class SecurityServicesNegativeTest(base.BaseSharesTest):
@ -82,9 +87,19 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
fresh_sn["id"], ss["id"])
self.assertIn(int(resp["status"]), test.HTTP_SUCCESS)
resp, share = self.create_share(share_network_id=fresh_sn["id"],
cleanup_in_class=False)
self.assertIn(int(resp["status"]), test.HTTP_SUCCESS)
# 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:
resp, share = 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(exceptions.Unauthorized,
self.shares_client.update_security_service,