[Tempest] Stop using deprecated Tempest opts

Currently, Manila CI Tempest jobs use deprecated options of Tempest.
Recently, latest version of Tempest dropped them [1].
Manila CI jobs work ok, because they check out specific version of
Tempest. But it will work until first Devstack update for some one
more Tempest feature and then we will be forced to use latest Tempest
again. Switch to supported approach of setting up users in Tempest,
to avoid such sudden blockers.

[1] I8c24cd17f643083dde71ab2bd2a38417c54aeccb

Change-Id: I5b3ebab52ea1401f6f7a116d1260268eb10ebe0c
Closes-Bug: #1586129
This commit is contained in:
Valeriy Ponomaryov 2016-05-30 18:16:15 +03:00
parent 797bbcb303
commit 82a571c486
22 changed files with 414 additions and 428 deletions

View File

@ -23,7 +23,7 @@ sudo chmod -R o+rx $BASE/new/devstack/files
# Import devstack functions 'iniset', 'iniget' and 'trueorfalse'
source $BASE/new/devstack/functions
export TEMPEST_CONFIG=$BASE/new/tempest/etc/tempest.conf
export TEMPEST_CONFIG=${TEMPEST_CONFIG:-$BASE/new/tempest/etc/tempest.conf}
# === Handle script arguments ===
@ -120,13 +120,14 @@ if [[ "$MULTITENANCY_ENABLED" == "False" ]]; then
# threads to avoid errors for Cinder volume creations that appear
# because of lack of free space.
MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-8}
iniset $TEMPEST_CONFIG auth create_isolated_networks False
fi
# let us control if we die or not
set +o errexit
cd $BASE/new/tempest
export MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-20}
export MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-6}
export MANILA_TESTS=${MANILA_TESTS:-'manila_tempest_tests.tests.api'}
if [[ "$TEST_TYPE" == "scenario" ]]; then
@ -143,6 +144,7 @@ elif [[ "$DRIVER" == "generic" ]]; then
# per job using 'generic' share driver.
iniset $TEMPEST_CONFIG share enable_protocols nfs
fi
MANILA_TESTS="(^manila_tempest_tests.tests.api)(?=.*\[.*\bbackend\b.*\])"
fi
if [[ "$DRIVER" == "lvm" ]]; then
@ -193,30 +195,13 @@ iniset $TEMPEST_CONFIG share run_manage_unmanage_tests $RUN_MANILA_MANAGE_TESTS
# Enable manage/unmanage snapshot tests
iniset $TEMPEST_CONFIG share run_manage_unmanage_snapshot_tests $RUN_MANILA_MANAGE_SNAPSHOT_TESTS
# check if tempest plugin was installed correctly
echo 'import pkg_resources; print list(pkg_resources.iter_entry_points("tempest.test_plugins"))' | python
# Workaround for Tempest architectural changes
# See bugs:
# 1) https://bugs.launchpad.net/manila/+bug/1531049
# 2) https://bugs.launchpad.net/tempest/+bug/1524717
TEMPEST_CONFIG=${TEMPEST_CONFIG:-$TEMPEST_DIR/etc/tempest.conf}
ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-"admin"}
ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-"Default"}
ADMIN_PASSWORD=${ADMIN_PASSWORD:-"secretadmin"}
iniset $TEMPEST_CONFIG auth admin_username ${ADMIN_USERNAME:-"admin"}
iniset $TEMPEST_CONFIG auth admin_password $ADMIN_PASSWORD
iniset $TEMPEST_CONFIG auth admin_tenant_name $ADMIN_TENANT_NAME
iniset $TEMPEST_CONFIG auth admin_domain_name $ADMIN_DOMAIN_NAME
iniset $TEMPEST_CONFIG identity username ${TEMPEST_USERNAME:-"demo"}
iniset $TEMPEST_CONFIG identity password $ADMIN_PASSWORD
iniset $TEMPEST_CONFIG identity tenant_name ${TEMPEST_TENANT_NAME:-"demo"}
iniset $TEMPEST_CONFIG identity alt_username ${ALT_USERNAME:-"alt_demo"}
iniset $TEMPEST_CONFIG identity alt_password $ADMIN_PASSWORD
iniset $TEMPEST_CONFIG identity alt_tenant_name ${ALT_TENANT_NAME:-"alt_demo"}
iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4
iniset $TEMPEST_CONFIG validation network_for_ssh ${PRIVATE_NETWORK_NAME:-"private"}
# check if tempest plugin was installed correctly
echo 'import pkg_resources; print list(pkg_resources.iter_entry_points("tempest.test_plugins"))' | python
ADMIN_DOMAIN_NAME=${ADMIN_DOMAIN_NAME:-"Default"}
export OS_PROJECT_DOMAIN_NAME=$ADMIN_DOMAIN_NAME
export OS_USER_DOMAIN_NAME=$ADMIN_DOMAIN_NAME

View File

@ -21,6 +21,7 @@
source $BASE/new/devstack/functions
localrc_path=$BASE/new/devstack/localrc
local_conf_path=$BASE/new/devstack/local.conf
echo "DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION=1" >> $localrc_path
echo "API_RATE_LIMIT=False" >> $localrc_path
echo "TEMPEST_SERVICES+=,manila" >> $localrc_path
@ -68,6 +69,9 @@ MANILA_SERVICE_IMAGE_ENABLED=False
if [[ "$DRIVER" == "generic" ]]; then
MANILA_SERVICE_IMAGE_ENABLED=True
echo "SHARE_DRIVER=manila.share.drivers.generic.GenericShareDriver" >> $localrc_path
echo -e "[[post-config|${NOVA_CONF:-/etc/nova/nova.conf}]]\n[DEFAULT]\nquota_instances=30\n" >> $local_conf_path
echo -e "[[post-config|${NEUTRON_CONF:-/etc/neutron/neutron.conf}]]\n[DEFAULT]\nmax_fixed_ips_per_port=100\n" >> $local_conf_path
echo -e "[[post-config|${NEUTRON_CONF:-/etc/neutron/neutron.conf}]]\n[QUOTAS]\nquota_subnet=-1\n" >> $local_conf_path
elif [[ "$DRIVER" == "windows" ]]; then
MANILA_SERVICE_IMAGE_ENABLED=True
echo "SHARE_DRIVER=manila.share.drivers.windows.windows_smb_driver.WindowsSMBDriver" >> $localrc_path
@ -96,6 +100,10 @@ echo 'ENABLE_ISOLATED_METADATA=True' >> $localrc_path
cd $BASE/new/neutron-fwaas
git revert --no-edit a59df892d3f90f97c967a46b6c18e595d60a9b85
echo "TEMPEST_USE_TEST_ACCOUNTS=True" >> $localrc_path
echo "TEMPEST_ALLOW_TENANT_ISOLATION=False" >> $localrc_path
echo "TEMPEST_CONCURRENCY=8" >> $localrc_path
# Go to Tempest dir and checkout stable commit to avoid possible
# incompatibilities for plugin stored in Manila repo.
cd $BASE/new/tempest

View File

@ -1,45 +0,0 @@
# Copyright 2014 Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tempest import clients
from tempest.common import credentials_factory as common_creds
from manila_tempest_tests.services.share.json import shares_client
from manila_tempest_tests.services.share.v2.json import shares_client \
as shares_v2_client
class Manager(clients.Manager):
def __init__(
self,
credentials=common_creds.get_configured_credentials('user'),
service=None):
super(Manager, self).__init__(credentials, service)
self.shares_client = shares_client.SharesClient(self.auth_provider)
self.shares_v2_client = shares_v2_client.SharesV2Client(
self.auth_provider)
class AltManager(Manager):
def __init__(self, service=None):
super(AltManager, self).__init__(
common_creds.get_configured_credentials('alt_user'), service)
class AdminManager(Manager):
def __init__(self, service=None):
super(AdminManager, self).__init__(
common_creds.get_configured_credentials('identity_admin'),
service)

View File

@ -13,42 +13,42 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config # noqa
from tempest.lib import exceptions as lib_exc # noqa
from tempest import test # noqa
import testtools # noqa
from tempest import config
from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
class AdminActionsNegativeTest(base.BaseSharesAdminTest):
class AdminActionsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AdminActionsNegativeTest, cls).resource_setup()
cls.sh = cls.create_share()
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
cls.sh = cls.create_share(client=cls.admin_client)
cls.sh_instance = (
cls.shares_v2_client.get_instances_of_share(cls.sh["id"])[0]
cls.admin_client.get_instances_of_share(cls.sh["id"])[0]
)
if CONF.share.run_snapshot_tests:
cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
cls.member_shares_client = clients.Manager().shares_client
cls.member_shares_v2_client = clients.Manager().shares_v2_client
cls.sn = cls.create_snapshot_wait_for_active(
cls.sh["id"], client=cls.admin_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_reset_share_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.reset_state,
self.admin_client.reset_state,
self.sh["id"], status="fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_reset_share_instance_state_to_unacceptable_state(self):
self.assertRaises(
lib_exc.BadRequest,
self.shares_v2_client.reset_state,
self.admin_client.reset_state,
self.sh_instance["id"],
s_type="share_instances",
status="fake"
@ -59,21 +59,21 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
"Snapshot tests are disabled.")
def test_reset_snapshot_state_to_unacceptable_state(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.reset_state,
self.admin_client.reset_state,
self.sn["id"], s_type="snapshots", status="fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_reset_share_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.reset_state,
self.member_client.reset_state,
self.sh["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_reset_share_instance_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_v2_client.reset_state,
self.member_client.reset_state,
self.sh_instance["id"], s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ -82,21 +82,21 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
def test_try_reset_snapshot_state_with_member(self):
# Even if member from another tenant, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.reset_state,
self.member_client.reset_state,
self.sn["id"], s_type="snapshots")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
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.Forbidden,
self.member_shares_client.force_delete,
self.member_client.force_delete,
self.sh["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_force_delete_share_instance_with_member(self):
# If a non-admin tries to do force_delete, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_v2_client.force_delete,
self.member_client.force_delete,
self.sh_instance["id"], s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ -105,14 +105,14 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
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.Forbidden,
self.member_shares_client.force_delete,
self.member_client.force_delete,
self.sn["id"], s_type="snapshots")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_get_share_instance_with_member(self):
# If a non-admin tries to get instance, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_v2_client.get_share_instance,
self.member_client.get_share_instance,
self.sh_instance["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ -120,42 +120,43 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
# If a non-admin tries to list instances of given share, it should be
# unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_v2_client.get_instances_of_share,
self.member_client.get_instances_of_share,
self.sh['id'])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_reset_task_state_empty(self):
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.reset_task_state,
lib_exc.BadRequest, self.admin_client.reset_task_state,
self.sh['id'], None)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_reset_task_state_invalid_state(self):
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.reset_task_state,
lib_exc.BadRequest, self.admin_client.reset_task_state,
self.sh['id'], 'fake_state')
class AdminActionsAPIOnlyNegativeTest(base.BaseSharesAdminTest):
class AdminActionsAPIOnlyNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AdminActionsAPIOnlyNegativeTest, cls).resource_setup()
cls.member_shares_v2_client = clients.Manager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_instance_with_member(self):
# If a non-admin tries to list instances, it should be unauthorized
self.assertRaises(lib_exc.Forbidden,
self.member_shares_v2_client.list_share_instances)
self.member_client.list_share_instances)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@base.skip_if_microversion_lt("2.15")
def test_reset_task_state_share_not_found(self):
self.assertRaises(
lib_exc.NotFound, self.shares_v2_client.reset_task_state,
lib_exc.NotFound, self.admin_client.reset_task_state,
'fake_share', 'migration_error')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -163,35 +164,35 @@ class AdminActionsAPIOnlyNegativeTest(base.BaseSharesAdminTest):
"Snapshot tests are disabled.")
def test_force_delete_nonexistent_snapshot(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.force_delete,
self.admin_client.force_delete,
"fake",
s_type="snapshots")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_force_delete_nonexistent_share(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.force_delete, "fake")
self.admin_client.force_delete, "fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_force_delete_nonexistent_share_instance(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.force_delete,
self.admin_client.force_delete,
"fake",
s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_reset_nonexistent_share_state(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.reset_state, "fake")
self.admin_client.reset_state, "fake")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_reset_nonexistent_share_instance_state(self):
self.assertRaises(lib_exc.NotFound, self.shares_v2_client.reset_state,
self.assertRaises(lib_exc.NotFound, self.admin_client.reset_state,
"fake", s_type="share_instances")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_reset_nonexistent_snapshot_state(self):
self.assertRaises(lib_exc.NotFound, self.shares_client.reset_state,
self.assertRaises(lib_exc.NotFound, self.admin_client.reset_state,
"fake", s_type="snapshots")

View File

@ -20,7 +20,6 @@ import six
from tempest import config
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
from manila_tempest_tests import utils
@ -30,16 +29,16 @@ LATEST_MICROVERSION = CONF.share.max_api_microversion
@base.skip_if_microversion_not_supported("2.9")
@ddt.ddt
class ExportLocationsTest(base.BaseSharesAdminTest):
class ExportLocationsTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ExportLocationsTest, cls).resource_setup()
cls.admin_client = cls.shares_v2_client
cls.member_client = clients.Manager().shares_v2_client
cls.share = cls.create_share()
cls.share = cls.shares_v2_client.get_share(cls.share['id'])
cls.share_instances = cls.shares_v2_client.get_instances_of_share(
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
cls.share = cls.create_share(client=cls.admin_client)
cls.share = cls.admin_client.get_share(cls.share['id'])
cls.share_instances = cls.admin_client.get_instances_of_share(
cls.share['id'])
def _verify_export_location_structure(

View File

@ -17,23 +17,22 @@ from tempest import config
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@base.skip_if_microversion_not_supported("2.9")
class ExportLocationsNegativeTest(base.BaseSharesAdminTest):
class ExportLocationsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ExportLocationsNegativeTest, cls).resource_setup()
cls.admin_client = cls.shares_v2_client
cls.member_client = clients.Manager().shares_v2_client
cls.share = cls.create_share()
cls.share = cls.shares_v2_client.get_share(cls.share['id'])
cls.share_instances = cls.shares_v2_client.get_instances_of_share(
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
cls.share = cls.create_share(client=cls.admin_client)
cls.share = cls.admin_client.get_share(cls.share['id'])
cls.share_instances = cls.admin_client.get_instances_of_share(
cls.share['id'])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])

View File

@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config # noqa
from tempest import test # noqa
from tempest import config
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@ -29,7 +28,6 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest):
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
cls.os = clients.AdminManager()
super(SharesAdminQuotasTest, cls).resource_setup()
cls.user_id = cls.shares_v2_client.user_id
cls.tenant_id = cls.shares_v2_client.tenant_id
@ -73,7 +71,6 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
cls.os = clients.AdminManager()
super(SharesAdminQuotasUpdateTest, cls).resource_setup()
def setUp(self):

View File

@ -13,12 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config # noqa
from tempest.lib import exceptions as lib_exc # noqa
from tempest import test # noqa
import testtools # noqa
from tempest import config
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
@ -33,7 +31,6 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
if not CONF.share.run_quota_tests:
msg = "Quota tests are disabled."
raise cls.skipException(msg)
cls.os = clients.AdminManager()
super(SharesAdminQuotasNegativeTest, cls).resource_setup()
cls.user_id = cls.shares_client.user_id
cls.tenant_id = cls.shares_client.tenant_id

View File

@ -18,7 +18,6 @@ from tempest.lib.common.utils import data_utils
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@ -30,14 +29,15 @@ _MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationAdminTest(base.BaseSharesAdminTest):
class ReplicationAdminTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationAdminTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
cls.admin_client = clients.AdminManager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
@ -57,8 +57,9 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
cls.share_type = share_type["share_type"]
# Create share with above share_type
cls.share = cls.create_share(share_type_id=cls.share_type["id"],
availability_zone=cls.share_zone,)
cls.replica = cls.shares_v2_client.list_share_replicas(
availability_zone=cls.share_zone,
client=cls.admin_client)
cls.replica = cls.admin_client.list_share_replicas(
share_id=cls.share['id'])[0]
@staticmethod
@ -75,14 +76,16 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
msg = "Option backend_replication_type should be one of (%s)!"
raise self.skipException(
msg % ','.join(constants.REPLICATION_PROMOTION_CHOICES))
share = self.create_share(share_type_id=self.share_type['id'])
original_replica = self.shares_v2_client.list_share_replicas(
share = self.create_share(
share_type_id=self.share_type['id'], client=self.admin_client)
original_replica = self.admin_client.list_share_replicas(
share_id=share['id'])[0]
# NOTE(Yogi1): Cleanup needs to be disabled for replica that is
# being promoted since it will become the 'primary'/'active' replica.
replica = self.create_share_replica(share["id"], self.replica_zone,
cleanup=False)
replica = self.create_share_replica(
share["id"], self.replica_zone, cleanup=False,
client=self.admin_client)
# List replicas
replica_list = self.admin_client.list_share_replicas(
@ -96,7 +99,7 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
# Set replica_state to 'out_of_sync'
self.admin_client.reset_share_replica_state(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC)
self.shares_v2_client.wait_for_share_replica_status(
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC,
status_attr='replica_state')
@ -107,7 +110,7 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
self.addCleanup(self.delete_share_replica, original_replica['id'])
# Check if there is still only 1 'active' replica after promotion.
replica_list = self.shares_v2_client.list_share_replicas(
replica_list = self.admin_client.list_share_replicas(
share_id=self.share["id"])
new_active_replicas = self._filter_share_replica_list(
replica_list, constants.REPLICATION_STATE_ACTIVE)
@ -118,24 +121,25 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Test force deleting a replica that is in 'error_deleting' status."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
cleanup_in_class=False)
cleanup_in_class=False,
client=self.admin_client)
self.admin_client.reset_share_replica_status(
replica['id'], constants.STATUS_ERROR_DELETING)
self.shares_v2_client.wait_for_share_replica_status(
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.STATUS_ERROR_DELETING)
self.admin_client.force_delete_share_replica(replica['id'])
self.shares_v2_client.wait_for_resource_deletion(
replica_id=replica['id'])
self.admin_client.wait_for_resource_deletion(replica_id=replica['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_reset_share_replica_status(self):
"""Test resetting a replica's 'status' attribute."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
cleanup_in_class=False)
cleanup_in_class=False,
client=self.admin_client)
self.admin_client.reset_share_replica_status(replica['id'],
constants.STATUS_ERROR)
self.shares_v2_client.wait_for_share_replica_status(
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.STATUS_ERROR)
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ -143,10 +147,11 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Test resetting a replica's 'replica_state' attribute."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
cleanup_in_class=False)
cleanup_in_class=False,
client=self.admin_client)
self.admin_client.reset_share_replica_state(replica['id'],
constants.STATUS_ERROR)
self.shares_v2_client.wait_for_share_replica_status(
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.STATUS_ERROR, status_attr='replica_state')
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ -154,20 +159,21 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Test resyncing a replica."""
replica = self.create_share_replica(self.share['id'],
self.replica_zone,
cleanup_in_class=False)
self.shares_v2_client.wait_for_share_replica_status(
cleanup_in_class=False,
client=self.admin_client)
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_IN_SYNC,
status_attr='replica_state')
# Set replica_state to 'out_of_sync'.
self.admin_client.reset_share_replica_state(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC)
self.shares_v2_client.wait_for_share_replica_status(
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_OUT_OF_SYNC,
status_attr='replica_state')
# Attempt resync
self.admin_client.resync_share_replica(replica['id'])
self.shares_v2_client.wait_for_share_replica_status(
self.admin_client.wait_for_share_replica_status(
replica['id'], constants.REPLICATION_STATE_IN_SYNC,
status_attr='replica_state')

View File

@ -16,7 +16,6 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@ -31,14 +30,15 @@ _MIN_SUPPORTED_MICROVERSION = '2.11'
CONF.share.multitenancy_enabled,
"Only for driver_handles_share_servers = False driver mode.")
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationAdminTest(base.BaseSharesAdminTest):
class ReplicationAdminTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationAdminTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
cls.admin_client = clients.AdminManager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
@ -60,8 +60,9 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
# Create share with above share_type
cls.share = cls.create_share(size=2,
share_type_id=cls.share_type["id"],
availability_zone=cls.share_zone,)
cls.replica = cls.shares_v2_client.list_share_replicas(
availability_zone=cls.share_zone,
client=cls.admin_client)
cls.replica = cls.admin_client.list_share_replicas(
share_id=cls.share['id'])[0]
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@ -70,21 +71,21 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
def test_extend_replicated_share(self):
# Test extend share
new_size = self.share["size"] + 1
self.shares_v2_client.extend_share(self.share["id"], new_size)
self.shares_v2_client.wait_for_share_status(self.share["id"],
"available")
share = self.shares_v2_client.get_share(self.share["id"])
self.admin_client.extend_share(self.share["id"], new_size)
self.admin_client.wait_for_share_status(self.share["id"],
"available")
share = self.admin_client.get_share(self.share["id"])
self.assertEqual(new_size, int(share["size"]))
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_shrink_tests,
'Shrink share tests are disabled.')
def test_shrink_replicated_share(self):
share = self.shares_v2_client.get_share(self.share["id"])
share = self.admin_client.get_share(self.share["id"])
new_size = self.share["size"] - 1
self.shares_v2_client.shrink_share(self.share["id"], new_size)
self.shares_v2_client.wait_for_share_status(share["id"], "available")
shrink_share = self.shares_v2_client.get_share(self.share["id"])
self.admin_client.shrink_share(self.share["id"], new_size)
self.admin_client.wait_for_share_status(share["id"], "available")
shrink_share = self.admin_client.get_share(self.share["id"])
self.assertEqual(new_size, int(shrink_share["size"]))
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ -96,30 +97,31 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
share = self.create_share(size=2,
share_type_id=self.share_type["id"],
availability_zone=self.share_zone,
cleanup_in_class=True)
share = self.shares_v2_client.get_share(share["id"])
export_locations = self.shares_v2_client.list_share_export_locations(
cleanup_in_class=True,
client=self.admin_client)
share = self.admin_client.get_share(share["id"])
export_locations = self.admin_client.list_share_export_locations(
share["id"])
export_path = export_locations[0]['path']
self.shares_v2_client.unmanage_share(share['id'])
self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
self.admin_client.unmanage_share(share['id'])
self.admin_client.wait_for_resource_deletion(share_id=share['id'])
# Manage the previously unmanaged share
managed_share = self.shares_v2_client.manage_share(
managed_share = self.admin_client.manage_share(
share['host'], share['share_proto'],
export_path, self.share_type['id'])
self.shares_v2_client.wait_for_share_status(
self.admin_client.wait_for_share_status(
managed_share['id'], 'available')
# Add managed share to cleanup queue
self.method_resources.insert(
0, {'type': 'share', 'id': managed_share['id'],
'client': self.shares_v2_client})
'client': self.admin_client})
# Make sure a replica can be added to newly managed share
self.create_share_replica(managed_share['id'], self.replica_zone,
cleanup=True)
cleanup=True, client=self.admin_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_manage_unmanage_tests,
@ -128,10 +130,10 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Try to unmanage a share having replica."""
# Create a share replica before unmanaging the share
self.create_share_replica(self.share["id"], self.replica_zone,
cleanup=True)
cleanup=True, client=self.admin_client)
self.assertRaises(
lib_exc.Conflict,
self.shares_v2_client.unmanage_share,
self.admin_client.unmanage_share,
share_id=self.share['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ -141,9 +143,10 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Unmanage a replication type share that does not have replica."""
share = self.create_share(size=2,
share_type_id=self.share_type["id"],
availability_zone=self.share_zone,)
self.shares_v2_client.unmanage_share(share['id'])
self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
availability_zone=self.share_zone,
client=self.admin_client)
self.admin_client.unmanage_share(share['id'])
self.admin_client.wait_for_resource_deletion(share_id=share['id'])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_manage_unmanage_snapshot_tests,
@ -152,10 +155,10 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Try to manage a snapshot of the replicated."""
# Create a share replica before managing the snapshot
self.create_share_replica(self.share["id"], self.replica_zone,
cleanup=True)
cleanup=True, client=self.admin_client)
self.assertRaises(
lib_exc.Conflict,
self.shares_v2_client.manage_snapshot,
self.admin_client.manage_snapshot,
share_id=self.share['id'],
provider_location="127.0.0.1:/fake_provider_location/"
"manila_share_9dc61f49_fbc8_48d7_9337_2f9593d9")
@ -167,11 +170,12 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Try to unmanage a snapshot of the replicated share with replica."""
# Create a share replica before unmanaging the snapshot
self.create_share_replica(self.share["id"], self.replica_zone,
cleanup=True)
snapshot = self.create_snapshot_wait_for_active(self.share["id"])
cleanup=True, client=self.admin_client)
snapshot = self.create_snapshot_wait_for_active(
self.share["id"], client=self.admin_client)
self.assertRaises(
lib_exc.Conflict,
self.shares_v2_client.unmanage_snapshot,
self.admin_client.unmanage_snapshot,
snapshot_id=snapshot['id'])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@ -181,9 +185,11 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
"""Unmanage a snapshot of the replicated share with no replica."""
share = self.create_share(size=2,
share_type_id=self.share_type["id"],
availability_zone=self.share_zone,)
availability_zone=self.share_zone,
client=self.admin_client)
snapshot = self.create_snapshot_wait_for_active(share["id"])
self.shares_v2_client.unmanage_snapshot(snapshot_id=snapshot['id'])
self.shares_v2_client.wait_for_resource_deletion(
snapshot = self.create_snapshot_wait_for_active(
share["id"], client=self.admin_client)
self.admin_client.unmanage_snapshot(snapshot_id=snapshot['id'])
self.admin_client.wait_for_resource_deletion(
snapshot_id=snapshot['id'])

View File

@ -17,30 +17,29 @@ import ddt
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
@ddt.ddt
class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
class ServicesAdminNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ServicesAdminNegativeTest, cls).resource_setup()
user_clients = clients.Manager()
cls.user_shares_client = user_clients.shares_client
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_services_with_non_admin_user(self):
self.assertRaises(lib_exc.Forbidden,
self.user_shares_client.list_services)
self.member_client.list_services)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_params(self):
# All services are expected if send the request with invalid parameter
services = self.shares_client.list_services()
services = self.admin_client.list_services()
params = {'fake_param': 'fake_param_value'}
services_fake = self.shares_client.list_services(params)
services_fake = self.admin_client.list_services(params)
self.assertEqual(len(services), len(services_fake))
# "update_at" field could be updated before second request,
@ -58,31 +57,31 @@ class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_host(self):
params = {'host': 'fake_host'}
services_fake = self.shares_client.list_services(params)
services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_binary(self):
params = {'binary': 'fake_binary'}
services_fake = self.shares_client.list_services(params)
services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_zone(self):
params = {'zone': 'fake_zone'}
services_fake = self.shares_client.list_services(params)
services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_status(self):
params = {'status': 'fake_status'}
services_fake = self.shares_client.list_services(params)
services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_service_by_invalid_state(self):
params = {'state': 'fake_state'}
services_fake = self.shares_client.list_services(params)
services_fake = self.admin_client.list_services(params)
self.assertEqual(0, len(services_fake))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -96,6 +95,6 @@ class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
def test_list_services_with_wrong_versions(self, url, version):
self.assertRaises(
lib_exc.NotFound,
self.shares_v2_client.list_services,
self.admin_client.list_services,
version=version, url=url,
)

View File

@ -13,78 +13,78 @@
# 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 import test # noqa
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
class ShareServersNegativeAdminTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ShareServersNegativeAdminTest, cls).resource_setup()
cls.member_shares_client = clients.Manager().shares_client
cls.admin_client = cls.admin_shares_v2_client
cls.member_client = cls.shares_v2_client
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_servers_with_member(self):
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.list_share_servers)
self.member_client.list_share_servers)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_show_share_server_with_member(self):
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.show_share_server,
self.member_client.show_share_server,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_show_share_server_details_with_member(self):
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.show_share_server_details,
self.member_client.show_share_server_details,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_show_share_server_with_inexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.show_share_server,
self.admin_client.show_share_server,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_show_share_server_details_with_inexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.show_share_server_details,
self.admin_client.show_share_server_details,
'fake_id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_wrong_filter_key(self):
search_opts = {'fake_filter_key': 'ACTIVE'}
servers = self.shares_client.list_share_servers(search_opts)
servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_wrong_filter_value(self):
search_opts = {'host': 123}
servers = self.shares_client.list_share_servers(search_opts)
servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_status(self):
search_opts = {"status": data_utils.rand_name("fake_status")}
servers = self.shares_client.list_share_servers(search_opts)
servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_host(self):
search_opts = {"host": data_utils.rand_name("fake_host")}
servers = self.shares_client.list_share_servers(search_opts)
servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_project(self):
search_opts = {"project_id": data_utils.rand_name("fake_project_id")}
servers = self.shares_client.list_share_servers(search_opts)
servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -92,17 +92,17 @@ class ShareServersNegativeAdminTest(base.BaseSharesAdminTest):
search_opts = {
"share_network": data_utils.rand_name("fake_share_network"),
}
servers = self.shares_client.list_share_servers(search_opts)
servers = self.admin_client.list_share_servers(search_opts)
self.assertEqual(0, len(servers))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_share_server_with_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_server,
self.admin_client.delete_share_server,
"fake_nonexistent_share_server_id")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_share_server_with_member(self):
self.assertRaises(lib_exc.Forbidden,
self.member_shares_client.delete_share_server,
self.member_client.delete_share_server,
"fake_nonexistent_share_server_id")

View File

@ -13,32 +13,27 @@
# 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 import test # noqa
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
class ExtraSpecsAdminNegativeTest(base.BaseSharesMixedTest):
def _create_share_type(self):
name = data_utils.rand_name("unique_st_name")
extra_specs = self.add_required_extra_specs_to_dict({"key": "value"})
return self.create_share_type(name, extra_specs=extra_specs)
@classmethod
def resource_setup(cls):
super(ExtraSpecsAdminNegativeTest, cls).resource_setup()
cls.member_shares_client = clients.Manager().shares_client
return self.create_share_type(
name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_extra_specs_with_user(self):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.create_share_type_extra_specs,
self.shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "new_value"}))
@ -47,7 +42,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.get_share_type_extra_specs,
self.shares_v2_client.get_share_type_extra_specs,
st["share_type"]["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -55,7 +50,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.get_share_type_extra_spec,
self.shares_v2_client.get_share_type_extra_spec,
st["share_type"]["id"], "key")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -63,13 +58,13 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.get_share_type_extra_specs,
self.shares_v2_client.get_share_type_extra_specs,
st["share_type"]["id"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_read_extra_specs_on_share_type_with_user(self):
st = self._create_share_type()
share_type = self.member_shares_client.get_share_type(
share_type = self.shares_v2_client.get_share_type(
st['share_type']['id'])
# Verify a non-admin can only read the required extra-specs
expected_keys = ['driver_handles_share_servers', 'snapshot_support']
@ -83,7 +78,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.update_share_type_extra_spec,
self.shares_v2_client.update_share_type_extra_spec,
st["share_type"]["id"], "key", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -91,7 +86,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.update_share_type_extra_specs,
self.shares_v2_client.update_share_type_extra_specs,
st["share_type"]["id"], {"key": "new_value"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -99,7 +94,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.Forbidden,
self.member_shares_client.delete_share_type_extra_spec,
self.shares_v2_client.delete_share_type_extra_spec,
st["share_type"]["id"], "key")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -108,7 +103,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
self.admin_shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({too_big_key: "value"}))
@ -118,7 +113,7 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
st = self._create_share_type()
self.assertRaises(
lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
self.admin_shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": too_big_value}))
@ -126,12 +121,12 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_set_too_long_value_with_update(self):
too_big_value = "v" * 256
st = self._create_share_type()
self.shares_client.create_share_type_extra_specs(
self.admin_shares_v2_client.create_share_type_extra_specs(
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "value"}))
self.assertRaises(
lib_exc.BadRequest,
self.shares_client.update_share_type_extra_specs,
self.admin_shares_v2_client.update_share_type_extra_specs,
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": too_big_value}))
@ -139,143 +134,164 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
def test_try_set_too_long_value_with_update_of_one_key(self):
too_big_value = "v" * 256
st = self._create_share_type()
self.shares_client.create_share_type_extra_specs(
self.admin_shares_v2_client.create_share_type_extra_specs(
st["share_type"]["id"],
self.add_required_extra_specs_to_dict({"key": "value"}))
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_share_type_extra_spec,
st["share_type"]["id"], "key", too_big_value)
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.update_share_type_extra_spec,
st["share_type"]["id"], "key", too_big_value)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_es_with_empty_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type_extra_specs, "")
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_specs, "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_es_with_invalid_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type_extra_specs,
data_utils.rand_name("fake"))
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_specs,
data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_empty_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_share_type_extra_specs,
"", {"key1": "value1", })
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.create_share_type_extra_specs,
"", {"key1": "value1", })
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_invalid_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_share_type_extra_specs,
data_utils.rand_name("fake"), {"key1": "value1", })
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.create_share_type_extra_specs,
data_utils.rand_name("fake"), {"key1": "value1", })
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_empty_specs(self):
st = self._create_share_type()
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
st["share_type"]["id"], "")
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"], "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_es_with_invalid_specs(self):
st = self._create_share_type()
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share_type_extra_specs,
st["share_type"]["id"], {"": "value_with_empty_key"})
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.create_share_type_extra_specs,
st["share_type"]["id"], {"": "value_with_empty_key"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_spec_with_empty_key(self):
st = self._create_share_type()
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type_extra_spec,
st["share_type"]["id"], "")
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_spec,
st["share_type"]["id"], "")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_spec_with_invalid_key(self):
st = self._create_share_type()
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type_extra_spec,
st["share_type"]["id"], data_utils.rand_name("fake"))
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_spec,
st["share_type"]["id"], data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_specs_with_empty_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type_extra_specs,
"")
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_specs,
"")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_specs_with_invalid_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type_extra_specs,
data_utils.rand_name("fake"))
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.get_share_type_extra_specs,
data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_es_key_with_empty_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_type_extra_spec,
"", "key", )
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.delete_share_type_extra_spec,
"", "key", )
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_es_key_with_invalid_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_type_extra_spec,
data_utils.rand_name("fake"), "key", )
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.delete_share_type_extra_spec,
data_utils.rand_name("fake"), "key", )
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_with_invalid_key(self):
st = self._create_share_type()
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_type_extra_spec,
st["share_type"]["id"], data_utils.rand_name("fake"))
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.delete_share_type_extra_spec,
st["share_type"]["id"], data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_spec_with_empty_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_share_type_extra_spec,
"", "key", "new_value")
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.update_share_type_extra_spec,
"", "key", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_spec_with_invalid_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_share_type_extra_spec,
data_utils.rand_name("fake"), "key", "new_value")
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.update_share_type_extra_spec,
data_utils.rand_name("fake"), "key", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_spec_with_empty_key(self):
st = self._create_share_type()
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_share_type_extra_spec,
st["share_type"]["id"], "", "new_value")
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.update_share_type_extra_spec,
st["share_type"]["id"], "", "new_value")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_with_invalid_shr_type_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_share_type_extra_specs,
data_utils.rand_name("fake"), {"key": "new_value"})
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.update_share_type_extra_specs,
data_utils.rand_name("fake"), {"key": "new_value"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_with_invalid_specs(self):
st = self._create_share_type()
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_share_type_extra_specs,
st["share_type"]["id"], {"": "new_value"})
self.assertRaises(
lib_exc.BadRequest,
self.admin_shares_v2_client.update_share_type_extra_specs,
st["share_type"]["id"], {"": "new_value"})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_spec_driver_handles_share_servers(self):
st = self._create_share_type()
# Try delete extra spec 'driver_handles_share_servers'
self.assertRaises(lib_exc.Forbidden,
self.shares_client.delete_share_type_extra_spec,
st["share_type"]["id"],
"driver_handles_share_servers")
self.assertRaises(
lib_exc.Forbidden,
self.admin_shares_v2_client.delete_share_type_extra_spec,
st["share_type"]["id"],
"driver_handles_share_servers")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_spec_snapshot_support(self):
st = self._create_share_type()
# Try delete extra spec 'snapshot_support'
self.assertRaises(lib_exc.Forbidden,
self.shares_client.delete_share_type_extra_spec,
st["share_type"]["id"],
"snapshot_support")
self.assertRaises(
lib_exc.Forbidden,
self.admin_shares_v2_client.delete_share_type_extra_spec,
st["share_type"]["id"],
"snapshot_support")

View File

@ -13,52 +13,51 @@
# 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 import test # noqa
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
class ShareTypesAdminNegativeTest(base.BaseSharesAdminTest):
class ShareTypesAdminNegativeTest(base.BaseSharesMixedTest):
def _create_share_type(self):
name = data_utils.rand_name("unique_st_name")
extra_specs = self.add_required_extra_specs_to_dict({"key": "value"})
return self.create_share_type(name, extra_specs=extra_specs)
@classmethod
def resource_setup(cls):
super(ShareTypesAdminNegativeTest, cls).resource_setup()
cls.member_shares_client = clients.Manager().shares_client
return self.create_share_type(
name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_nonexistent_share_type(self):
self.assertRaises(lib_exc.NotFound,
self.create_share,
self.admin_shares_v2_client.create_share,
share_type_id=data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_type_with_empty_name(self):
self.assertRaises(lib_exc.BadRequest, self.create_share_type, '')
self.assertRaises(
lib_exc.BadRequest,
self.create_share_type, '',
client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_type_with_too_big_name(self):
self.assertRaises(lib_exc.BadRequest,
self.create_share_type,
"x" * 256)
"x" * 256,
client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_type,
self.admin_shares_v2_client.get_share_type,
data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_type,
self.admin_shares_v2_client.delete_share_type,
data_utils.rand_name("fake"))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ -67,34 +66,37 @@ class ShareTypesAdminNegativeTest(base.BaseSharesAdminTest):
self.assertRaises(lib_exc.Conflict,
self.create_share_type,
st["share_type"]["name"],
extra_specs=self.add_required_extra_specs_to_dict())
extra_specs=self.add_required_extra_specs_to_dict(),
client=self.admin_shares_v2_client)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_share_type_allowed_for_public(self):
st = self._create_share_type()
self.assertRaises(lib_exc.Conflict,
self.shares_client.add_access_to_share_type,
self.admin_shares_v2_client.add_access_to_share_type,
st["share_type"]["id"],
self.shares_client.tenant_id)
self.admin_shares_v2_client.tenant_id)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_remove_share_type_allowed_for_public(self):
st = self._create_share_type()
self.assertRaises(lib_exc.Conflict,
self.shares_client.remove_access_from_share_type,
st["share_type"]["id"],
self.shares_client.tenant_id)
self.assertRaises(
lib_exc.Conflict,
self.admin_shares_v2_client.remove_access_from_share_type,
st["share_type"]["id"],
self.admin_shares_v2_client.tenant_id)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.add_access_to_share_type,
self.admin_shares_v2_client.add_access_to_share_type,
data_utils.rand_name("fake"),
self.shares_client.tenant_id)
self.admin_shares_v2_client.tenant_id)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_remove_share_type_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.remove_access_from_share_type,
data_utils.rand_name("fake"),
self.shares_client.tenant_id)
self.assertRaises(
lib_exc.NotFound,
self.admin_shares_v2_client.remove_access_from_share_type,
data_utils.rand_name("fake"),
self.admin_shares_v2_client.tenant_id)

View File

@ -21,6 +21,7 @@ import traceback
from oslo_concurrency import lockutils
from oslo_log import log
import six
from tempest import clients
from tempest.common import credentials_factory as common_creds
from tempest.common import dynamic_creds
from tempest import config
@ -28,8 +29,10 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests.services.share.json import shares_client
from manila_tempest_tests.services.share.v2.json import (
shares_client as shares_v2_client)
from manila_tempest_tests import share_exceptions
from manila_tempest_tests import utils
@ -118,6 +121,7 @@ skip_if_microversion_lt = utils.skip_if_microversion_lt
class BaseSharesTest(test.BaseTestCase):
"""Base test case class for all Manila API tests."""
credentials = ('primary', )
force_tenant_isolation = False
protocols = ["nfs", "cifs", "glusterfs", "hdfs", "cephfs"]
@ -178,15 +182,15 @@ class BaseSharesTest(test.BaseTestCase):
elif "alt" in type_of_creds:
creds = ic.get_alt_creds()
else:
creds = ic.self.get_credentials(type_of_creds)
creds = ic.get_credentials(type_of_creds)
ic.type_of_creds = type_of_creds
# create client with isolated creds
os = clients.Manager(credentials=creds)
if client_version == '1':
client = os.shares_client
client = shares_client.SharesClient(os.auth_provider)
elif client_version == '2':
client = os.shares_v2_client
client = shares_v2_client.SharesV2Client(os.auth_provider)
# Set place where will be deleted isolated creds
ic_res = {
@ -222,6 +226,23 @@ class BaseSharesTest(test.BaseTestCase):
msg = "Missing API credentials in configuration."
raise cls.skipException(msg)
@classmethod
def setup_clients(cls):
super(BaseSharesTest, cls).setup_clients()
os = getattr(cls, 'os_%s' % cls.credentials[0])
os.shares_client = shares_client.SharesClient(os.auth_provider)
cls.shares_client = os.shares_client
os.shares_v2_client = shares_v2_client.SharesV2Client(
os.auth_provider)
cls.shares_v2_client = os.shares_v2_client
if CONF.share.multitenancy_enabled:
if not CONF.service_available.neutron:
raise cls.skipException("Neutron support is required")
share_network_id = cls.provide_share_network(
cls.shares_v2_client, os.networks_client)
cls.shares_client.share_network_id = share_network_id
cls.shares_v2_client.share_network_id = share_network_id
@classmethod
def resource_setup(cls):
if not (any(p in CONF.share.enable_protocols
@ -230,22 +251,6 @@ class BaseSharesTest(test.BaseTestCase):
skip_msg = "Manila is disabled"
raise cls.skipException(skip_msg)
super(BaseSharesTest, cls).resource_setup()
if not hasattr(cls, "os"):
cls.username = CONF.identity.username
cls.password = CONF.identity.password
cls.project_name = CONF.identity.project_name
cls.verify_nonempty(cls.username, cls.password, cls.project_name)
cls.os = clients.Manager()
if CONF.share.multitenancy_enabled:
if not CONF.service_available.neutron:
raise cls.skipException("Neutron support is required")
sc = cls.os.shares_client
nc = cls.os.networks_client
share_network_id = cls.provide_share_network(sc, nc)
cls.os.shares_client.share_network_id = share_network_id
cls.os.shares_v2_client.share_network_id = share_network_id
cls.shares_client = cls.os.shares_client
cls.shares_v2_client = cls.os.shares_v2_client
def setUp(self):
super(BaseSharesTest, self).setUp()
@ -418,8 +423,7 @@ class BaseSharesTest(test.BaseTestCase):
:returns: list -- list of shares created using provided data.
"""
data = [copy.deepcopy(d) for d in share_data_list]
for d in data:
for d in share_data_list:
if not isinstance(d, dict):
raise exceptions.TempestException(
"Expected 'dict', got '%s'" % type(d))
@ -431,11 +435,20 @@ class BaseSharesTest(test.BaseTestCase):
raise exceptions.TempestException(
"Expected only 'args' and 'kwargs' keys. "
"Provided %s" % list(d))
d["kwargs"]["client"] = d["kwargs"].get(
"client", cls.shares_v2_client)
d["share"] = cls._create_share(*d["args"], **d["kwargs"])
d["cnt"] = 0
d["available"] = False
data = []
for d in share_data_list:
client = d["kwargs"].pop("client", cls.shares_v2_client)
local_d = {
"args": d["args"],
"kwargs": copy.deepcopy(d["kwargs"]),
}
local_d["kwargs"]["client"] = client
local_d["share"] = cls._create_share(
*local_d["args"], **local_d["kwargs"])
local_d["cnt"] = 0
local_d["available"] = False
data.append(local_d)
while not all(d["available"] for d in data):
for d in data:
@ -836,36 +849,38 @@ class BaseSharesTest(test.BaseTestCase):
class BaseSharesAltTest(BaseSharesTest):
"""Base test case class for all Shares Alt API tests."""
@classmethod
def resource_setup(cls):
cls.username = CONF.identity.alt_username
cls.password = CONF.identity.alt_password
cls.project_name = CONF.identity.alt_project_name
cls.verify_nonempty(cls.username, cls.password, cls.project_name)
cls.os = clients.AltManager()
alt_share_network_id = CONF.share.alt_share_network_id
cls.os.shares_client.share_network_id = alt_share_network_id
cls.os.shares_v2_client.share_network_id = alt_share_network_id
super(BaseSharesAltTest, cls).resource_setup()
credentials = ('alt', )
class BaseSharesAdminTest(BaseSharesTest):
"""Base test case class for all Shares Admin API tests."""
credentials = ('admin', )
class BaseSharesMixedTest(BaseSharesTest):
"""Base test case class for all Shares API tests with all user roles."""
credentials = ('primary', 'alt', 'admin')
@classmethod
def resource_setup(cls):
if hasattr(CONF.identity, 'admin_username'):
cls.username = CONF.identity.admin_username
cls.password = CONF.identity.admin_password
cls.project_name = CONF.identity.admin_project_name
else:
cls.username = CONF.auth.admin_username
cls.password = CONF.auth.admin_password
cls.project_name = CONF.auth.admin_project_name
cls.verify_nonempty(cls.username, cls.password, cls.project_name)
cls.os = clients.AdminManager()
admin_share_network_id = CONF.share.admin_share_network_id
cls.os.shares_client.share_network_id = admin_share_network_id
cls.os.shares_v2_client.share_network_id = admin_share_network_id
super(BaseSharesAdminTest, cls).resource_setup()
def setup_clients(cls):
super(BaseSharesMixedTest, cls).setup_clients()
cls.admin_shares_client = shares_client.SharesClient(
cls.os_admin.auth_provider)
cls.admin_shares_v2_client = shares_v2_client.SharesV2Client(
cls.os_admin.auth_provider)
cls.alt_shares_client = shares_client.SharesClient(
cls.os_alt.auth_provider)
cls.alt_shares_v2_client = shares_v2_client.SharesV2Client(
cls.os_alt.auth_provider)
if CONF.share.multitenancy_enabled:
admin_share_network_id = cls.provide_share_network(
cls.admin_shares_v2_client, cls.os_admin.networks_client)
cls.admin_shares_client.share_network_id = admin_share_network_id
cls.admin_shares_v2_client.share_network_id = (
admin_share_network_id)
alt_share_network_id = cls.provide_share_network(
cls.alt_shares_v2_client, cls.os_alt.networks_client)
cls.alt_shares_client.share_network_id = alt_share_network_id
cls.alt_shares_v2_client.share_network_id = alt_share_network_id

View File

@ -18,7 +18,6 @@ from tempest.lib.common.utils import data_utils
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@ -34,14 +33,14 @@ DETAIL_KEYS = SUMMARY_KEYS + ['availability_zone', 'host', 'updated_at',
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationTest(base.BaseSharesTest):
class ReplicationTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
cls.admin_client = clients.AdminManager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:
@ -288,14 +287,14 @@ class ReplicationTest(base.BaseSharesTest):
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationActionsTest(base.BaseSharesTest):
class ReplicationActionsTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationActionsTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
cls.admin_client = clients.AdminManager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:

View File

@ -19,7 +19,6 @@ from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@ -31,14 +30,14 @@ _MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationNegativeTest(base.BaseSharesTest):
class ReplicationNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationNegativeTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
cls.admin_client = clients.AdminManager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:

View File

@ -18,7 +18,6 @@ from tempest.lib.common.utils import data_utils
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.common import constants
from manila_tempest_tests import share_exceptions
from manila_tempest_tests.tests.api import base
@ -32,14 +31,14 @@ _MIN_SUPPORTED_MICROVERSION = '2.11'
@testtools.skipUnless(CONF.share.run_snapshot_tests,
'Snapshot tests disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationSnapshotTest(base.BaseSharesTest):
class ReplicationSnapshotTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(ReplicationSnapshotTest, cls).resource_setup()
# Create share_type
name = data_utils.rand_name(constants.TEMPEST_MANILA_PREFIX)
cls.admin_client = clients.AdminManager().shares_v2_client
cls.admin_client = cls.admin_shares_v2_client
cls.replication_type = CONF.share.backend_replication_type
if cls.replication_type not in constants.REPLICATION_TYPE_CHOICES:

View File

@ -58,7 +58,7 @@ class SecurityServiceListMixin(object):
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_list_security_services_filter_by_share_network(self):
sn = self.shares_client.get_share_network(
self.os.shares_client.share_network_id)
self.shares_client.share_network_id)
fresh_sn = []
for i in range(2):
sn = self.create_share_network(
@ -163,7 +163,7 @@ class SecurityServicesTest(base.BaseSharesTest,
ss = self.create_security_service(**ss_data)
sn = self.shares_client.get_share_network(
self.os.shares_client.share_network_id)
self.shares_client.share_network_id)
fresh_sn = self.create_share_network(
neutron_net_id=sn["neutron_net_id"],
neutron_subnet_id=sn["neutron_subnet_id"])

View File

@ -13,15 +13,14 @@
# 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 import test # noqa
from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
from tempest import test
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
class ShareTypesNegativeTest(base.BaseSharesTest):
class ShareTypesNegativeTest(base.BaseSharesMixedTest):
@classmethod
def _create_share_type(cls):
@ -29,11 +28,12 @@ class ShareTypesNegativeTest(base.BaseSharesTest):
extra_specs = cls.add_required_extra_specs_to_dict()
return cls.create_share_type(
name, extra_specs=extra_specs,
client=clients.AdminManager().shares_client)
client=cls.admin_client)
@classmethod
def resource_setup(cls):
super(ShareTypesNegativeTest, cls).resource_setup()
cls.admin_client = cls.admin_shares_v2_client
cls.st = cls._create_share_type()
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])

View File

@ -13,21 +13,21 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest import config # noqa
from tempest.lib import exceptions as lib_exc # noqa
from tempest import test # noqa
import testtools # noqa
from tempest import config
from tempest.lib import exceptions as lib_exc
from tempest import test
import testtools
from manila_tempest_tests import clients_share as clients
from manila_tempest_tests.tests.api import base
CONF = config.CONF
class SharesActionsNegativeTest(base.BaseSharesTest):
class SharesActionsNegativeTest(base.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(SharesActionsNegativeTest, cls).resource_setup()
cls.admin_client = cls.admin_shares_v2_client
cls.share = cls.create_share(
size=1,
)
@ -85,8 +85,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
new_size = int(share['size']) + 1
# set "error" state
admin_client = clients.AdminManager().shares_client
admin_client.reset_state(share['id'])
self.admin_client.reset_state(share['id'])
# run extend operation on same share and check result
self.assertRaises(lib_exc.BadRequest,
@ -129,8 +128,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
new_size = int(share['size']) - 1
# set "error" state
admin_client = clients.AdminManager().shares_client
admin_client.reset_state(share['id'])
self.admin_client.reset_state(share['id'])
# run shrink operation on same share and check result
self.assertRaises(lib_exc.BadRequest,

View File

@ -16,32 +16,38 @@
from oslo_log import log
import six
from tempest.common.utils.linux import remote_client # noqa
from tempest import config # noqa
from tempest.common.utils.linux import remote_client
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.scenario import manager # noqa
from tempest.scenario import manager
from manila_tempest_tests import clients_share
from manila_tempest_tests.services.share.json import shares_client
from manila_tempest_tests.services.share.v2.json import (
shares_client as shares_v2_client)
CONF = config.CONF
LOG = log.getLogger(__name__)
class ShareScenarioTest(manager.NetworkScenarioTest):
"""Provide harness to do Manila scenario tests."""
credentials = ('admin', 'primary')
@classmethod
def resource_setup(cls):
cls.set_network_resources()
super(ShareScenarioTest, cls).resource_setup()
# Manila clients
cls.shares_client = clients_share.Manager().shares_client
cls.shares_v2_client = clients_share.Manager().shares_v2_client
cls.shares_admin_client = clients_share.AdminManager().shares_client
cls.shares_admin_v2_client = (
clients_share.AdminManager().shares_v2_client)
cls.shares_client = shares_client.SharesClient(
cls.os_primary.auth_provider)
cls.shares_v2_client = shares_v2_client.SharesV2Client(
cls.os_primary.auth_provider)
cls.shares_admin_client = shares_client.SharesClient(
cls.os_admin.auth_provider)
cls.shares_admin_v2_client = shares_v2_client.SharesV2Client(
cls.os_admin.auth_provider)
def _create_share(self, share_protocol=None, size=1, name=None,
snapshot_id=None, description=None, metadata=None,