Sync tempest plugin with latest tempest

We are forced to sync our tempest plugin to latest tempest due to changes
done to CI system, that are  based on recent tempest project changes.
Such as reusage oslo libs instead of built-in incubator code, that leads to
changes of config opts that are set/read within tempest config used in CI.

Change-Id: I3e64dc373f5d81034afc4c5d8dfd5d7f4abaa603
Closes-Bug: #1434958
This commit is contained in:
vponomaryov 2015-03-22 10:56:41 +02:00
parent dc79eb0071
commit 8376ca41fc
23 changed files with 120 additions and 134 deletions

View File

@ -47,7 +47,7 @@ fi
# Go to Tempest dir and checkout stable commit to avoid possible
# incompatibilities for plugin stored in Manila repo.
TEMPEST_COMMIT="7d5ed596" # 23 Feb, 2015
TEMPEST_COMMIT="d8f38aba" # 21 Mar, 2015
cd $BASE/new/tempest
git checkout $TEMPEST_COMMIT

View File

@ -18,7 +18,6 @@ from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest import clients_share as clients
from tempest import config_share as config
from tempest import exceptions
from tempest import test
CONF = config.CONF
@ -45,27 +44,27 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "negative", ])
def test_reset_share_state_to_unacceptable_state(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.reset_state,
self.sh["id"], status="fake")
@test.attr(type=["gate", "negative", ])
def test_reset_snapshot_state_to_unacceptable_state(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.reset_state,
self.sn["id"], s_type="snapshots", status="fake")
@test.attr(type=["gate", "negative", ])
def test_try_reset_share_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.reset_state,
self.sh["id"])
@test.attr(type=["gate", "negative", ])
def test_try_reset_snapshot_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.reset_state,
self.sn["id"], s_type="snapshots")
@ -84,13 +83,13 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "negative", ])
def test_try_force_delete_share_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.force_delete,
self.sh["id"])
@test.attr(type=["gate", "negative", ])
def test_try_force_delete_snapshot_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.force_delete,
self.sn["id"], s_type="snapshots")

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest.api.share import base
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import test

View File

@ -19,7 +19,6 @@ import testtools # noqa
from tempest.api.share import base
from tempest import clients_share as clients
from tempest import config_share as config
from tempest import exceptions
from tempest import test
CONF = config.CONF
@ -56,7 +55,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
def test_update_shares_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
shares=-2)
@ -65,7 +64,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
def test_update_snapshots_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
snapshots=-2)
@ -74,7 +73,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
def test_update_gigabytes_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
gigabytes=-2)
@ -83,7 +82,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
def test_update_snapshot_gigabytes_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
snapshot_gigabytes=-2)
@ -92,7 +91,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
def test_update_share_networks_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
share_networks=-2)
@ -118,7 +117,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
# try set user quota for shares bigger than tenant quota
bigger_value = int(tenant_quotas["shares"]) + 2
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
client.creds["user"]["id"],
@ -133,7 +132,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
# try set user quota for snapshots bigger than tenant quota
bigger_value = int(tenant_quotas["snapshots"]) + 2
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
client.creds["user"]["id"],
@ -148,7 +147,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
# try set user quota for gigabytes bigger than tenant quota
bigger_value = int(tenant_quotas["gigabytes"]) + 2
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
client.creds["user"]["id"],
@ -163,7 +162,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
# try set user quota for snapshot gigabytes bigger than tenant quota
bigger_value = int(tenant_quotas["snapshot_gigabytes"]) + 2
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
client.creds["user"]["id"],
@ -178,7 +177,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
# try set user quota for share_networks bigger than tenant quota
bigger_value = int(tenant_quotas["share_networks"]) + 2
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
client.update_quotas,
client.creds["tenant"]["id"],
client.creds["user"]["id"],

View File

@ -30,7 +30,7 @@ class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_services_with_non_admin_user(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.user_shares_client.list_services)
@test.attr(type=["gate", "smoke", "negative", ])

View File

@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
import testtools # noqa
from tempest.api.share import base
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import test

View File

@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest import clients_share as clients
from tempest.common.utils import data_utils
from tempest import test
@ -30,18 +30,18 @@ class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", "negative", ])
def test_try_list_share_servers_with_member(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.list_share_servers)
@test.attr(type=["gate", "smoke", "negative", ])
def test_try_show_share_server_with_member(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.show_share_server,
'fake_id')
@test.attr(type=["gate", "smoke", "negative", ])
def test_try_show_share_server_details_with_member(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.show_share_server_details,
'fake_id')
@ -103,6 +103,6 @@ class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", "negative", ])
def test_delete_share_server_with_member(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.delete_share_server,
"fake_nonexistent_share_server_id")

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import test

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest.api.share import base
from tempest.common.utils import data_utils
from tempest import test

View File

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest import clients_share as clients
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest import test
@ -39,7 +38,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_create_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "new_value"}))
@ -48,7 +47,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_list_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.list_share_types_extra_specs,
st["share_type"]["id"])
@ -56,7 +55,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_get_extra_spec_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.get_share_type_extra_spec,
st["share_type"]["id"], "key")
@ -64,7 +63,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_get_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.get_share_type_extra_specs,
st["share_type"]["id"])
@ -72,7 +71,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_update_extra_spec_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.update_share_type_extra_spec,
st["share_type"]["id"], "key", "new_value")
@ -80,7 +79,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_update_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.update_share_type_extra_specs,
st["share_type"]["id"], {"key": "new_value"})
@ -88,7 +87,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_delete_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Unauthorized,
lib_exc.Forbidden,
self.member_shares_client.delete_share_type_extra_spec,
st["share_type"]["id"], "key")
@ -97,7 +96,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
too_big_key = "k" * 256
st = self._create_share_type()
self.assertRaises(
exceptions.BadRequest,
lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({too_big_key: "value"}))
@ -107,7 +106,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
too_big_value = "v" * 256
st = self._create_share_type()
self.assertRaises(
exceptions.BadRequest,
lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": too_big_value}))
@ -121,7 +120,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
self.add_required_extra_specs_to_dict({"key": "value"}))
self.assertIn(int(resp["status"]), self.HTTP_SUCCESS)
self.assertRaises(
exceptions.BadRequest,
lib_exc.BadRequest,
self.shares_client.update_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": too_big_value}))
@ -134,7 +133,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "value"}))
self.assertIn(int(resp["status"]), self.HTTP_SUCCESS)
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_share_type_extra_spec,
st["share_type"]["id"], "key", too_big_value)
@ -164,14 +163,14 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
def test_try_create_es_with_empty_specs(self):
st = self._create_share_type()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
st["share_type"]["id"], "")
@test.attr(type=["gate", "smoke", ])
def test_try_create_es_with_invalid_specs(self):
st = self._create_share_type()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
st["share_type"]["id"], {"": "value_with_empty_key"})
@ -248,6 +247,6 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
def test_try_update_with_invalid_specs(self):
st = self._create_share_type()
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_share_type_extra_specs,
st["share_type"]["id"], {"": "new_value"})

View File

@ -13,12 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest import clients_share as clients
from tempest.common.utils import data_utils
from tempest import exceptions
from tempest import test
@ -37,7 +36,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
def test_try_create_share_type_with_user(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.create_share_type,
data_utils.rand_name("used_user_creds"),
client=self.member_shares_client)
@ -45,7 +44,7 @@ class ShareTypesAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
def test_try_delete_share_type_with_user(self):
st = self._create_share_type()
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.delete_share_type,
st["share_type"]["id"])
@ -57,11 +56,11 @@ class ShareTypesAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
def test_create_share_type_with_empty_name(self):
self.assertRaises(exceptions.BadRequest, self.create_share_type, '')
self.assertRaises(lib_exc.BadRequest, self.create_share_type, '')
@test.attr(type=["gate", "smoke", ])
def test_create_share_type_with_too_big_name(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.create_share_type,
"x" * 256)

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
import testtools # noqa
from tempest.api.share import base
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import test

View File

@ -17,27 +17,27 @@ import copy
import inspect
import traceback
from oslo_concurrency import lockutils # noqa
from oslo_log import log # noqa
import six # noqa
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
import six
from tempest import clients_share as clients
from tempest.common import isolated_creds
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import exceptions
from tempest.openstack.common import lockutils
from tempest.openstack.common import log as logging
from tempest import share_exceptions
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
LOG = log.getLogger(__name__)
class handle_cleanup_exceptions(object):
"""Handle exceptions raised with cleanup operations.
Always suppress errors when lib_exc.NotFound or lib_exc.Unauthorized
Always suppress errors when lib_exc.NotFound or lib_exc.Forbidden
are raised.
Suppress all other exceptions only in case config opt
'suppress_errors_in_cleanup' in config group 'share' is True.
@ -48,7 +48,7 @@ class handle_cleanup_exceptions(object):
def __exit__(self, exc_type, exc_value, exc_traceback):
if not (isinstance(exc_value,
(lib_exc.NotFound, lib_exc.Unauthorized)) or
(lib_exc.NotFound, lib_exc.Forbidden)) or
CONF.share.suppress_errors_in_cleanup):
return False # Do not suppress error if any
if exc_traceback:

View File

@ -16,7 +16,6 @@
from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest import exceptions
from tempest import test
@ -43,13 +42,13 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "negative", ])
def test_try_set_metadata_with_empty_key(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.set_metadata,
self.share["id"], {"": "value"})
@test.attr(type=["gate", "negative", ])
def test_try_upd_metadata_with_empty_key(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_all_metadata,
self.share["id"], {"": "value"})
@ -57,7 +56,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
def test_try_set_metadata_with_too_big_key(self):
too_big_key = "x" * 256
md = {too_big_key: "value"}
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.set_metadata,
self.share["id"], md)
@ -65,7 +64,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
def test_try_upd_metadata_with_too_big_key(self):
too_big_key = "x" * 256
md = {too_big_key: "value"}
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_all_metadata,
self.share["id"], md)
@ -73,7 +72,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
def test_try_set_metadata_with_too_big_value(self):
too_big_value = "x" * 1024
md = {"key": too_big_value}
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.set_metadata,
self.share["id"], md)
@ -81,7 +80,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
def test_try_upd_metadata_with_too_big_value(self):
too_big_value = "x" * 1024
md = {"key": too_big_value}
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_all_metadata,
self.share["id"], md)

View File

@ -17,7 +17,6 @@ from tempest_lib import exceptions as lib_exc # noqa
from tempest.api.share import base
from tempest import config_share as config
from tempest import exceptions
from tempest import test
CONF = config.CONF
@ -40,55 +39,55 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_1(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.256")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_2(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.1.1.-")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_3(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.4/33")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_4(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.*")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_5(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.*/23")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_6(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.1|23")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_7(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.1/-1")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_8(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "ip", "1.2.3.1/")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_with_wrong_level(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"],
'ip',
@ -111,7 +110,7 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesTest):
"active")
# try create duplicate of rule
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], access_type, access_to)
@ -137,32 +136,32 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_user_with_wrong_input_2(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "user",
"try+")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_user_with_empty_key(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "user", "")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_user_with_too_little_key(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "user", "abc")
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_user_with_too_big_key(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "user", "a" * 33)
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_user_with_wrong_input_1(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "user",
"try+")
@ -185,7 +184,7 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_with_wrong_level(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"],
'user',
@ -222,7 +221,7 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_type(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_access_rule,
self.share["id"], "wrong_type", "1.2.3.4")

View File

@ -13,16 +13,16 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log # noqa
import six # noqa
import testtools # noqa
from tempest.api.share import base
from tempest import config_share as config
from tempest.openstack.common import log as logging
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
LOG = log.getLogger(__name__)
class SecurityServiceListMixin(object):

View File

@ -105,7 +105,7 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
resp, share = self.create_share(share_network_id=fresh_sn["id"],
cleanup_in_class=False)
self.assertIn(int(resp["status"]), self.HTTP_SUCCESS)
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.cl.remove_sec_service_from_share_network,
fresh_sn["id"],
self.ss["id"])
@ -160,7 +160,7 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
self.assertIn(int(resp["status"]), self.HTTP_SUCCESS)
# Try delete ss, that has been assigned to some sn
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.cl.delete_security_service,
ss["id"], )

View File

@ -13,30 +13,29 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log # noqa
import six # noqa
from tempest_lib import exceptions as lib_exc # noqa
import testtools # noqa
from tempest.api.share import base
from tempest import config_share as config
from tempest import exceptions
from tempest.openstack.common import log as logging
from tempest import test
CONF = config.CONF
LOG = logging.getLogger(__name__)
LOG = log.getLogger(__name__)
class SecurityServicesNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative"])
def test_try_create_security_service_with_empty_type(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_security_service, "")
@test.attr(type=["gate", "smoke", "negative"])
def test_try_create_security_service_with_wrong_type(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_security_service,
"wrong_type")
@ -107,7 +106,7 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
"that leads to share-server creation error. "
"%s" % six.text_type(e))
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.update_security_service,
ss["id"],
user="new_user")
@ -129,6 +128,6 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative"])
def test_try_list_security_services_all_tenants(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_security_services,
params={'all_tenants': 1})

View File

@ -18,7 +18,6 @@ import testtools # noqa
from tempest.api.share import base
from tempest import config_share as config
from tempest import exceptions
from tempest import test
CONF = config.CONF
@ -65,7 +64,7 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
resp, share = self.create_share(cleanup_in_class=False)
self.assertIn(int(resp["status"]), self.HTTP_SUCCESS)
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.update_share_network,
self.shares_client.share_network_id,
neutron_net_id="new_net_id")
@ -87,27 +86,27 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative"])
def test_try_list_share_networks_all_tenants(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_share_networks_with_detail,
params={'all_tenants': 1})
@test.attr(type=["gate", "smoke", "negative"])
def test_try_list_share_networks_project_id(self):
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_share_networks_with_detail,
params={'project_id': 'some_project'})
@test.attr(type=["gate", "smoke", "negative"])
def test_try_list_share_networks_wrong_created_since_value(self):
self.assertRaises(
exceptions.BadRequest,
lib_exc.BadRequest,
self.shares_client.list_share_networks_with_detail,
params={'created_since': '2014-10-23T08:31:58.000000'})
@test.attr(type=["gate", "smoke", "negative"])
def test_try_list_share_networks_wrong_created_before_value(self):
self.assertRaises(
exceptions.BadRequest,
lib_exc.BadRequest,
self.shares_client.list_share_networks_with_detail,
params={'created_before': '2014-10-23T08:31:58.000000'})

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest_lib.common.utils import data_utils # noqa
import testtools # noqa
from tempest.api.share import base
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import test

View File

@ -18,7 +18,6 @@ import testtools # noqa
from tempest.api.share import base
from tempest import config_share as config
from tempest import exceptions
from tempest import share_exceptions
from tempest import test
@ -39,18 +38,18 @@ class SharesNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_invalid_protocol(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share,
share_protocol="nonexistent_protocol")
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_wrong_public_value(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, is_public='truebar')
@test.attr(type=["negative", "smoke", "gate", ])
def test_update_share_with_wrong_public_value(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_share, self.share["id"],
is_public="truebar")
@ -68,7 +67,7 @@ class SharesNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "smoke", "gate", ])
def test_list_shares_nonadmin_with_nonexistent_share_server_filter(self):
# filtering by share server allowed only for admins by default
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_shares_with_detail,
{'share_server_id': 'fake_share_server_id'})
@ -97,17 +96,17 @@ class SharesNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_invalid_size(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, size="#$%")
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_out_passing_size(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, size="")
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_zero_size(self):
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, size=0)
@test.attr(type=["negative", "gate", ])
@ -121,7 +120,7 @@ class SharesNegativeTest(base.BaseSharesTest):
self.create_snapshot_wait_for_active(share["id"])
# try delete share
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
self.shares_client.delete_share, share["id"])
@test.attr(type=["negative", "gate", ])
@ -143,7 +142,7 @@ class SharesNegativeTest(base.BaseSharesTest):
self.skip(skip_msg)
# try create share from snapshot with less size
self.assertRaises(exceptions.BadRequest,
self.assertRaises(lib_exc.BadRequest,
self.create_share,
size=1, snapshot_id=snap["id"],
cleanup_in_class=False)
@ -182,7 +181,7 @@ class SharesNegativeTest(base.BaseSharesTest):
# try create share with snapshot using another share-network
# 400 bad request is expected
self.assertRaises(
exceptions.BadRequest,
lib_exc.BadRequest,
self.create_share,
cleanup_in_class=False,
share_network_id=new_duplicated_sn["id"],
@ -193,14 +192,14 @@ class SharesNegativeTest(base.BaseSharesTest):
def test_update_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
self.assertRaises(lib_exc.Unauthorized, isolated_client.update_share,
self.assertRaises(lib_exc.Forbidden, isolated_client.update_share,
self.share["id"], name="new_name")
@test.attr(type=["gate", "smoke", "negative", ])
def test_delete_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
isolated_client.delete_share,
self.share['id'])
@ -208,7 +207,7 @@ class SharesNegativeTest(base.BaseSharesTest):
def test_set_metadata_of_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
isolated_client.set_metadata,
self.share['id'],
{'key': 'value'})
@ -217,7 +216,7 @@ class SharesNegativeTest(base.BaseSharesTest):
def test_update_metadata_of_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
isolated_client.update_all_metadata,
self.share['id'],
{'key': 'value'})
@ -226,7 +225,7 @@ class SharesNegativeTest(base.BaseSharesTest):
def test_delete_metadata_of_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
self.assertRaises(lib_exc.Unauthorized,
self.assertRaises(lib_exc.Forbidden,
isolated_client.delete_metadata,
self.share['id'],
'key')

View File

@ -116,24 +116,17 @@ ShareGroup = [
]
class TempestConfigPrivateManila(config.TempestConfigPrivate):
# manila's config wrap over standard config
def __init__(self, parse_conf=True):
super(TempestConfigPrivateManila, self).__init__()
config.register_opt_group(cfg.CONF, service_available_group,
ServiceAvailableGroup)
config.register_opt_group(cfg.CONF, share_group, ShareGroup)
self.share = cfg.CONF.share
class TempestConfigProxyManila(object):
_config = None
"""Wrapper over standard Tempest config that sets Manila opts."""
def __init__(self):
self._config = config.CONF
config.register_opt_group(
cfg.CONF, service_available_group, ServiceAvailableGroup)
config.register_opt_group(cfg.CONF, share_group, ShareGroup)
self._config.share = cfg.CONF.share
def __getattr__(self, attr):
if not self._config:
self._config = TempestConfigPrivateManila()
return getattr(self._config, attr)

View File

@ -18,10 +18,10 @@ import time
import urllib
import six # noqa
from tempest_lib.common.utils import data_utils # noqa
from tempest_lib import exceptions as lib_exc # noqa
from tempest.common import service_client
from tempest.common.utils import data_utils
from tempest import config_share as config
from tempest import exceptions
from tempest import share_exceptions