[Tempest] Backport Tempest compatibility fixes

Mitaka version of Manila plugin for Tempest is not compatible
anymore. So, we need to port group of fixes from master branch.
Ported fixes in order of merge in master branch:

[1] I9ae105eaa527621c85d5038bba15edf4b065eaa3
[2] I5b3ebab52ea1401f6f7a116d1260268eb10ebe0c
[3] I44655c83cc5588c5b94d0fad81162dd0c238b5b4

Change-Id: Ib6006034f9be5d811880d10c8ee67143a9ab6af1
Closes-Bug: #1595234
This commit is contained in:
vponomaryov 2016-06-22 18:42:22 +03:00
parent beebb3833d
commit 24f2841105
67 changed files with 1364 additions and 1147 deletions

View File

@ -1,6 +1,6 @@
# Environment variables
export MANILA_TEMPEST_COMMIT="aff9cc07" # 10 May, 2016
export MANILA_TEMPEST_COMMIT="df784408" # 7 June, 2016
# ----------------------------------------------

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=$BASE/new/tempest/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
@ -92,6 +96,7 @@ echo "MANILA_SERVICE_IMAGE_ENABLED=$MANILA_SERVICE_IMAGE_ENABLED" >> $localrc_pa
# created vm's in scenario tests.
echo 'ENABLE_ISOLATED_METADATA=True' >> $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.

View File

@ -28,6 +28,7 @@ Programming HowTos and Tutorials
development.environment
unit_tests
tempest_tests
addmethod.openstackapi

View File

@ -0,0 +1,166 @@
Tempest Tests
=============
Manila stores tempest tests as plugin under ``manila_tempest_tests`` directory.
It contains functional and scenario tests.
Installation of plugin to tempest
---------------------------------
Tempest plugin installation is common for all its plugins and detailed
information can be found in its `docs`_.
In simple words: if you have installed manila project on the same machine as
tempest, then tempest will find it.
.. _docs: http://docs.openstack.org/developer/tempest/plugin.html#using-plugins
Configuration of manila-related tests in tempest.conf
-----------------------------------------------------
All config options for manila are defined in ``manila_tempest_tests/config.py``
module. They can be set/redefined in ``tempest.conf`` file.
Here is a configuration example:
.. code-block:: ini
[service_available]
manila = True
[share]
# Capabilities
capability_storage_protocol = NFS
capability_snapshot_support = True
backend_names = Backendname1,BackendName2
backend_replication_type = readable
# Enable/Disable test groups
multi_backend = True
multitenancy_enabled = True
enable_protocols = nfs,cifs,glusterfs,cephfs
enable_ip_rules_for_protocols = nfs
enable_user_rules_for_protocols = cifs
enable_cert_rules_for_protocols = glusterfs
enable_cephx_rules_for_protocols = cephfs
username_for_user_rules = foouser
enable_ro_access_level_for_protocols = nfs
run_quota_tests = True
run_extend_tests = True
run_shrink_tests = True
run_snapshot_tests = True
run_consistency_group_tests = True
run_replication_tests = True
run_migration_tests = True
run_manage_unmanage_tests = True
run_manage_unmanage_snapshot_tests = True
.. note::
None of existing share drivers support all features. So, make sure
that share backends really support features you enable in config.
Running tests
-------------
To run tests, it is required to install `pip`_, `tox`_ and `virtualenv`_
packages on host machine. Then run following command
from tempest root directory:
.. code-block:: console
$ tox -e all-plugin -- manila_tempest_tests.tests.api
or to run only scenario tests:
.. code-block:: console
$ tox -e all-plugin -- manila_tempest_tests.tests.scenario
.. _pip: https://pypi.python.org/pypi/pip
.. _tox: https://pypi.python.org/pypi/tox
.. _virtualenv: https://pypi.python.org/pypi/virtualenv
Running a subset of tests based on test location
------------------------------------------------
Instead of running all tests, you can specify an individual directory, file,
class, or method that contains test code.
To run the tests in the ``manila_tempest_tests/tests/api/admin`` directory:
.. code-block:: console
$ tox -e all-plugin -- manila_tempest_tests.tests.api.admin
To run the tests in the
``manila_tempest_tests/tests/api/admin/test_admin_actions.py`` module:
.. code-block:: console
$ tox -e all-plugin -- manila_tempest_tests.tests.api.admin.test_admin_actions
To run the tests in the `AdminActionsTest` class in
``manila_tempest_tests/tests/api/admin/test_admin_actions.py`` module:
.. code-block:: console
$ tox -e all-plugin -- manila_tempest_tests.tests.api.admin.test_admin_actions.AdminActionsTest
To run the `AdminActionsTest.test_reset_share_state` test method in
``manila_tempest_tests/tests/api/admin/test_admin_actions.py`` module:
.. code-block:: console
$ tox -e all-plugin -- manila_tempest_tests.tests.api.admin.test_admin_actions.AdminActionsTest.test_reset_share_state
Running a subset of tests based on service involvement
------------------------------------------------------
To run the tests that require only `manila-api` service running:
.. code-block:: console
$ tox -e all-plugin -- \
\(\?\=\.\*\\\[\.\*\\bapi\\b\.\*\\\]\) \
\(\^manila_tempest_tests.tests.api\)
To run the tests that require all manila services running,
but intended to test API behaviour:
.. code-block:: console
$ tox -e all-plugin -- \
\(\?\=\.\*\\\[\.\*\\b\(api\|api_with_backend\)\\b\.\*\\\]\) \
\(\^manila_tempest_tests.tests.api\)
To run the tests that require all manila services running,
but intended to test back-end (manila-share) behaviour:
.. code-block:: console
$ tox -e all-plugin -- \
\(\?\=\.\*\\\[\.\*\\bbackend\\b\.\*\\\]\) \
\(\^manila_tempest_tests.tests.api\)
Running a subset of positive or negative tests
----------------------------------------------
To run only positive tests, use following command:
.. code-block:: console
$ tox -e all-plugin -- \
\(\?\=\.\*\\\[\.\*\\bpositive\\b\.\*\\\]\) \
\(\^manila_tempest_tests.tests.api\)
To run only negative tests, use following command:
.. code-block:: console
$ tox -e all-plugin -- \
\(\?\=\.\*\\\[\.\*\\bnegative\\b\.\*\\\]\) \
\(\^manila_tempest_tests.tests.api\)
To run only positive API tests, use following command:
.. code-block:: console
$ tox -e all-plugin -- \
\(\?\=\.\*\\\[\.\*\\bpositive\\b\.\*\\\]\) \
\(\?\=\.\*\\\[\.\*\\bapi\\b\.\*\\\]\) \
\(\^manila_tempest_tests.tests.api\)

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

@ -39,13 +39,13 @@ class AdminActionsTest(base.BaseSharesAdminTest):
if CONF.share.run_snapshot_tests:
cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_reset_share_state(self):
for status in self.states:
self.shares_v2_client.reset_state(self.sh["id"], status=status)
self.shares_v2_client.wait_for_share_status(self.sh["id"], status)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_reset_share_instance_state(self):
id = self.sh_instance["id"]
for status in self.states:
@ -53,7 +53,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
id, s_type="share_instances", status=status)
self.shares_v2_client.wait_for_share_instance_status(id, status)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_reset_snapshot_state_to_error(self):
@ -63,7 +63,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
self.shares_v2_client.wait_for_snapshot_status(
self.sn["id"], status)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_force_delete_share(self):
share = self.create_share()
@ -78,7 +78,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
self.shares_v2_client.force_delete(share["id"])
self.shares_v2_client.wait_for_resource_deletion(share_id=share["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_force_delete_share_instance(self):
share = self.create_share(cleanup_in_class=False)
instances = self.shares_v2_client.get_instances_of_share(share["id"])
@ -101,7 +101,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
self.shares_v2_client.wait_for_resource_deletion(
share_instance_id=instance["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_force_delete_snapshot(self):
@ -119,7 +119,7 @@ class AdminActionsTest(base.BaseSharesAdminTest):
self.shares_v2_client.force_delete(sn["id"], s_type="snapshots")
self.shares_v2_client.wait_for_resource_deletion(snapshot_id=sn["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_reset_share_task_state(self):
for task_state in self.task_states:

View File

@ -13,177 +13,186 @@
# 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=["gate", "negative", ])
def test_reset_nonexistent_share_state(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.reset_state, "fake")
@test.attr(type=["gate", "negative", ])
def test_reset_nonexistent_share_instance_state(self):
self.assertRaises(lib_exc.NotFound, self.shares_v2_client.reset_state,
"fake", s_type="share_instances")
@test.attr(type=["gate", "negative", ])
@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,
"fake", s_type="snapshots")
@test.attr(type=["gate", "negative", ])
@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=["gate", "negative", ])
@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"
)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"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=["gate", "negative", ])
@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=["gate", "negative", ])
@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=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
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=["gate", "negative", ])
def test_force_delete_nonexistent_share(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.force_delete, "fake")
@test.attr(type=["gate", "negative", ])
def test_force_delete_nonexistent_share_instance(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.force_delete,
"fake",
s_type="share_instances")
@test.attr(type=["gate", "negative", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_force_delete_nonexistent_snapshot(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.force_delete,
"fake",
s_type="snapshots")
@test.attr(type=["gate", "negative", ])
@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=["gate", "negative", ])
@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=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
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=["gate", "negative", ])
@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=["gate", "negative", ])
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)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_get_instances_of_share_with_member(self):
# 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=["gate", "negative", ])
@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,
'fake_share', 'migration_error')
@test.attr(type=["gate", "negative", ])
@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=["gate", "negative", ])
@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.BaseSharesMixedTest):
@classmethod
def resource_setup(cls):
super(AdminActionsAPIOnlyNegativeTest, cls).resource_setup()
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_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.admin_client.reset_task_state,
'fake_share', 'migration_error')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_force_delete_nonexistent_snapshot(self):
self.assertRaises(lib_exc.NotFound,
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.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.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.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.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.admin_client.reset_state,
"fake", s_type="snapshots")

View File

@ -46,7 +46,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesAdminTest):
cls.consistency_group = cls.shares_v2_client.get_consistency_group(
cls.consistency_group['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_cg_from_cgsnapshot_with_multiple_share_types_v2_4(self):
# Create cgsnapshot
cgsnapshot = self.create_cgsnapshot_wait_for_active(
@ -68,7 +68,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesAdminTest):
'Expected share types of %s, but got %s.' % (
expected_types, actual_types))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_cg_from_multi_typed_populated_cgsnapshot_v2_4(self):
share_name = data_utils.rand_name("tempest-share-name")
share_desc = data_utils.rand_name("tempest-share-description")

View File

@ -42,7 +42,7 @@ class ConsistencyGroupsTest(base.BaseSharesAdminTest):
share_type = cls.create_share_type(name, extra_specs=extra_specs)
cls.share_type2 = share_type['share_type']
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_create_cg_with_multiple_share_types_v2_4(self):
# Create a consistency group
consistency_group = self.create_consistency_group(
@ -67,6 +67,7 @@ class ConsistencyGroupsTest(base.BaseSharesAdminTest):
expected_share_types,
actual_share_types))
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_create_cg_from_cgsnapshot_verify_share_server_information(self):

View File

@ -61,14 +61,14 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
name=cls.cgsnap_name,
description=cls.cgsnap_desc)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_share_type_in_use_by_cg(self):
# Attempt delete of share type
self.assertRaises(exceptions.BadRequest,
self.shares_client.delete_share_type,
self.share_type['id'])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_share_of_unsupported_type_in_cg_v2_4(self):
# Attempt to create share of default type in the cg
self.assertRaises(exceptions.BadRequest,
@ -77,7 +77,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
consistency_group_id=self.consistency_group['id'],
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_share_in_cg_that_is_not_available_v2_4(self):
consistency_group = self.create_consistency_group(
cleanup_in_class=False, version='2.4')
@ -122,7 +122,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cgsnapshot_of_cg_that_is_not_available_v2_4(self):
consistency_group = self.create_consistency_group(
cleanup_in_class=False, version='2.4')
@ -161,7 +161,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cgsnapshot_of_cg_with_share_in_error_state_v2_4(self):
consistency_group = self.create_consistency_group(version='2.4')
share_name = data_utils.rand_name("tempest-share-name")
@ -183,7 +183,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_cgsnapshot_not_in_available_or_error_v2_4(self):
cgsnapshot = self.create_cgsnapshot_wait_for_active(
self.consistency_group['id'],
@ -216,7 +216,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
cgsnapshot['id'],
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_cg_not_in_available_or_error_v2_4(self):
consistency_group = self.create_consistency_group(
cleanup_in_class=False, version='2.4')
@ -243,7 +243,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
consistency_group['id'],
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cg_with_conflicting_share_types_v2_4(self):
# Create conflicting share types
name = data_utils.rand_name("tempest-manila")
@ -263,7 +263,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cg_with_multi_tenant_share_type_and_no_share_network_v2_4(
self):
# Create multi tenant share type
@ -287,7 +287,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesAdminTest):
self.assertRaises(exceptions.BadRequest, create_cg)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_update_cg_share_types(self):
consistency_group = self.create_consistency_group(
cleanup_in_class=False, version='2.4')

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(
@ -101,7 +100,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
# it making assertion that it has proper date value.
timeutils.parse_strtime(time)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.13')
def test_list_share_export_locations(self):
export_locations = self.admin_client.list_share_export_locations(
@ -110,7 +109,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
self._verify_export_location_structure(export_locations,
version='2.13')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.14')
def test_list_share_export_locations_with_preferred_flag(self):
export_locations = self.admin_client.list_share_export_locations(
@ -119,7 +118,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
self._verify_export_location_structure(export_locations,
version='2.14')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_export_location(self):
export_locations = self.admin_client.list_share_export_locations(
self.share['id'])
@ -129,14 +128,14 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
self.share['id'], export_location['id'])
self._verify_export_location_structure(el, format='detail')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_export_locations_by_member(self):
export_locations = self.member_client.list_share_export_locations(
self.share['id'])
self._verify_export_location_structure(export_locations, role='member')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_export_location_by_member(self):
export_locations = self.admin_client.list_share_export_locations(
self.share['id'])
@ -149,7 +148,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
self._verify_export_location_structure(el, role='member',
format='detail')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.13')
def test_list_share_instance_export_locations(self):
for share_instance in self.share_instances:
@ -159,7 +158,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
self._verify_export_location_structure(export_locations,
version='2.13')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.14')
def test_list_share_instance_export_locations_with_preferred_flag(self):
for share_instance in self.share_instances:
@ -169,7 +168,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
self._verify_export_location_structure(export_locations,
version='2.14')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_instance_export_location(self):
for share_instance in self.share_instances:
export_locations = (
@ -180,7 +179,7 @@ class ExportLocationsTest(base.BaseSharesAdminTest):
share_instance['id'], el['id'])
self._verify_export_location_structure(el, format='detail')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_share_contains_all_export_locations_of_all_share_instances(self):
share_export_locations = self.admin_client.list_share_export_locations(
self.share['id'])

View File

@ -17,34 +17,25 @@ 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=["gate", "negative"])
def test_get_export_locations_by_inexistent_share(self):
self.assertRaises(
lib_exc.NotFound,
self.admin_client.list_share_export_locations,
"fake-inexistent-share-id",
)
@test.attr(type=["gate", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_get_inexistent_share_export_location(self):
self.assertRaises(
lib_exc.NotFound,
@ -53,15 +44,7 @@ class ExportLocationsNegativeTest(base.BaseSharesAdminTest):
"fake-inexistent-share-instance-id",
)
@test.attr(type=["gate", "negative"])
def test_get_export_locations_by_inexistent_share_instance(self):
self.assertRaises(
lib_exc.NotFound,
self.admin_client.list_share_instance_export_locations,
"fake-inexistent-share-instance-id",
)
@test.attr(type=["gate", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_get_inexistent_share_instance_export_location(self):
for share_instance in self.share_instances:
self.assertRaises(
@ -71,7 +54,7 @@ class ExportLocationsNegativeTest(base.BaseSharesAdminTest):
"fake-inexistent-share-instance-id",
)
@test.attr(type=["gate", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_instance_export_locations_by_member(self):
for share_instance in self.share_instances:
self.assertRaises(
@ -80,7 +63,7 @@ class ExportLocationsNegativeTest(base.BaseSharesAdminTest):
"fake-inexistent-share-instance-id",
)
@test.attr(type=["gate", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_instance_export_location_by_member(self):
for share_instance in self.share_instances:
export_locations = (
@ -92,3 +75,23 @@ class ExportLocationsNegativeTest(base.BaseSharesAdminTest):
self.member_client.get_share_instance_export_location,
share_instance['id'], el['id'],
)
@base.skip_if_microversion_not_supported("2.9")
class ExportLocationsAPIOnlyNegativeTest(base.BaseSharesAdminTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_export_locations_by_nonexistent_share(self):
self.assertRaises(
lib_exc.NotFound,
self.shares_v2_client.list_share_export_locations,
"fake-inexistent-share-id",
)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_export_locations_by_nonexistent_share_instance(self):
self.assertRaises(
lib_exc.NotFound,
self.shares_v2_client.list_share_instance_export_locations,
"fake-inexistent-share-instance-id",
)

View File

@ -39,7 +39,7 @@ class MigrationNFSTest(base.BaseSharesAdminTest):
if not CONF.share.run_migration_tests:
raise cls.skipException("Migration tests disabled. Skipping.")
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@base.skip_if_microversion_lt("2.5")
def test_migration_empty_v2_5(self):
@ -52,7 +52,7 @@ class MigrationNFSTest(base.BaseSharesAdminTest):
self._validate_migration_successful(dest_pool, share, old_exports,
version='2.5')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_migration_completion_empty_v2_15(self):

View File

@ -47,28 +47,28 @@ class MigrationNFSTest(base.BaseSharesAdminTest):
cls.dest_pool = next((x for x in pools
if x['name'] != cls.share['host']), None)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_migration_cancel_invalid(self):
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.migration_cancel,
self.share['id'])
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_migration_get_progress_invalid(self):
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.migration_get_progress,
self.share['id'])
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.15")
def test_migration_complete_invalid(self):
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.migration_complete,
self.share['id'])
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.5")
def test_migrate_share_with_snapshot_v2_5(self):
snap = self.create_snapshot_wait_for_active(self.share['id'])
@ -78,14 +78,14 @@ class MigrationNFSTest(base.BaseSharesAdminTest):
self.shares_client.delete_snapshot(snap['id'])
self.shares_client.wait_for_resource_deletion(snapshot_id=snap["id"])
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.5")
def test_migrate_share_same_host_v2_5(self):
self.assertRaises(
lib_exc.BadRequest, self.shares_v2_client.migrate_share,
self.share['id'], self.share['host'], True, version='2.5')
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@base.skip_if_microversion_lt("2.5")
def test_migrate_share_not_available_v2_5(self):
self.shares_client.reset_state(self.share['id'], 'error')

View File

@ -56,14 +56,14 @@ class ShareMultiBackendTest(base.BaseSharesAdminTest):
# Create shares using precreated share types
cls.shares = cls.create_shares(share_data_list)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_share_backend_name_reporting(self):
# Share's 'host' should be like "hostname@backend_name"
for share in self.shares:
get = self.shares_client.get_share(share['id'])
self.assertTrue(len(get["host"].split("@")) == 2)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_share_share_type(self):
# Share type should be the same as provided with share creation
for i in [0, 1]:
@ -71,7 +71,7 @@ class ShareMultiBackendTest(base.BaseSharesAdminTest):
version="2.5")
self.assertEqual(self.sts[i]["name"], get["share_type"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_share_share_type_v_2_6(self):
# Share type should be the same as provided with share creation
for i in [0, 1]:
@ -80,7 +80,7 @@ class ShareMultiBackendTest(base.BaseSharesAdminTest):
self.assertEqual(self.sts[i]["id"], get["share_type"])
self.assertEqual(self.sts[i]["name"], get["share_type_name"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_share_backend_name_distinction(self):
# Different share backends should have different host records
if CONF.share.backend_names[0] == CONF.share.backend_names[1]:

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,12 +28,11 @@ 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
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_default_quotas(self):
quotas = self.shares_v2_client.default_quotas(self.tenant_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
@ -43,7 +41,7 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest):
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_show_quotas(self):
quotas = self.shares_v2_client.show_quotas(self.tenant_id)
self.assertGreater(int(quotas["gigabytes"]), -2)
@ -52,7 +50,7 @@ class SharesAdminQuotasTest(base.BaseSharesAdminTest):
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_show_quotas_for_user(self):
quotas = self.shares_v2_client.show_quotas(
self.tenant_id, self.user_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):
@ -83,7 +80,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id = self.client.tenant_id
self.user_id = self.client.user_id
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_tenant_quota_shares(self):
# get current quotas
quotas = self.client.show_quotas(self.tenant_id)
@ -93,7 +90,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
updated = self.client.update_quotas(self.tenant_id, shares=new_quota)
self.assertEqual(new_quota, int(updated["shares"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_user_quota_shares(self):
# get current quotas
quotas = self.client.show_quotas(self.tenant_id, self.user_id)
@ -104,7 +101,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id, self.user_id, shares=new_quota)
self.assertEqual(new_quota, int(updated["shares"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_tenant_quota_snapshots(self):
# get current quotas
quotas = self.client.show_quotas(self.tenant_id)
@ -115,7 +112,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id, snapshots=new_quota)
self.assertEqual(new_quota, int(updated["snapshots"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_user_quota_snapshots(self):
# get current quotas
quotas = self.client.show_quotas(self.tenant_id, self.user_id)
@ -126,7 +123,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id, self.user_id, snapshots=new_quota)
self.assertEqual(new_quota, int(updated["snapshots"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_tenant_quota_gigabytes(self):
# get current quotas
custom = self.client.show_quotas(self.tenant_id)
@ -139,7 +136,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id, gigabytes=gigabytes)
self.assertEqual(gigabytes, int(updated["gigabytes"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_tenant_quota_snapshot_gigabytes(self):
# get current quotas
custom = self.client.show_quotas(self.tenant_id)
@ -154,7 +151,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(snapshot_gigabytes,
int(updated["snapshot_gigabytes"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_user_quota_gigabytes(self):
# get current quotas
custom = self.client.show_quotas(self.tenant_id, self.user_id)
@ -167,7 +164,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id, self.user_id, gigabytes=gigabytes)
self.assertEqual(gigabytes, int(updated["gigabytes"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_user_quota_snapshot_gigabytes(self):
# get current quotas
custom = self.client.show_quotas(self.tenant_id, self.user_id)
@ -182,7 +179,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(snapshot_gigabytes,
int(updated["snapshot_gigabytes"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_tenant_quota_share_networks(self):
# get current quotas
quotas = self.client.show_quotas(self.tenant_id)
@ -193,7 +190,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.tenant_id, share_networks=new_quota)
self.assertEqual(new_quota, int(updated["share_networks"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_user_quota_share_networks(self):
# get current quotas
quotas = self.client.show_quotas(
@ -206,7 +203,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
share_networks=new_quota)
self.assertEqual(new_quota, int(updated["share_networks"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_reset_tenant_quotas(self):
# get default_quotas
default = self.client.default_quotas(self.tenant_id)
@ -247,7 +244,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(int(default["share_networks"]),
int(reseted["share_networks"]))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_quota_for_shares(self):
self.client.update_quotas(self.tenant_id, shares=-1)
@ -255,7 +252,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('shares'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_user_quota_for_shares(self):
self.client.update_quotas(
self.tenant_id, self.user_id, shares=-1)
@ -264,7 +261,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('shares'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_quota_for_snapshots(self):
self.client.update_quotas(self.tenant_id, snapshots=-1)
@ -272,7 +269,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('snapshots'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_user_quota_for_snapshots(self):
self.client.update_quotas(
self.tenant_id, self.user_id, snapshots=-1)
@ -281,7 +278,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('snapshots'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_quota_for_gigabytes(self):
self.client.update_quotas(self.tenant_id, gigabytes=-1)
@ -289,7 +286,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('gigabytes'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_quota_for_snapshot_gigabytes(self):
self.client.update_quotas(
self.tenant_id, snapshot_gigabytes=-1)
@ -298,7 +295,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('snapshot_gigabytes'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_user_quota_for_gigabytes(self):
self.client.update_quotas(
self.tenant_id, self.user_id, gigabytes=-1)
@ -307,7 +304,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('gigabytes'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_user_quota_for_snapshot_gigabytes(self):
self.client.update_quotas(
self.tenant_id, self.user_id, snapshot_gigabytes=-1)
@ -316,7 +313,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('snapshot_gigabytes'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_quota_for_share_networks(self):
self.client.update_quotas(self.tenant_id, share_networks=-1)
@ -324,7 +321,7 @@ class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
self.assertEqual(-1, quotas.get('share_networks'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_unlimited_user_quota_for_share_networks(self):
self.client.update_quotas(
self.tenant_id, self.user_id, share_networks=-1)

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,23 +31,22 @@ 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
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_quotas_with_empty_tenant_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.show_quotas, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_reset_quotas_with_empty_tenant_id(self):
client = self.get_client_with_isolated_creds()
self.assertRaises(lib_exc.NotFound,
client.reset_quotas, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_update_shares_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
@ -58,7 +55,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.tenant_id,
shares=-2)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_update_snapshots_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
@ -67,7 +64,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.tenant_id,
snapshots=-2)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_update_gigabytes_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
@ -76,7 +73,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.tenant_id,
gigabytes=-2)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_update_snapshot_gigabytes_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
@ -85,7 +82,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.tenant_id,
snapshot_gigabytes=-2)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_update_share_networks_quota_with_wrong_data(self):
# -1 is acceptable value as unlimited
client = self.get_client_with_isolated_creds()
@ -94,7 +91,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.tenant_id,
share_networks=-2)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_size_bigger_than_quota(self):
quotas = self.shares_client.show_quotas(
self.shares_client.tenant_id)
@ -105,7 +102,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
self.create_share,
size=overquota)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_user_quota_shares_bigger_than_tenant_quota(self):
client = self.get_client_with_isolated_creds()
@ -120,7 +117,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.user_id,
shares=bigger_value)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_user_quota_snaps_bigger_than_tenant_quota(self):
client = self.get_client_with_isolated_creds()
@ -135,7 +132,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.user_id,
snapshots=bigger_value)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_user_quota_gigabytes_bigger_than_tenant_quota(self):
client = self.get_client_with_isolated_creds()
@ -150,7 +147,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.user_id,
gigabytes=bigger_value)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_user_quota_snap_gigabytes_bigger_than_tenant_quota(self):
client = self.get_client_with_isolated_creds()
@ -165,7 +162,7 @@ class SharesAdminQuotasNegativeTest(base.BaseSharesAdminTest):
client.user_id,
snapshot_gigabytes=bigger_value)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_user_quota_share_networks_bigger_than_tenant_quota(self):
client = self.get_client_with_isolated_creds()

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
@ -67,7 +68,7 @@ class ReplicationAdminTest(base.BaseSharesAdminTest):
return [replica['id'] for replica in replica_list
if replica['replica_state'] == r_state]
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_promote_out_of_sync_share_replica(self):
"""Test promote 'out_of_sync' share replica to active state."""
if (self.replication_type
@ -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,67 +110,70 @@ 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)
self.assertEqual(1, len(new_active_replicas))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_force_delete_share_replica(self):
"""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=["gate", ])
@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=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_reset_share_replica_state(self):
"""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=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_resync_share_replica(self):
"""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

@ -23,7 +23,7 @@ CONF = config.CONF
class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_pool_list(self):
# List pools
@ -36,7 +36,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
actual_keys = set(pool.keys())
self.assertTrue(actual_keys.issuperset(required_keys))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_pool_list_with_filters(self):
# List pools
@ -65,7 +65,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
for k, v in search_opts.items():
self.assertEqual(v[1:-1], filtered_pool_list[0][k])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_pool_list_with_filters_negative(self):
# Build search opts for a non-existent pool
@ -81,7 +81,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
# Ensure we got no pools
self.assertEmpty(pool_list)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_pool_list_detail(self):
# List pools
@ -94,7 +94,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
actual_keys = set(pool.keys())
self.assertTrue(actual_keys.issuperset(required_keys))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_pool_list_detail_with_filters(self):
# List pools
@ -123,7 +123,7 @@ class SchedulerStatsAdminTest(base.BaseSharesAdminTest):
for k, v in search_opts.items():
self.assertEqual(v[1:-1], filtered_pool_list[0][k])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_pool_list_detail_with_filters_negative(self):
# Build search opts for a non-existent pool

View File

@ -46,7 +46,7 @@ class SecurityServiceAdminTest(
'kerberos',
**ss_kerberos_data)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_security_services_all_tenants(self):
listed = self.shares_client.list_security_services(
params={'all_tenants': 1})
@ -57,7 +57,7 @@ class SecurityServiceAdminTest(
keys = ["name", "id", "status", "type", ]
[self.assertIn(key, s_s.keys()) for s_s in listed for key in keys]
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_security_services_invalid_filters(self):
listed = self.shares_client.list_security_services(
params={'fake_opt': 'some_value'})

View File

@ -26,7 +26,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
super(ServicesAdminTest, self).setUp()
self.services = self.shares_client.list_services()
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_list_services(self, client_name):
services = getattr(self, client_name).list_services()
@ -35,7 +35,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
for service in services:
self.assertIsNotNone(service['id'])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_get_services_by_host_name(self, client_name):
host = self.services[0]["host"]
@ -45,7 +45,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
for service in services:
self.assertEqual(host, service["host"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_get_services_by_binary_name(self, client_name):
binary = self.services[0]["binary"]
@ -55,7 +55,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
for service in services:
self.assertEqual(binary, service["binary"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_get_services_by_availability_zone(self, client_name):
zone = self.services[0]["zone"]
@ -65,7 +65,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
for service in services:
self.assertEqual(zone, service["zone"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_get_services_by_status(self, client_name):
status = self.services[0]["status"]
@ -75,7 +75,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
for service in services:
self.assertEqual(status, service["status"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_get_services_by_state(self, client_name):
state = self.services[0]["state"]
@ -85,7 +85,7 @@ class ServicesAdminTest(base.BaseSharesAdminTest):
for service in services:
self.assertEqual(state, service["state"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_get_services_by_all_filters(self, client_name):
params = {

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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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,
@ -55,37 +54,37 @@ class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
key=lambda service: service['id']),
msg)
@test.attr(type=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ddt.data(
('os-services', '2.7'),
('services', '2.6'),
@ -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

@ -29,7 +29,7 @@ class ShareInstancesTest(base.BaseSharesAdminTest):
super(ShareInstancesTest, cls).resource_setup()
cls.share = cls.create_share()
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_instances_of_share_v2_3(self):
"""Test that we get only the 1 share instance back for the share."""
share_instances = self.shares_v2_client.get_instances_of_share(
@ -47,7 +47,7 @@ class ShareInstancesTest(base.BaseSharesAdminTest):
self.share['id'],
si['share_id']))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_instances_v2_3(self):
"""Test that we get at least the share instance back for the share."""
share_instances = self.shares_v2_client.get_instances_of_share(
@ -83,14 +83,14 @@ class ShareInstancesTest(base.BaseSharesAdminTest):
'expected %s, got %s.' % (
si['id'], expected_keys, actual_keys))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_instance_v2_3(self):
self._get_share_instance('2.3')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_instance_v2_9(self):
self._get_share_instance('2.9')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_instance_v2_10(self):
self._get_share_instance('2.10')

View File

@ -141,11 +141,11 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
share['id'])
@base.skip_if_microversion_not_supported("2.8")
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_manage_with_is_public_True(self):
self._test_manage(share=self.shares[2], is_public=True)
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_manage(self):
# After 'unmanage' operation, share instance should be deleted.
# Assert not related to 'manage' test, but placed here for
@ -156,7 +156,7 @@ class ManageNFSShareTest(base.BaseSharesAdminTest):
self._test_manage(share=self.shares[0])
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_manage_invalid(self):
# Try to manage share with invalid parameters, it should not succeed
# because the scheduler will reject it. If it succeeds, then this test

View File

@ -76,7 +76,7 @@ class ShareNetworkAdminTest(
cls.sn_with_kerberos_ss["id"],
cls.ss_kerberos["id"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_share_networks_all_tenants(self):
listed = self.shares_client.list_share_networks_with_detail(
{'all_tenants': 1})
@ -85,7 +85,7 @@ class ShareNetworkAdminTest(
self.assertTrue(any(self.sn_with_kerberos_ss['id'] == sn['id']
for sn in listed))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_share_networks_filter_by_project_id(self):
listed = self.shares_client.list_share_networks_with_detail(
{'project_id': self.sn_with_kerberos_ss['project_id']})

View File

@ -50,7 +50,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
cls.date_re = re.compile("^([0-9]{4}-[0-9]{2}-[0-9]{2}[A-Z]{1}"
"[0-9]{2}:[0-9]{2}:[0-9]{2}).*$")
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_servers_without_filters(self):
servers = self.shares_client.list_share_servers()
self.assertTrue(len(servers) > 0)
@ -81,7 +81,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
# Server we used is present.
any(s["share_network_name"] in self.sn_name_and_id for s in servers)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_servers_with_host_filter(self):
# Get list of share servers and remember 'host' name
servers = self.shares_client.list_share_servers()
@ -107,7 +107,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
for server in servers:
self.assertEqual(server["host"], host)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_servers_with_status_filter(self):
# Get list of share servers
servers = self.shares_client.list_share_servers()
@ -133,7 +133,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
for server in servers:
self.assertEqual(server["status"], status)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_servers_with_project_id_filter(self):
search_opts = {"project_id": self.share_network["project_id"]}
servers = self.shares_client.list_share_servers(search_opts)
@ -143,7 +143,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
self.assertEqual(server["project_id"],
self.share_network["project_id"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_servers_with_share_network_name_filter(self):
search_opts = {"share_network": self.share_network["name"]}
servers = self.shares_client.list_share_servers(search_opts)
@ -153,7 +153,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
self.assertEqual(server["share_network_name"],
self.share_network["name"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_share_servers_with_share_network_id_filter(self):
search_opts = {"share_network": self.share_network["id"]}
servers = self.shares_client.list_share_servers(search_opts)
@ -163,7 +163,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
self.assertIn(server["share_network_name"],
self.sn_name_and_id)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_show_share_server(self):
servers = self.shares_client.list_share_servers()
server = self.shares_client.show_share_server(servers[0]["id"])
@ -198,7 +198,7 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
# backend_details should be a dict
self.assertIsInstance(server["backend_details"], dict)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_show_share_server_details(self):
servers = self.shares_client.list_share_servers()
details = self.shares_client.show_share_server_details(
@ -208,7 +208,6 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
self.assertIsInstance(k, six.string_types)
self.assertIsInstance(v, six.string_types)
@test.attr(type=["gate", "smoke", ])
def _delete_share_server(self, delete_share_network):
# Get network and subnet from existing share_network and reuse it
# to be able to delete share_server after test ends.
@ -266,10 +265,10 @@ class ShareServersAdminTest(base.BaseSharesAdminTest):
self.shares_client.wait_for_resource_deletion(
sn_id=new_sn["id"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_delete_share_server(self):
self._delete_share_server(False)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_delete_share_server_by_deletion_of_share_network(self):
self._delete_share_server(True)

View File

@ -13,96 +13,96 @@
# 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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_share_servers_with_fake_share_network(self):
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=["gate", "smoke", "negative", ])
@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=["gate", "smoke", "negative", ])
@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

@ -28,7 +28,7 @@ CONF = config.CONF
@ddt.ddt
class ShareTypesAdminTest(base.BaseSharesAdminTest):
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_share_type_create_delete(self):
name = data_utils.rand_name("tempest-manila")
extra_specs = self.add_required_extra_specs_to_dict()
@ -58,7 +58,7 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
self.assertIn(old_key_name, share_type)
self.assertNotIn(new_key_name, share_type)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('2.0', '2.6', '2.7')
def test_share_type_create_get(self, version):
self.skip_if_microversion_not_supported(version)
@ -83,7 +83,7 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
# Check that backwards compatibility didn't break
self.assertDictMatch(get["volume_type"], get["share_type"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('2.0', '2.6', '2.7')
def test_share_type_create_list(self, version):
self.skip_if_microversion_not_supported(version)
@ -111,7 +111,7 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
for i in range(len(sts)):
self.assertDictMatch(sts[i], vts[i])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_with_share_type(self):
# Data
@ -141,6 +141,7 @@ class ShareTypesAdminTest(base.BaseSharesAdminTest):
self.assertEqual(st_create["share_type"]["id"], get["share_type"])
self.assertEqual(shr_type_name, get["share_type_name"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_private_share_type_access(self):
name = data_utils.rand_name("tempest-manila")
extra_specs = self.add_required_extra_specs_to_dict({"key": "value", })

View File

@ -40,14 +40,14 @@ class ExtraSpecsReadAdminTest(base.BaseSharesAdminTest):
cls.shares_client.create_share_type_extra_specs(
cls.st_id, cls.custom_extra_specs)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_get_one_share_type_extra_spec(self):
es_get_one = self.shares_client.get_share_type_extra_spec(
self.st_id, "key1")
self.assertEqual({"key1": self.custom_extra_specs["key1"]}, es_get_one)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_get_all_share_type_extra_specs(self):
es_get_all = self.shares_client.get_share_type_extra_specs(self.st_id)
@ -72,7 +72,7 @@ class ExtraSpecsWriteAdminTest(base.BaseSharesAdminTest):
self.shares_client.create_share_type_extra_specs(
self.st_id, self.custom_extra_specs)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_one_share_type_extra_spec(self):
self.custom_extra_specs["key1"] = "fake_value1_updated"
@ -86,7 +86,7 @@ class ExtraSpecsWriteAdminTest(base.BaseSharesAdminTest):
expected_extra_specs.update(self.required_extra_specs)
self.assertEqual(self.custom_extra_specs, get)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_all_share_type_extra_specs(self):
self.custom_extra_specs["key2"] = "value2_updated"
@ -100,7 +100,7 @@ class ExtraSpecsWriteAdminTest(base.BaseSharesAdminTest):
expected_extra_specs.update(self.required_extra_specs)
self.assertEqual(self.custom_extra_specs, get)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_delete_one_share_type_extra_spec(self):
# Delete one extra spec for share type
self.shares_client.delete_share_type_extra_spec(self.st_id, "key1")

View File

@ -13,63 +13,58 @@
# 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)
return self.create_share_type(
name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
@classmethod
def resource_setup(cls):
super(ExtraSpecsAdminNegativeTest, cls).resource_setup()
cls.member_shares_client = clients.Manager().shares_client
@test.attr(type=["gate", "smoke", ])
@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"}))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_extra_specs_with_user(self):
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=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_spec_with_user(self):
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=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_extra_specs_with_user(self):
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=["gate", "smoke", ])
@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']
@ -78,204 +73,225 @@ class ExtraSpecsAdminNegativeTest(base.BaseSharesAdminTest):
'Incorrect extra specs visible to non-admin user; '
'expected %s, got %s' % (expected_keys, actual_keys))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_extra_spec_with_user(self):
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=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_extra_specs_with_user(self):
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=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_extra_specs_with_user(self):
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=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_too_long_key(self):
too_big_key = "k" * 256
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"}))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_set_too_long_value_with_creation(self):
too_big_value = "v" * 256
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}))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
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}))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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,88 +13,90 @@
# 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)
return self.create_share_type(
name, extra_specs=extra_specs, client=self.admin_shares_v2_client)
@classmethod
def resource_setup(cls):
super(ShareTypesAdminNegativeTest, cls).resource_setup()
cls.member_shares_client = clients.Manager().shares_client
@test.attr(type=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_duplicate_of_share_type(self):
st = self._create_share_type()
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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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=["gate", "smoke", ])
@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

@ -82,7 +82,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
snapshot_id=cls.snap['id'],
))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share(self):
# get share
@ -109,7 +109,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
share["size"])
self.assertEqual(self.share_size, int(share["size"]), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares(self):
# list shares
@ -125,7 +125,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail(self):
# list shares
@ -145,7 +145,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_metadata(self):
filters = {'metadata': self.metadata}
@ -160,7 +160,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
if CONF.share.run_snapshot_tests:
self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_extra_specs(self):
filters = {
"extra_specs": {
@ -193,7 +193,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
extra_specs = self.shares_client.get_share_type_extra_specs(st_id)
self.assertDictContainsSubset(filters["extra_specs"], extra_specs)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_share_type_id(self):
filters = {'share_type_id': self.st['share_type']['id']}
@ -223,7 +223,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
for share in self.shares:
self.assertTrue(share['id'] in share_ids)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_host(self):
base_share = self.shares_client.get_share(self.shares[0]['id'])
filters = {'host': base_share['host']}
@ -236,7 +236,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
for share in shares:
self.assertEqual(filters['host'], share['host'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_list_shares_with_detail_filter_by_share_network_id(self):
@ -252,7 +252,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertEqual(
filters['share_network_id'], share['share_network_id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_shares_with_detail_filter_by_snapshot_id(self):
@ -267,7 +267,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertEqual(filters['snapshot_id'], share['snapshot_id'])
self.assertFalse(self.shares[0]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_with_asc_sorting(self):
filters = {'sort_key': 'created_at', 'sort_dir': 'asc'}
@ -279,21 +279,21 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
sorted_list = [share['created_at'] for share in shares]
self.assertEqual(sorted(sorted_list), sorted_list)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_existed_name(self):
# list shares by name, at least one share is expected
params = {"name": self.share_name}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(self.share_name, shares[0]["name"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_fake_name(self):
# list shares by fake name, no shares are expected
params = {"name": data_utils.rand_name("fake-nonexistent-name")}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_active_status(self):
# list shares by active status, at least one share is expected
params = {"status": "available"}
@ -302,14 +302,14 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
for share in shares:
self.assertEqual(params["status"], share["status"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_fake_status(self):
# list shares by fake status, no shares are expected
params = {"status": 'fake'}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_get_snapshot(self):
@ -337,7 +337,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
"actual share_id: '%s'" % (self.shares[0]["id"], get["share_id"])
self.assertEqual(self.shares[0]["id"], get["share_id"], msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots(self):
@ -354,7 +354,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail(self):

View File

@ -125,7 +125,7 @@ class ManageNFSSnapshotTest(base.BaseSharesAdminTest):
self.shares_v2_client.get_snapshot,
get_snapshot['id'])
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_manage(self):
# Manage snapshot
self._test_manage(snapshot=self.snapshot)

View File

@ -62,7 +62,7 @@ class ManageNFSSnapshotNegativeTest(base.BaseSharesAdminTest):
share_protocol=cls.protocol
)
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_manage_not_found(self):
# Manage snapshot fails
self.assertRaises(lib_exc.NotFound,
@ -71,7 +71,7 @@ class ManageNFSSnapshotNegativeTest(base.BaseSharesAdminTest):
'fake-vol-snap-id',
driver_options={})
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_manage_already_exists(self):
# Manage already existing snapshot fails

View File

@ -15,11 +15,13 @@
import copy
import inspect
import re
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
@ -27,14 +29,47 @@ 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
CONF = config.CONF
LOG = log.getLogger(__name__)
# Test tags related to test direction
TAG_POSITIVE = "positive"
TAG_NEGATIVE = "negative"
# Test tags related to service involvement
TAG_API = "api"
TAG_BACKEND = "backend"
TAG_API_WITH_BACKEND = "api_with_backend"
TAGS_MAPPER = {
"p": TAG_POSITIVE,
"n": TAG_NEGATIVE,
"a": TAG_API,
"b": TAG_BACKEND,
"ab": TAG_API_WITH_BACKEND,
}
TAGS_PATTERN = re.compile(
r"(?=.*\[.*\b(%(p)s|%(n)s)\b.*\])(?=.*\[.*\b(%(a)s|%(b)s|%(ab)s)\b.*\])" %
TAGS_MAPPER)
def verify_test_has_appropriate_tags(self):
if not TAGS_PATTERN.match(self.id()):
msg = (
"Required attributes either not set or set improperly. "
"Two test attributes are expected:\n"
" - one of '%(p)s' or '%(n)s' and \n"
" - one of '%(a)s', '%(b)s' or '%(ab)s'."
) % TAGS_MAPPER
raise self.failureException(msg)
class handle_cleanup_exceptions(object):
"""Handle exceptions raised with cleanup operations.
@ -86,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"]
@ -139,22 +175,21 @@ class BaseSharesTest(test.BaseTestCase):
identity_version=CONF.identity.auth_version,
name=name,
admin_role=CONF.identity.admin_role,
admin_creds=common_creds.get_configured_credentials(
'identity_admin'))
admin_creds=common_creds.get_configured_admin_credentials())
if "admin" in type_of_creds:
creds = ic.get_admin_creds()
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 = {
@ -190,6 +225,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
@ -198,27 +250,12 @@ 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()
self.addCleanup(self.clear_isolated_creds)
self.addCleanup(self.clear_resources)
verify_test_has_appropriate_tags(self)
@classmethod
def resource_cleanup(cls):
@ -277,8 +314,8 @@ class BaseSharesTest(test.BaseTestCase):
identity_version=CONF.identity.auth_version,
name=service_net_name,
admin_role=CONF.identity.admin_role,
admin_creds=common_creds.get_configured_credentials(
'identity_admin'))
admin_creds=(
common_creds.get_configured_admin_credentials()))
net_data = ic._create_network_resources(sc.tenant_id)
network, subnet, router = net_data
net_id = network["id"]
@ -385,8 +422,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))
@ -398,11 +434,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:
@ -803,36 +848,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

@ -28,14 +28,14 @@ class AvailabilityZonesTest(base.BaseSharesTest):
for key in keys:
self.assertIn(key, az)
@test.attr(type=["smoke", "gate"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_availability_zones_legacy_url_api_v1(self):
# NOTE(vponomaryov): remove this test with removal of availability zone
# extension url support.
azs = self.shares_client.list_availability_zones()
self._list_availability_zones_assertions(azs)
@test.attr(type=["smoke", "gate"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@base.skip_if_microversion_not_supported("2.6")
def test_list_availability_zones_legacy_url_api_v2(self):
# NOTE(vponomaryov): remove this test with removal of availability zone
@ -44,7 +44,7 @@ class AvailabilityZonesTest(base.BaseSharesTest):
url='os-availability-zone', version='2.6')
self._list_availability_zones_assertions(azs)
@test.attr(type=["smoke", "gate"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@base.skip_if_microversion_not_supported("2.7")
def test_list_availability_zones(self):
azs = self.shares_v2_client.list_availability_zones(version='2.7')

View File

@ -22,7 +22,7 @@ from manila_tempest_tests.tests.api import base
@base.skip_if_microversion_not_supported("2.7")
class AvailabilityZonesNegativeTest(base.BaseSharesTest):
@test.attr(type=["smoke", "gate"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_availability_zones_api_not_found_with_legacy_url(self):
# NOTE(vponomaryov): remove this test with removal of availability zone
# extension url support.
@ -33,7 +33,7 @@ class AvailabilityZonesNegativeTest(base.BaseSharesTest):
version='2.7',
)
@test.attr(type=["smoke", "gate"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_availability_zones_api_not_found(self):
self.assertRaises(
lib_exc.NotFound,

View File

@ -79,7 +79,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
cls.cgsnapshot2 = cls.create_cgsnapshot_wait_for_active(
cls.cg2['id'], name=cls.cgsnap_name, description=cls.cgsnap_desc)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_consistency_group_v2_4(self):
# Get consistency group
@ -105,7 +105,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
self.assertEqual(self.cg_desc, str(consistency_group["description"]),
msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_v2_4(self):
# Get share
@ -141,7 +141,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
self.cg["id"], share["consistency_group_id"])
self.assertEqual(self.cg["id"], share["consistency_group_id"], msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_consistency_groups_v2_4(self):
# List consistency groups
@ -160,7 +160,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
cg_id)
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_consistency_groups_with_detail_v2_4(self):
# List consistency groups
@ -179,7 +179,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
cg_id)
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_filter_shares_by_consistency_group_id_v2_4(self):
shares = self.shares_v2_client.list_shares(
@ -200,7 +200,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
'Share %s expected in returned list, but got %s'
% (self.shares[0]['id'], share_ids))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_cgsnapshot_v2_4(self):
# Get consistency group
@ -226,7 +226,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
self.assertEqual(self.cg_desc, str(consistency_group["description"]),
msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_cgsnapshot_members_v2_4(self):
cgsnapshot_members = self.shares_v2_client.list_cgsnapshot_members(
@ -251,7 +251,7 @@ class ConsistencyGroupActionsTest(base.BaseSharesTest):
# self.assertEqual(share['share_type'],
# member['share_type_id'])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_consistency_group_from_populated_cgsnapshot_v2_4(self):
cgsnapshot_members = self.shares_v2_client.list_cgsnapshot_members(
@ -319,7 +319,7 @@ class ConsistencyGroupRenameTest(base.BaseSharesTest):
description=cls.cg_desc,
)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_update_consistency_group_v2_4(self):
# Get consistency_group
@ -346,7 +346,7 @@ class ConsistencyGroupRenameTest(base.BaseSharesTest):
self.assertEqual(new_name, consistency_group["name"])
self.assertEqual(new_desc, consistency_group["description"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_create_update_read_consistency_group_with_unicode_v2_4(self):
value1 = u'ಠ_ಠ'
value2 = u'ಠ_ರೃ'

View File

@ -32,7 +32,7 @@ CGSNAPSHOT_REQUIRED_ELEMENTS = {"id", "name", "description", "created_at",
class ConsistencyGroupsTest(base.BaseSharesTest):
"""Covers consistency group functionality."""
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_populate_delete_consistency_group_v2_4(self):
# Create a consistency group
consistency_group = self.create_consistency_group(
@ -65,7 +65,7 @@ class ConsistencyGroupsTest(base.BaseSharesTest):
self.shares_client.get_share,
share['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_create_delete_empty_cgsnapshot_v2_4(self):
# Create base consistency group
consistency_group = self.create_consistency_group(
@ -98,7 +98,7 @@ class ConsistencyGroupsTest(base.BaseSharesTest):
cgsnapshot['id'],
version='2.4')
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_create_consistency_group_from_empty_cgsnapshot(self):
# Create base consistency group
consistency_group = self.create_consistency_group(

View File

@ -24,6 +24,86 @@ from manila_tempest_tests.tests.api import base
CONF = config.CONF
@testtools.skipUnless(CONF.share.run_consistency_group_tests,
'Consistency Group tests disabled.')
class ConsistencyGroupsAPIOnlyNegativeTest(base.BaseSharesTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_cg_without_passing_cg_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_consistency_group,
'',
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_cg_with_wrong_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_consistency_group,
"wrong_consistency_group_id",
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_update_cg_with_wrong_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.update_consistency_group,
'wrong_consistency_group_id',
name='new_name',
description='new_description',
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_cg_without_passing_cg_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_consistency_group,
'',
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_filter_shares_on_invalid_cg_id_v2_4(self):
shares = self.shares_v2_client.list_shares(
detailed=True,
params={'consistency_group_id': 'foobar'},
version='2.4',
)
self.assertEqual(0, len(shares),
'Incorrect number of shares returned. Expected 0, '
'got %s.' % len(shares))
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_cgsnapshot_with_invalid_cg_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_cgsnapshot_wait_for_active,
'foobar',
cleanup_in_class=False,
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_cg_with_invalid_share_type_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
share_type_ids=['foobar'],
cleanup_in_class=False,
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_cg_with_invalid_share_network_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
share_network_id='foobar',
cleanup_in_class=False,
version='2.4')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_cg_with_invalid_source_cgsnapshot_id_value_v2_4(
self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
source_cgsnapshot_id='foobar',
cleanup_in_class=False,
version='2.4')
@testtools.skipUnless(CONF.share.run_consistency_group_tests,
'Consistency Group tests disabled.')
class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
@ -56,16 +136,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
name=cls.cgsnap_name,
description=cls.cgsnap_desc)
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_cg_with_invalid_source_cgsnapshot_id_value_v2_4(
self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
source_cgsnapshot_id='foobar',
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cg_with_nonexistent_source_cgsnapshot_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
@ -73,15 +144,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_cg_with_invalid_share_network_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
share_network_id='foobar',
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cg_with_nonexistent_share_network_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
@ -89,15 +152,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_cg_with_invalid_share_type_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
share_type_ids=['foobar'],
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cg_with_nonexistent_share_type_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_consistency_group,
@ -105,15 +160,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_cgsnapshot_with_invalid_cg_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_cgsnapshot_wait_for_active,
'foobar',
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_cgsnapshot_with_nonexistent_cg_id_value_v2_4(self):
self.assertRaises(lib_exc.BadRequest,
self.create_cgsnapshot_wait_for_active,
@ -121,44 +168,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
cleanup_in_class=False,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_get_cg_with_wrong_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_consistency_group,
"wrong_consistency_group_id",
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_get_cg_without_passing_cg_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_consistency_group,
'',
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_update_cg_with_wrong_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.update_consistency_group,
'wrong_consistency_group_id',
name='new_name',
description='new_description',
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_delete_cg_with_wrong_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_consistency_group,
"wrong_consistency_group_id",
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
def test_delete_cg_without_passing_cg_id_v2_4(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_consistency_group,
'',
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_cg_in_use_by_cgsnapshot_v2_4(self):
# Attempt delete of share type
self.assertRaises(lib_exc.Conflict,
@ -166,7 +176,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
self.consistency_group['id'],
version='2.4')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_share_in_use_by_cgsnapshot_v2_4(self):
# Attempt delete of share type
params = {'consistency_group_id': self.share['consistency_group_id']}
@ -176,7 +186,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
params=params,
version='2.4')
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_cg_containing_a_share_v2_4(self):
self.assertRaises(lib_exc.Conflict,
self.shares_v2_client.delete_consistency_group,
@ -187,19 +197,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
self.consistency_group['id'], version='2.4')
self.assertEqual('available', cg['status'])
@test.attr(type=["negative", "smoke", "gate", ])
def test_filter_shares_on_invalid_cg_id_v2_4(self):
shares = self.shares_v2_client.list_shares(
detailed=True,
params={'consistency_group_id': 'foobar'},
version='2.4'
)
self.assertEqual(0, len(shares),
'Incorrect number of shares returned. Expected 0, '
'got %s.' % len(shares))
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_filter_shares_on_nonexistent_cg_id_v2_4(self):
shares = self.shares_v2_client.list_shares(
detailed=True,
@ -211,7 +209,7 @@ class ConsistencyGroupsNegativeTest(base.BaseSharesTest):
'Incorrect number of shares returned. Expected 0, '
'got %s.' % len(shares))
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_filter_shares_on_empty_cg_id_v2_4(self):
consistency_group = self.create_consistency_group(
name='tempest_cg',

View File

@ -20,7 +20,7 @@ from manila_tempest_tests.tests.api import base
class ExtensionsTest(base.BaseSharesTest):
@test.attr(type=["smoke", "gate"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_extensions(self):
# get extensions

View File

@ -20,7 +20,7 @@ from manila_tempest_tests.tests.api import base
class ShareLimitsTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_limits_keys(self):
# list limits
@ -44,7 +44,7 @@ class ShareLimitsTest(base.BaseSharesTest):
]
[self.assertIn(key, limits["absolute"].keys()) for key in abs_keys]
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_limits_values(self):
# list limits

View File

@ -25,7 +25,7 @@ class SharesMetadataTest(base.BaseSharesTest):
super(SharesMetadataTest, cls).resource_setup()
cls.share = cls.create_share()
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_metadata_in_share_creation(self):
md = {u"key1": u"value1", u"key2": u"value2", }
@ -39,7 +39,7 @@ class SharesMetadataTest(base.BaseSharesTest):
# verify metadata
self.assertEqual(md, metadata)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_get_delete_metadata(self):
md = {u"key3": u"value3", u"key4": u"value4", }
@ -64,7 +64,7 @@ class SharesMetadataTest(base.BaseSharesTest):
get_metadata = self.shares_client.get_metadata(share["id"])
self.assertEqual({}, get_metadata)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_and_update_metadata_by_key(self):
md1 = {u"key5": u"value5", u"key6": u"value6", }
@ -85,7 +85,7 @@ class SharesMetadataTest(base.BaseSharesTest):
# verify metadata
self.assertEqual(md2, get_md)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_metadata_min_size_key(self):
data = {"k": "value"}
@ -94,7 +94,7 @@ class SharesMetadataTest(base.BaseSharesTest):
body_get = self.shares_client.get_metadata(self.share["id"])
self.assertEqual(data['k'], body_get.get('k'))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_metadata_max_size_key(self):
max_key = "k" * 255
data = {max_key: "value"}
@ -105,7 +105,7 @@ class SharesMetadataTest(base.BaseSharesTest):
self.assertIn(max_key, body_get)
self.assertEqual(data[max_key], body_get.get(max_key))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_metadata_min_size_value(self):
data = {"key": "v"}
@ -114,7 +114,7 @@ class SharesMetadataTest(base.BaseSharesTest):
body_get = self.shares_client.get_metadata(self.share["id"])
self.assertEqual(data['key'], body_get['key'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_set_metadata_max_size_value(self):
max_value = "v" * 1023
data = {"key": max_value}
@ -124,7 +124,7 @@ class SharesMetadataTest(base.BaseSharesTest):
body_get = self.shares_client.get_metadata(self.share["id"])
self.assertEqual(data['key'], body_get['key'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_upd_metadata_min_size_key(self):
data = {"k": "value"}
@ -133,7 +133,7 @@ class SharesMetadataTest(base.BaseSharesTest):
body_get = self.shares_client.get_metadata(self.share["id"])
self.assertEqual(data, body_get)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_upd_metadata_max_size_key(self):
max_key = "k" * 255
data = {max_key: "value"}
@ -143,7 +143,7 @@ class SharesMetadataTest(base.BaseSharesTest):
body_get = self.shares_client.get_metadata(self.share["id"])
self.assertEqual(data, body_get)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_upd_metadata_min_size_value(self):
data = {"key": "v"}
@ -152,7 +152,7 @@ class SharesMetadataTest(base.BaseSharesTest):
body_get = self.shares_client.get_metadata(self.share["id"])
self.assertEqual(data, body_get)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_upd_metadata_max_size_value(self):
max_value = "v" * 1023
data = {"key": max_value}

View File

@ -13,12 +13,35 @@
# License for the specific language governing permissions and limitations
# under the License.
import ddt
from tempest.lib import exceptions as lib_exc # noqa
from tempest import test # noqa
from manila_tempest_tests.tests.api import base
@ddt.ddt
class SharesMetadataAPIOnlyNegativeTest(base.BaseSharesTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ddt.data(True, False)
def test_try_set_metadata_to_unexisting_share(self, is_v2_client):
md = {u"key1": u"value1", u"key2": u"value2", }
client = self.shares_v2_client if is_v2_client else self.shares_client
self.assertRaises(lib_exc.NotFound,
client.set_metadata,
"wrong_share_id", md)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ddt.data(True, False)
def test_try_update_all_metadata_for_unexisting_share(self, is_v2_client):
md = {u"key1": u"value1", u"key2": u"value2", }
client = self.shares_v2_client if is_v2_client else self.shares_client
self.assertRaises(lib_exc.NotFound,
client.update_all_metadata,
"wrong_share_id", md)
class SharesMetadataNegativeTest(base.BaseSharesTest):
@classmethod
@ -26,33 +49,19 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
super(SharesMetadataNegativeTest, cls).resource_setup()
cls.share = cls.create_share()
@test.attr(type=["gate", "negative", ])
def test_try_set_metadata_to_unexisting_share(self):
md = {u"key1": u"value1", u"key2": u"value2", }
self.assertRaises(lib_exc.NotFound,
self.shares_client.set_metadata,
"wrong_share_id", md)
@test.attr(type=["gate", "negative", ])
def test_try_update_all_metadata_for_unexisting_share(self):
md = {u"key1": u"value1", u"key2": u"value2", }
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_all_metadata,
"wrong_share_id", md)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_set_metadata_with_empty_key(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.set_metadata,
self.share["id"], {"": "value"})
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_upd_metadata_with_empty_key(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_all_metadata,
self.share["id"], {"": "value"})
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_set_metadata_with_too_big_key(self):
too_big_key = "x" * 256
md = {too_big_key: "value"}
@ -60,7 +69,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
self.shares_client.set_metadata,
self.share["id"], md)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_upd_metadata_with_too_big_key(self):
too_big_key = "x" * 256
md = {too_big_key: "value"}
@ -68,7 +77,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
self.shares_client.update_all_metadata,
self.share["id"], md)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_set_metadata_with_too_big_value(self):
too_big_value = "x" * 1024
md = {"key": too_big_value}
@ -76,7 +85,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
self.shares_client.set_metadata,
self.share["id"], md)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_upd_metadata_with_too_big_value(self):
too_big_value = "x" * 1024
md = {"key": too_big_value}
@ -84,7 +93,7 @@ class SharesMetadataNegativeTest(base.BaseSharesTest):
self.shares_client.update_all_metadata,
self.share["id"], md)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_delete_unexisting_metadata(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_metadata,

View File

@ -33,7 +33,7 @@ class MicroversionsTest(base.BaseSharesTest):
Sends HTTP GET requests to the version API to validate microversions.
"""
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_root_version(self):
resp, resp_body = self.shares_v2_client.send_microversion_request()
@ -55,7 +55,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual(_MIN_API_VERSION, v2.get('min_version'))
self.assertEqual(_MAX_API_VERSION, v2.get('version'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v1_no_version(self):
resp, resp_body = self.shares_v2_client.send_microversion_request(
@ -72,7 +72,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual('', version_list[0].get('min_version'))
self.assertEqual('', version_list[0].get('version'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v1_with_version(self):
resp, resp_body = self.shares_v2_client.send_microversion_request(
@ -89,7 +89,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual('', version_list[0].get('min_version'))
self.assertEqual('', version_list[0].get('version'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v2_no_version(self):
resp, resp_body = self.shares_v2_client.send_microversion_request(
@ -107,7 +107,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual(_MIN_API_VERSION, version_list[0].get('min_version'))
self.assertEqual(_MAX_API_VERSION, version_list[0].get('version'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v2_min_version(self):
resp, resp_body = self.shares_v2_client.send_microversion_request(
@ -125,7 +125,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual(_MIN_API_VERSION, version_list[0].get('min_version'))
self.assertEqual(_MAX_API_VERSION, version_list[0].get('version'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v2_max_version(self):
resp, resp_body = self.shares_v2_client.send_microversion_request(
@ -143,7 +143,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual(_MIN_API_VERSION, version_list[0].get('min_version'))
self.assertEqual(_MAX_API_VERSION, version_list[0].get('version'))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v2_invalid_version(self):
resp, _ = self.shares_v2_client.send_microversion_request(
@ -151,7 +151,7 @@ class MicroversionsTest(base.BaseSharesTest):
self.assertEqual(400, resp.status)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_microversions_v2_unacceptable_version(self):
# First get max version from the server

View File

@ -34,7 +34,7 @@ class SharesQuotasTest(base.BaseSharesTest):
cls.user_id = cls.shares_v2_client.user_id
cls.tenant_id = cls.shares_v2_client.tenant_id
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_default_quotas(self, client_name):
quotas = getattr(self, client_name).default_quotas(self.tenant_id)
@ -44,7 +44,7 @@ class SharesQuotasTest(base.BaseSharesTest):
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_show_quotas(self, client_name):
quotas = getattr(self, client_name).show_quotas(self.tenant_id)
@ -54,7 +54,7 @@ class SharesQuotasTest(base.BaseSharesTest):
self.assertGreater(int(quotas["snapshots"]), -2)
self.assertGreater(int(quotas["share_networks"]), -2)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_show_quotas_for_user(self, client_name):
quotas = getattr(self, client_name).show_quotas(

View File

@ -33,18 +33,18 @@ class SharesQuotasNegativeTest(base.BaseSharesTest):
raise cls.skipException(msg)
super(SharesQuotasNegativeTest, cls).resource_setup()
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_quotas_with_empty_tenant_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.show_quotas, "")
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_reset_quotas_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_v2_client.reset_quotas,
self.shares_v2_client.tenant_id)
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_quotas_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_v2_client.update_quotas,
@ -66,7 +66,7 @@ class SharesQuotasNegativeTest(base.BaseSharesTest):
('os-services', '2.7', 'update_quotas'),
)
@ddt.unpack
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@base.skip_if_microversion_not_supported("2.7")
def test_show_quotas_with_wrong_versions(self, url, version, method_name):
self.assertRaises(

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:
@ -127,7 +126,7 @@ class ReplicationTest(base.BaseSharesTest):
return access_type, access_to
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_add_delete_share_replica(self):
# Create the replica
share_replica = self._verify_create_replica()
@ -135,7 +134,7 @@ class ReplicationTest(base.BaseSharesTest):
# Delete the replica
self.delete_share_replica(share_replica["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_add_access_rule_create_replica_delete_rule(self):
# Add access rule to the share
access_type, access_to = self._verify_config_and_set_access_rule_data()
@ -158,7 +157,7 @@ class ReplicationTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
rule_id=rule["id"], share_id=self.shares[0]['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_replica_add_access_rule_delete_replica(self):
access_type, access_to = self._verify_config_and_set_access_rule_data()
# Create the replica
@ -175,7 +174,7 @@ class ReplicationTest(base.BaseSharesTest):
# Delete the replica
self.delete_share_replica(share_replica["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_add_multiple_share_replicas(self):
rep_domain, pools = self.get_pools_for_replication_domain()
if len(pools) < 3:
@ -204,7 +203,7 @@ class ReplicationTest(base.BaseSharesTest):
self.assertIn(share_replica1["id"], replica_ids)
self.assertIn(share_replica2["id"], replica_ids)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_promote_in_sync_share_replica(self):
# Test promote 'in_sync' share_replica to 'active' state
if (self.replication_type
@ -235,7 +234,7 @@ class ReplicationTest(base.BaseSharesTest):
self.assertEqual(constants.REPLICATION_STATE_ACTIVE,
promoted_replica["replica_state"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_promote_and_promote_back(self):
# Test promote back and forth between 2 share replicas
if (self.replication_type
@ -277,7 +276,7 @@ class ReplicationTest(base.BaseSharesTest):
new_replica['id'], constants.REPLICATION_STATE_IN_SYNC,
status_attr='replica_state')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_active_replication_state(self):
# Verify the replica_state of first instance is set to active.
replica = self.shares_v2_client.get_share_replica(self.instance_id1)
@ -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:
@ -355,7 +354,7 @@ class ReplicationActionsTest(base.BaseSharesTest):
replica['id'], len(replica_id_list))
self.assertEqual(1, len(replica_id_list), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_show_share_replica(self):
replica = self.shares_v2_client.get_share_replica(self.replica1["id"])
@ -366,7 +365,7 @@ class ReplicationActionsTest(base.BaseSharesTest):
'expected %s, got %s.' % (replica["id"],
detail_keys, actual_keys))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_detail_list_share_replicas_for_share(self):
# List replicas for share
replica_list = self.shares_v2_client.list_share_replicas(
@ -378,7 +377,7 @@ class ReplicationActionsTest(base.BaseSharesTest):
# Verify keys
self._validate_replica_list(replica_list)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_detail_list_share_replicas_for_all_shares(self):
# List replicas for all available shares
replica_list = self.shares_v2_client.list_share_replicas()
@ -390,7 +389,7 @@ class ReplicationActionsTest(base.BaseSharesTest):
# Verify keys
self._validate_replica_list(replica_list)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_summary_list_share_replicas_for_all_shares(self):
# List replicas
replica_list = self.shares_v2_client.list_share_replicas_summary()

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:
@ -76,7 +75,7 @@ class ReplicationNegativeTest(base.BaseSharesTest):
raise self.skipException(
msg % ','.join(constants.REPLICATION_PROMOTION_CHOICES))
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_add_replica_to_share_with_no_replication_share_type(self):
# Create share without replication type
share = self.create_share()
@ -85,7 +84,7 @@ class ReplicationNegativeTest(base.BaseSharesTest):
share['id'],
self.replica_zone)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_add_replica_to_share_with_error_state(self):
# Set "error" state
self.admin_client.reset_state(
@ -98,25 +97,13 @@ class ReplicationNegativeTest(base.BaseSharesTest):
self.share1['id'],
self.replica_zone)
@test.attr(type=["gate", "negative", ])
def test_get_replica_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_share_replica,
data_utils.rand_uuid())
@test.attr(type=["gate", "negative", ])
def test_try_delete_replica_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_share_replica,
data_utils.rand_uuid())
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_delete_last_active_replica(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_v2_client.delete_share_replica,
self.instance_id1)
@test.attr(type=["gate", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_try_delete_share_having_replica(self):
self.create_share_replica(self.share1["id"], self.replica_zone,
cleanup_in_class=False)
@ -124,7 +111,7 @@ class ReplicationNegativeTest(base.BaseSharesTest):
self.shares_v2_client.delete_share,
self.share1["id"])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_promote_out_of_sync_share_replica(self):
# Test promoting an out_of_sync share_replica to active state
self._is_replication_type_promotable()
@ -142,7 +129,7 @@ class ReplicationNegativeTest(base.BaseSharesTest):
self.shares_v2_client.promote_share_replica,
replica['id'])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_promote_active_share_replica(self):
# Test promote active share_replica
self._is_replication_type_promotable()
@ -151,7 +138,7 @@ class ReplicationNegativeTest(base.BaseSharesTest):
self.shares_v2_client.promote_share_replica(self.instance_id1,
expected_status=200)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_promote_share_replica_for_writable_share_type(self):
# Test promote active share_replica for writable share
if self.replication_type != "writable":
@ -167,3 +154,21 @@ class ReplicationNegativeTest(base.BaseSharesTest):
# Try promoting the replica
self.shares_v2_client.promote_share_replica(replica['id'])
@testtools.skipUnless(CONF.share.run_replication_tests,
'Replication tests are disabled.')
@base.skip_if_microversion_lt(_MIN_SUPPORTED_MICROVERSION)
class ReplicationAPIOnlyNegativeTest(base.BaseSharesTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_replica_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.get_share_replica,
data_utils.rand_uuid())
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_replica_by_nonexistent_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.delete_share_replica,
data_utils.rand_uuid())

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:
@ -63,7 +62,7 @@ class ReplicationSnapshotTest(base.BaseSharesTest):
'availability_zone': cls.share_zone,
}}
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_snapshot_after_share_replica(self):
"""Test the snapshot for replicated share.
@ -89,7 +88,7 @@ class ReplicationSnapshotTest(base.BaseSharesTest):
self.delete_share_replica(original_replica['id'])
self.create_share(snapshot_id=snapshot['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_snapshot_before_share_replica(self):
"""Test the snapshot for replicated share.
@ -119,7 +118,7 @@ class ReplicationSnapshotTest(base.BaseSharesTest):
self.delete_share_replica(original_replica['id'])
self.create_share(snapshot_id=snapshot['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_snapshot_before_and_after_share_replica(self):
"""Test the snapshot for replicated share.
@ -156,7 +155,7 @@ class ReplicationSnapshotTest(base.BaseSharesTest):
self.create_share(snapshot_id=snapshot1['id'])
self.create_share(snapshot_id=snapshot2['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_delete_snapshot_after_adding_replica(self):
"""Verify the snapshot delete.
@ -176,7 +175,7 @@ class ReplicationSnapshotTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
snapshot_id=snapshot["id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_replica_from_snapshot_share(self):
"""Test replica for a share that was created from snapshot."""

View File

@ -78,7 +78,7 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
cls.access_type = "ip"
cls.access_to = "2.2.2.2"
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_create_delete_access_rules_with_one_ip(self, version):
@ -120,7 +120,7 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
rule_id=rule["id"], share_id=self.share['id'], version=version)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_create_delete_access_rule_with_cidr(self, version):
@ -162,7 +162,7 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
rule_id=rule["id"], share_id=self.share['id'], version=version)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipIf(
"nfs" not in CONF.share.enable_ro_access_level_for_protocols,
"RO access rule tests are disabled for NFS protocol.")
@ -175,7 +175,7 @@ class ShareIpRulesForNFSTest(base.BaseSharesTest):
class ShareIpRulesForCIFSTest(ShareIpRulesForNFSTest):
protocol = "cifs"
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipIf(
"cifs" not in CONF.share.enable_ro_access_level_for_protocols,
"RO access rule tests are disabled for CIFS protocol.")
@ -200,7 +200,7 @@ class ShareUserRulesForNFSTest(base.BaseSharesTest):
cls.access_type = "user"
cls.access_to = CONF.share.username_for_user_rules
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_create_delete_user_rule(self, version):
@ -239,7 +239,7 @@ class ShareUserRulesForNFSTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
rule_id=rule["id"], share_id=self.share['id'], version=version)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipIf(
"nfs" not in CONF.share.enable_ro_access_level_for_protocols,
"RO access rule tests are disabled for NFS protocol.")
@ -252,7 +252,7 @@ class ShareUserRulesForNFSTest(base.BaseSharesTest):
class ShareUserRulesForCIFSTest(ShareUserRulesForNFSTest):
protocol = "cifs"
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipIf(
"cifs" not in CONF.share.enable_ro_access_level_for_protocols,
"RO access rule tests are disabled for CIFS protocol.")
@ -279,7 +279,7 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
# certificate that it possesses.
cls.access_to = "client1.com"
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_create_delete_cert_rule(self, version):
@ -318,7 +318,7 @@ class ShareCertRulesForGLUSTERFSTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
rule_id=rule["id"], share_id=self.share['id'], version=version)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipIf(
"glusterfs" not in CONF.share.enable_ro_access_level_for_protocols,
"RO access rule tests are disabled for GLUSTERFS protocol.")
@ -376,7 +376,7 @@ class ShareCephxRulesForCephFSTest(base.BaseSharesTest):
# Provide access to a client identified by a cephx auth id.
cls.access_to = "bob"
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@ddt.data("alice", "alice_bob", "alice bob")
def test_create_delete_cephx_rule(self, access_to):
rule = self.shares_v2_client.create_access_rule(
@ -428,7 +428,7 @@ class ShareRulesTest(base.BaseSharesTest):
cls.shares_v2_client.share_protocol = cls.protocol
cls.share = cls.create_share()
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_list_access_rules(self, version):
if (utils.is_microversion_lt(version, '2.13') and
@ -490,7 +490,7 @@ class ShareRulesTest(base.BaseSharesTest):
self.shares_v2_client.wait_for_resource_deletion(
rule_id=rule["id"], share_id=self.share['id'], version=version)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_access_rules_deleted_if_share_deleted(self, version):
if (utils.is_microversion_lt(version, '2.13') and

View File

@ -44,63 +44,63 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesTest):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_1(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.256")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_2(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.1.1.-")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_3(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.4/33")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_4(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.*")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_5(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.*/23")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_6(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.1|23")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_7(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.1/-1")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_target_8(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "ip", "1.2.3.1/")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_with_wrong_level(self, client_name):
self.assertRaises(lib_exc.BadRequest,
@ -110,7 +110,7 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesTest):
'2.2.2.2',
'su')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('1.0', '2.9', LATEST_MICROVERSION)
def test_create_duplicate_of_ip_rule(self, version):
# test data
@ -182,7 +182,7 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_user_with_wrong_input_2(self, client_name):
self.assertRaises(lib_exc.BadRequest,
@ -190,28 +190,28 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
self.share["id"], "user",
"try+")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_user_with_empty_key(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "user", "")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_user_with_too_little_key(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "user", "abc")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_user_with_too_big_key(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "user", "a" * 33)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_user_with_wrong_input_1(self, client_name):
self.assertRaises(lib_exc.BadRequest,
@ -219,7 +219,7 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
self.share["id"], "user",
"try+")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@ -230,7 +230,7 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
access_type="user",
access_to="fakeuser")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_user_with_wrong_share_id(self, client_name):
self.assertRaises(lib_exc.NotFound,
@ -239,7 +239,7 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
access_type="user",
access_to="fakeuser")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_with_wrong_level(self, client_name):
self.assertRaises(lib_exc.BadRequest,
@ -272,14 +272,14 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_cert_with_empty_common_name(self, client_name):
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "cert", "")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_cert_with_whitespace_common_name(self,
client_name):
@ -287,7 +287,7 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
getattr(self, client_name).create_access_rule,
self.share["id"], "cert", " ")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_cert_with_too_big_common_name(self,
client_name):
@ -296,7 +296,7 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
getattr(self, client_name).create_access_rule,
self.share["id"], "cert", "a" * 65)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
@ddt.data('shares_client', 'shares_v2_client')
@ -307,7 +307,7 @@ class ShareCertRulesForGLUSTERFSNegativeTest(base.BaseSharesTest):
access_type="cert",
access_to="fakeclient1.com")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_cert_with_wrong_share_id(self, client_name):
self.assertRaises(lib_exc.NotFound,
@ -334,21 +334,21 @@ class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
cls.access_type = "cephx"
cls.access_to = "david"
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('jane.doe', u"bj\u00F6rn")
def test_create_access_rule_cephx_with_invalid_cephx_id(self, access_to):
self.assertRaises(lib_exc.BadRequest,
self.shares_v2_client.create_access_rule,
self.share["id"], self.access_type, access_to)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_access_rule_cephx_with_wrong_level(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_v2_client.create_access_rule,
self.share["id"], self.access_type, self.access_to,
access_level="su")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_create_access_rule_cephx_with_unsupported_access_level_ro(self):
rule = self.shares_v2_client.create_access_rule(
self.share["id"], self.access_type, self.access_to,
@ -359,6 +359,18 @@ class ShareCephxRulesForCephFSNegativeTest(base.BaseSharesTest):
self.share['id'], rule['id'], "active")
def skip_if_cephx_access_type_not_supported_by_client(self, client):
if client == 'shares_client':
version = '1.0'
else:
version = LATEST_MICROVERSION
if (CONF.share.enable_cephx_rules_for_protocols and
utils.is_microversion_lt(version, '2.13')):
msg = ("API version %s does not support cephx access type, "
"need version greater than 2.13." % version)
raise self.skipException(msg)
@ddt.ddt
class ShareRulesNegativeTest(base.BaseSharesTest):
# Tests independent from rule type and share protocol
@ -382,47 +394,40 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
def skip_if_cephx_access_type_not_supported_by_client(self, client):
if client == 'shares_client':
version = '1.0'
else:
version = LATEST_MICROVERSION
if (CONF.share.enable_cephx_rules_for_protocols and
utils.is_microversion_lt(version, '2.13')):
msg = ("API version %s does not support cephx access type, "
"need version greater than 2.13." % version)
raise self.skipException(msg)
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_delete_access_rule_with_wrong_id(self, client_name):
self.skip_if_cephx_access_type_not_supported_by_client(client_name)
skip_if_cephx_access_type_not_supported_by_client(self, client_name)
self.assertRaises(lib_exc.NotFound,
getattr(self, client_name).delete_access_rule,
self.share["id"], "wrong_rule_id")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_type(self, client_name):
self.skip_if_cephx_access_type_not_supported_by_client(client_name)
skip_if_cephx_access_type_not_supported_by_client(self, client_name)
self.assertRaises(lib_exc.BadRequest,
getattr(self, client_name).create_access_rule,
self.share["id"], "wrong_type", "1.2.3.4")
@test.attr(type=["negative", "gate", ])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_share_id(self, client_name):
self.skip_if_cephx_access_type_not_supported_by_client(client_name)
self.assertRaises(lib_exc.NotFound,
getattr(self, client_name).create_access_rule,
"wrong_share_id")
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@ddt.data('shares_client', 'shares_v2_client')
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_access_rule_ip_to_snapshot(self, client_name):
self.skip_if_cephx_access_type_not_supported_by_client(client_name)
skip_if_cephx_access_type_not_supported_by_client(self, client_name)
self.assertRaises(lib_exc.NotFound,
getattr(self, client_name).create_access_rule,
self.snap["id"])
@ddt.ddt
class ShareRulesAPIOnlyNegativeTest(base.BaseSharesTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@ddt.data('shares_client', 'shares_v2_client')
def test_create_access_rule_ip_with_wrong_share_id(self, client_name):
skip_if_cephx_access_type_not_supported_by_client(self, client_name)
self.assertRaises(lib_exc.NotFound,
getattr(self, client_name).create_access_rule,
"wrong_share_id")

View File

@ -21,12 +21,12 @@ from manila_tempest_tests.tests.api import base
class SchedulerStatsNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_pools_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_pools)
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_pools_detailed_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_pools,

View File

@ -27,7 +27,7 @@ LOG = log.getLogger(__name__)
class SecurityServiceListMixin(object):
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_security_services(self):
listed = self.shares_client.list_security_services()
self.assertTrue(any(self.ss_ldap['id'] == ss['id'] for ss in listed))
@ -38,7 +38,7 @@ class SecurityServiceListMixin(object):
keys = ["name", "id", "status", "type", ]
[self.assertIn(key, s_s.keys()) for s_s in listed for key in keys]
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_security_services_with_detail(self):
listed = self.shares_client.list_security_services(detailed=True)
self.assertTrue(any(self.ss_ldap['id'] == ss['id'] for ss in listed))
@ -53,12 +53,12 @@ class SecurityServiceListMixin(object):
]
[self.assertIn(key, s_s.keys()) for s_s in listed for key in keys]
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
@testtools.skipIf(
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(
@ -79,7 +79,7 @@ class SecurityServiceListMixin(object):
keys = ["name", "id", "status", "type", ]
[self.assertIn(key, s_s.keys()) for s_s in listed for key in keys]
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_security_services_detailed_filter_by_ss_attributes(self):
search_opts = {
'name': 'ss_ldap',
@ -122,7 +122,7 @@ class SecurityServicesTest(base.BaseSharesTest,
self.ss_kerberos = self.create_security_service(
'kerberos', **ss_kerberos_data)
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_create_delete_security_service(self):
data = self.generate_security_service_data()
self.service_names = ["ldap", "kerberos", "active_directory"]
@ -132,7 +132,7 @@ class SecurityServicesTest(base.BaseSharesTest,
self.assertEqual(ss_name, ss["type"])
self.shares_client.delete_security_service(ss["id"])
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_get_security_service(self):
data = self.generate_security_service_data()
ss = self.create_security_service(**data)
@ -141,7 +141,7 @@ class SecurityServicesTest(base.BaseSharesTest,
get = self.shares_client.get_security_service(ss["id"])
self.assertDictContainsSubset(data, get)
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_security_service(self):
data = self.generate_security_service_data()
ss = self.create_security_service(**data)
@ -155,7 +155,7 @@ class SecurityServicesTest(base.BaseSharesTest,
self.assertDictContainsSubset(upd_data, updated)
self.assertDictContainsSubset(upd_data, get)
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_try_update_valid_keys_sh_server_exists(self):
@ -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"])
@ -193,7 +193,7 @@ class SecurityServicesTest(base.BaseSharesTest,
ss["id"], **update_data)
self.assertDictContainsSubset(update_data, updated)
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_security_services_filter_by_invalid_opt(self):
listed = self.shares_client.list_security_services(
params={'fake_opt': 'some_value'})

View File

@ -43,7 +43,7 @@ class SecurityServicesMappingTest(base.BaseSharesTest):
# Add security service to share network
self.cl.add_sec_service_to_share_network(self.sn["id"], self.ss["id"])
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_map_ss_to_sn_and_list(self):
# List security services for share network
@ -52,14 +52,14 @@ class SecurityServicesMappingTest(base.BaseSharesTest):
for key in ["status", "id", "name"]:
self.assertIn(self.ss[key], ls[0][key])
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_map_ss_to_sn_and_delete(self):
# Remove security service from share network
self.cl.remove_sec_service_from_share_network(
self.sn["id"], self.ss["id"])
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_remap_ss_to_sn(self):
# Remove security service from share network

View File

@ -35,62 +35,62 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
cls.ss = cls.create_security_service(cleanup_in_class=True)
cls.cl = cls.shares_client
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_sec_service_twice_to_share_network(self):
self.cl.add_sec_service_to_share_network(self.sn["id"], self.ss["id"])
self.assertRaises(lib_exc.Conflict,
self.cl.add_sec_service_to_share_network,
self.sn["id"], self.ss["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_nonexistant_sec_service_to_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.cl.add_sec_service_to_share_network,
self.sn["id"], "wrong_ss_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_empty_sec_service_id_to_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.cl.add_sec_service_to_share_network,
self.sn["id"], "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_sec_service_to_nonexistant_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.cl.add_sec_service_to_share_network,
"wrong_sn_id", self.ss["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_add_sec_service_to_share_network_with_empty_id(self):
self.assertRaises(lib_exc.NotFound,
self.cl.add_sec_service_to_share_network,
"", self.ss["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_sec_services_for_nonexistant_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.cl.list_sec_services_for_share_network,
"wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_nonexistant_sec_service_from_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.cl.remove_sec_service_from_share_network,
self.sn["id"], "wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_sec_service_from_nonexistant_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.cl.remove_sec_service_from_share_network,
"wrong_id", self.ss["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_nonexistant_ss_from_nonexistant_sn(self):
self.assertRaises(lib_exc.NotFound,
self.cl.remove_sec_service_from_share_network,
"wrong_id", "wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_delete_ss_from_sn_used_by_share_server(self):
@ -122,7 +122,7 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
fresh_sn["id"],
self.ss["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_map_two_ss_with_same_type_to_sn(self):
# create share network
data = self.generate_share_network_data()
@ -147,7 +147,7 @@ class SecServicesMappingNegativeTest(base.BaseSharesTest):
self.cl.add_sec_service_to_share_network,
sn["id"], security_services[1]["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_ss_that_assigned_to_sn(self):
# create share network
data = self.generate_share_network_data()

View File

@ -28,52 +28,52 @@ LOG = log.getLogger(__name__)
class SecurityServicesNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_security_service_with_empty_type(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_security_service, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_security_service_with_wrong_type(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_security_service,
"wrong_type")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_security_service_without_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_security_service, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_security_service_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_security_service,
"wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_security_service_without_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_security_service, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_security_service_with_wrong_type(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_security_service,
"wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_nonexistant_security_service(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_security_service,
"wrong_id", name="name")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_security_service_with_empty_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_security_service,
"", name="name")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_try_update_invalid_keys_sh_server_exists(self):
@ -108,7 +108,7 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
ss["id"],
user="new_user")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_deleted_security_service(self):
data = self.generate_security_service_data()
ss = self.create_security_service(**data)
@ -121,7 +121,7 @@ class SecurityServicesNegativeTest(base.BaseSharesTest):
self.shares_client.get_security_service,
ss["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_security_services_all_tenants(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_security_services,

View File

@ -26,6 +26,7 @@ CONF = config.CONF
class ShareNetworkListMixin(object):
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_share_networks(self):
listed = self.shares_client.list_share_networks()
any(self.sn_with_ldap_ss["id"] in sn["id"] for sn in listed)
@ -34,7 +35,7 @@ class ShareNetworkListMixin(object):
keys = ["name", "id"]
[self.assertIn(key, sn.keys()) for sn in listed for key in keys]
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_share_networks_with_detail(self):
listed = self.shares_client.list_share_networks_with_detail()
any(self.sn_with_ldap_ss["id"] in sn["id"] for sn in listed)
@ -48,7 +49,7 @@ class ShareNetworkListMixin(object):
]
[self.assertIn(key, sn.keys()) for sn in listed for key in keys]
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_share_networks_filter_by_ss(self):
listed = self.shares_client.list_share_networks_with_detail(
{'security_service_id': self.ss_ldap['id']})
@ -60,7 +61,7 @@ class ShareNetworkListMixin(object):
self.assertTrue(any(ss['id'] == self.ss_ldap['id']
for ss in ss_list))
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_list_share_networks_all_filter_opts(self):
valid_filter_opts = {
'created_before': '2002-10-10',
@ -140,7 +141,7 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
cls.sn_with_kerberos_ss["id"],
cls.ss_kerberos["id"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_create_delete_share_network(self):
# generate data for share network
data = self.generate_share_network_data()
@ -152,7 +153,7 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
# Delete share_network
self.shares_client.delete_share_network(created["id"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_get_share_network(self):
get = self.shares_client.get_share_network(self.sn_with_ldap_ss["id"])
self.assertEqual('2002-02-02T00:00:00.000000', get['created_at'])
@ -160,7 +161,7 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
del data['created_at']
self.assertDictContainsSubset(data, get)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_update_share_network(self):
update_data = self.generate_share_network_data()
updated = self.shares_client.update_share_network(
@ -168,7 +169,7 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
**update_data)
self.assertDictContainsSubset(update_data, updated)
@test.attr(type=["gate", "smoke"])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_update_valid_keys_sh_server_exists(self):
@ -181,7 +182,7 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
self.shares_client.share_network_id, **update_dict)
self.assertDictContainsSubset(update_dict, updated)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_recreate_share_network(self):
# generate data for share network
data = self.generate_share_network_data()
@ -200,7 +201,7 @@ class ShareNetworksTest(base.BaseSharesTest, ShareNetworkListMixin):
# Delete second share network
self.shares_client.delete_share_network(sn2["id"])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API])
def test_create_two_share_networks_with_same_net_and_subnet(self):
# generate data for share network
data = self.generate_share_network_data()

View File

@ -25,39 +25,39 @@ CONF = config.CONF
class ShareNetworksNegativeTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_share_network_without_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_network, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_share_network_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share_network, "wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_share_network_without_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_network, "")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_share_network_with_wrong_type(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share_network, "wrong_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_nonexistant_share_network(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_share_network,
"wrong_id", name="name")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_update_share_network_with_empty_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.update_share_network,
"", name="name")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_try_update_invalid_keys_sh_server_exists(self):
@ -68,7 +68,7 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
self.shares_client.share_network_id,
neutron_net_id="new_net_id")
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_get_deleted_share_network(self):
data = self.generate_share_network_data()
sn = self.create_share_network(**data)
@ -81,33 +81,33 @@ class ShareNetworksNegativeTest(base.BaseSharesTest):
self.shares_client.get_security_service,
sn["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_networks_all_tenants(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_share_networks_with_detail,
params={'all_tenants': 1})
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_networks_project_id(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_share_networks_with_detail,
params={'project_id': 'some_project'})
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_networks_wrong_created_since_value(self):
self.assertRaises(
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"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_list_share_networks_wrong_created_before_value(self):
self.assertRaises(
lib_exc.BadRequest,
self.shares_client.list_share_networks_with_detail,
params={'created_before': '2014-10-23T08:31:58.000000'})
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(not CONF.share.multitenancy_enabled,
'Can run only with drivers that do handle share servers '
'creation. Skipping.')

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,34 +28,35 @@ 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=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_create_share_type_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.create_share_type,
data_utils.rand_name("used_user_creds"),
client=self.shares_client)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_delete_share_type_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.delete_share_type,
self.st["share_type"]["id"])
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_add_access_to_share_type_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.add_access_to_share_type,
self.st['share_type']['id'],
self.shares_client.tenant_id)
@test.attr(type=["gate", "smoke", "negative"])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_try_remove_access_from_share_type_with_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.remove_access_from_share_type,

View File

@ -36,7 +36,7 @@ class SharesNFSTest(base.BaseSharesTest):
raise cls.skipException(message)
cls.share = cls.create_share(cls.protocol)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_create_get_delete_share(self):
share = self.create_share(self.protocol)
@ -91,7 +91,7 @@ class SharesNFSTest(base.BaseSharesTest):
self.shares_v2_client.get_share,
share['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_delete_snapshot(self):
@ -113,7 +113,7 @@ class SharesNFSTest(base.BaseSharesTest):
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_snapshot, snap['id'])
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_from_snapshot(self):
@ -137,7 +137,7 @@ class SharesNFSTest(base.BaseSharesTest):
"source of share %s" % (snap["id"], get["snapshot_id"])
self.assertEqual(get["snapshot_id"], snap["id"], msg)
@test.attr(type=["gate", "smoke", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipIf(not CONF.share.multitenancy_enabled,
"Only for multitenancy.")
@testtools.skipUnless(CONF.share.run_snapshot_tests,

View File

@ -117,40 +117,40 @@ class SharesActionsTest(base.BaseSharesTest):
share["size"])
self.assertEqual(self.share_size, int(share["size"]), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_v2_1(self):
self._get_share('2.1')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_get_share_with_snapshot_support_key(self):
self._get_share('2.2')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.4')
def test_get_share_with_consistency_groups_keys(self):
self._get_share('2.4')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.6')
def test_get_share_with_share_type_name_key(self):
self._get_share('2.6')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.9')
def test_get_share_export_locations_removed(self):
self._get_share('2.9')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.10')
def test_get_share_with_access_rules_status(self):
self._get_share('2.10')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.11')
def test_get_share_with_replication_type_key(self):
self._get_share('2.11')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares(self):
# list shares
@ -201,40 +201,40 @@ class SharesActionsTest(base.BaseSharesTest):
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_v2_1(self):
self._list_shares_with_detail('2.1')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_and_snapshot_support_key(self):
self._list_shares_with_detail('2.2')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.4')
def test_list_shares_with_detail_consistency_groups_keys(self):
self._list_shares_with_detail('2.4')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.6')
def test_list_shares_with_detail_share_type_name_key(self):
self._list_shares_with_detail('2.6')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.9')
def test_list_shares_with_detail_export_locations_removed(self):
self._list_shares_with_detail('2.9')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.10')
def test_list_shares_with_detail_with_access_rules_status(self):
self._list_shares_with_detail('2.10')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@utils.skip_if_microversion_not_supported('2.11')
def test_list_shares_with_detail_replication_type_key(self):
self._list_shares_with_detail('2.11')
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_metadata(self):
filters = {'metadata': self.metadata}
@ -249,7 +249,7 @@ class SharesActionsTest(base.BaseSharesTest):
if CONF.share.run_snapshot_tests:
self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_host(self):
base_share = self.shares_client.get_share(self.shares[0]['id'])
filters = {'host': base_share['host']}
@ -262,7 +262,7 @@ class SharesActionsTest(base.BaseSharesTest):
for share in shares:
self.assertEqual(filters['host'], share['host'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_list_shares_with_detail_filter_by_share_network_id(self):
@ -278,7 +278,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(
filters['share_network_id'], share['share_network_id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_shares_with_detail_filter_by_snapshot_id(self):
@ -293,7 +293,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(filters['snapshot_id'], share['snapshot_id'])
self.assertFalse(self.shares[0]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_with_asc_sorting(self):
filters = {'sort_key': 'created_at', 'sort_dir': 'asc'}
@ -305,21 +305,21 @@ class SharesActionsTest(base.BaseSharesTest):
sorted_list = [share['created_at'] for share in shares]
self.assertEqual(sorted(sorted_list), sorted_list)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_existed_name(self):
# list shares by name, at least one share is expected
params = {"name": self.share_name}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(self.share_name, shares[0]["name"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_fake_name(self):
# list shares by fake name, no shares are expected
params = {"name": data_utils.rand_name("fake-nonexistent-name")}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_active_status(self):
# list shares by active status, at least one share is expected
params = {"status": "available"}
@ -328,14 +328,14 @@ class SharesActionsTest(base.BaseSharesTest):
for share in shares:
self.assertEqual(params["status"], share["status"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_fake_status(self):
# list shares by fake status, no shares are expected
params = {"status": 'fake'}
shares = self.shares_client.list_shares_with_detail(params)
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_with_detail_filter_by_all_tenants(self):
# non-admin user can get shares only from his project
params = {"all_tenants": 1}
@ -348,7 +348,7 @@ class SharesActionsTest(base.BaseSharesTest):
for share in shares:
self.assertEqual(project_id, share["project_id"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_list_shares_public_with_detail(self):
public_share = self.create_share(
name='public_share',
@ -383,7 +383,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertFalse(any([s["id"] == private_share["id"] for s in shares]))
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_get_snapshot(self):
@ -411,7 +411,7 @@ class SharesActionsTest(base.BaseSharesTest):
"actual share_id: '%s'" % (self.shares[0]["id"], get["share_id"])
self.assertEqual(self.shares[0]["id"], get["share_id"], msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots(self):
@ -428,7 +428,7 @@ class SharesActionsTest(base.BaseSharesTest):
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail(self):
@ -447,7 +447,7 @@ class SharesActionsTest(base.BaseSharesTest):
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail_use_limit(self):
@ -473,7 +473,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(1, len(snaps['snapshots']))
self.assertEqual(self.snap['id'], snaps['snapshots'][0]['id'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail_filter_by_status_and_name(self):
@ -489,7 +489,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(filters['status'], snap['status'])
self.assertEqual(filters['name'], snap['name'])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail_and_asc_sorting(self):
@ -504,7 +504,7 @@ class SharesActionsTest(base.BaseSharesTest):
sorted_list = [snap['share_id'] for snap in snaps]
self.assertEqual(sorted(sorted_list), sorted_list)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipUnless(
CONF.share.run_extend_tests,
"Share extend tests are disabled.")
@ -527,7 +527,7 @@ class SharesActionsTest(base.BaseSharesTest):
)
self.assertEqual(new_size, share_get['size'], msg)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
@testtools.skipUnless(
CONF.share.run_shrink_tests,
"Share shrink tests are disabled.")
@ -573,7 +573,7 @@ class SharesRenameTest(base.BaseSharesTest):
cls.snap = cls.create_snapshot_wait_for_active(
cls.share["id"], cls.snap_name, cls.snap_desc)
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
def test_update_share(self):
# get share
@ -597,7 +597,7 @@ class SharesRenameTest(base.BaseSharesTest):
self.assertEqual(new_desc, share["description"])
self.assertTrue(share["is_public"])
@test.attr(type=["gate", ])
@test.attr(type=[base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_rename_snapshot(self):

View File

@ -13,26 +13,26 @@
# 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,
)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_extend_tests,
"Share extend tests are disabled.")
@ -50,7 +50,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
self.share['id'],
new_size)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_extend_tests,
"Share extend tests are disabled.")
@ -63,7 +63,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
self.share['id'],
new_size)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_extend_tests,
"Share extend tests are disabled.")
@ -76,7 +76,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
self.share['id'],
new_size)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_extend_tests,
"Share extend tests are disabled.")
@ -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,
@ -94,7 +93,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
share['id'],
new_size)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_shrink_tests,
"Share shrink tests are disabled.")
@ -107,7 +106,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
self.share['id'],
new_size)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_shrink_tests,
"Share shrink tests are disabled.")
@ -120,7 +119,7 @@ class SharesActionsNegativeTest(base.BaseSharesTest):
self.share['id'],
new_size)
@test.attr(type=["negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(
CONF.share.run_shrink_tests,
"Share shrink tests are disabled.")
@ -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

@ -36,90 +36,13 @@ class SharesNegativeTest(base.BaseSharesTest):
metadata={'key': 'value'}
)
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_invalid_protocol(self):
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(lib_exc.BadRequest,
self.shares_client.create_share, is_public='truebar')
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_update_share_with_wrong_public_value(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.update_share, self.share["id"],
is_public="truebar")
@test.attr(type=["negative", "smoke", "gate", ])
def test_get_share_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound, self.shares_client.get_share,
"wrong_share_id")
@test.attr(type=["negative", "smoke", "gate", ])
def test_get_share_without_passing_share_id(self):
# Should not be able to get share when empty ID is passed
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share, '')
@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.Forbidden,
self.shares_client.list_shares_with_detail,
{'share_server_id': 'fake_share_server_id'})
@test.attr(type=["negative", "smoke", "gate", ])
def test_delete_share_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound, self.shares_client.delete_share,
"wrong_share_id")
@test.attr(type=["negative", "smoke", "gate", ])
def test_delete_share_without_passing_share_id(self):
# Should not be able to delete share when empty ID is passed
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share, '')
@test.attr(type=["negative", "smoke", "gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_snapshot_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_snapshot,
"wrong_share_id")
@test.attr(type=["negative", "smoke", "gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_delete_snapshot_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_snapshot,
"wrong_share_id")
@test.attr(type=["negative", "smoke", "gate", ])
def test_create_share_with_invalid_size(self):
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(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(lib_exc.BadRequest,
self.shares_client.create_share, size=0)
@test.attr(type=["negative", "gate", ])
def test_create_share_non_existent_az(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.create_share,
availability_zone='fake_az')
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_try_delete_share_with_existing_snapshot(self):
@ -135,7 +58,7 @@ class SharesNegativeTest(base.BaseSharesTest):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.delete_share, share["id"])
@test.attr(type=["negative", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_from_snap_with_less_size(self):
@ -160,7 +83,7 @@ class SharesNegativeTest(base.BaseSharesTest):
size=1, snapshot_id=snap["id"],
cleanup_in_class=False)
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(not CONF.share.multitenancy_enabled,
"Only for multitenancy.")
def test_create_share_with_nonexistant_share_network(self):
@ -168,7 +91,7 @@ class SharesNegativeTest(base.BaseSharesTest):
self.shares_client.create_share,
share_network_id="wrong_sn_id")
@test.attr(type=["negative", "smoke", "gate", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
@testtools.skipIf(not CONF.share.multitenancy_enabled,
"Only for multitenancy.")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
@ -203,14 +126,14 @@ class SharesNegativeTest(base.BaseSharesTest):
snapshot_id=snap["id"],
)
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_update_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
self.assertRaises(lib_exc.Forbidden, isolated_client.update_share,
self.share["id"], name="new_name")
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
@ -218,7 +141,7 @@ class SharesNegativeTest(base.BaseSharesTest):
isolated_client.delete_share,
self.share['id'])
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_set_metadata_of_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
@ -227,7 +150,7 @@ class SharesNegativeTest(base.BaseSharesTest):
self.share['id'],
{'key': 'value'})
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_update_metadata_of_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
@ -236,7 +159,7 @@ class SharesNegativeTest(base.BaseSharesTest):
self.share['id'],
{'key': 'value'})
@test.attr(type=["gate", "smoke", "negative", ])
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND])
def test_delete_metadata_of_other_tenants_public_share(self):
isolated_client = self.get_client_with_isolated_creds(
type_of_creds='alt')
@ -245,21 +168,101 @@ class SharesNegativeTest(base.BaseSharesTest):
self.share['id'],
'key')
@test.attr(type=["gate", "smoke", "negative", ])
def test_list_by_share_server_by_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.list_shares,
params={'share_server_id': 12345})
@test.attr(type=["gate", "smoke", "negative", ])
class SharesAPIOnlyNegativeTest(base.BaseSharesTest):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_unmanage_share_by_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.unmanage_share,
'fake-id')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_manage_share_by_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.manage_share,
'fake-host', 'nfs', '/export/path',
'fake-type')
@test.attr(type=["gate", "smoke", "negative", ])
def test_unmanage_share_by_user(self):
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_list_by_share_server_by_user(self):
self.assertRaises(lib_exc.Forbidden,
self.shares_client.unmanage_share,
'fake-id')
self.shares_client.list_shares,
params={'share_server_id': 12345})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_non_existent_az(self):
self.assertRaises(lib_exc.NotFound,
self.shares_v2_client.create_share,
availability_zone='fake_az')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_zero_size(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, size=0)
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_invalid_size(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, size="#$%")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_out_passing_size(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, size="")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_delete_snapshot_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_snapshot,
"wrong_share_id")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_snapshot_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_snapshot,
"wrong_share_id")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_invalid_protocol(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share,
share_protocol="nonexistent_protocol")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_create_share_with_wrong_public_value(self):
self.assertRaises(lib_exc.BadRequest,
self.shares_client.create_share, is_public='truebar')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_share_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound, self.shares_client.get_share,
"wrong_share_id")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_get_share_without_passing_share_id(self):
# Should not be able to get share when empty ID is passed
self.assertRaises(lib_exc.NotFound,
self.shares_client.get_share, '')
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
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.Forbidden,
self.shares_client.list_shares_with_detail,
{'share_server_id': 'fake_share_server_id'})
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_share_with_wrong_id(self):
self.assertRaises(lib_exc.NotFound, self.shares_client.delete_share,
"wrong_share_id")
@test.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
def test_delete_share_without_passing_share_id(self):
# Should not be able to delete share when empty ID is passed
self.assertRaises(lib_exc.NotFound,
self.shares_client.delete_share, '')

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,

View File

@ -16,9 +16,11 @@
from oslo_log import log as logging
from tempest import config # noqa
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import exceptions
from tempest import test # noqa
from manila_tempest_tests.tests.api import base
from manila_tempest_tests.tests.scenario import manager_share as manager
from manila_tempest_tests import utils
@ -43,6 +45,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
def setUp(self):
super(ShareBasicOpsBase, self).setUp()
base.verify_test_has_appropriate_tags(self)
# Setup image and flavor the test instance
# Support both configured and injected values
if not hasattr(self, 'flavor_ref'):
@ -81,7 +84,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
# Obtain a floating IP
floating_ip = (self.compute_floating_ips_client.create_floating_ip()
['floating_ip'])
self.addCleanup(self.delete_wrapper,
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.compute_floating_ips_client.delete_floating_ip,
floating_ip['id'])
# Attach a floating IP
@ -169,6 +172,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
cleanup=cleanup)
@test.services('compute', 'network')
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_mount_share_one_vm(self):
self.security_group = self._create_security_group()
self.create_share()
@ -190,6 +194,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
self.servers_client.delete_server(instance['id'])
@test.services('compute', 'network')
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_read_write_two_vms(self):
"""Boots two vms and writes/reads data on it."""
test_data = "Some test data to write"
@ -225,6 +230,7 @@ class ShareBasicOpsBase(manager.ShareScenarioTest):
self.assertEqual(test_data, data)
@test.services('compute', 'network')
@test.attr(type=[base.TAG_POSITIVE, base.TAG_BACKEND])
def test_migration_files(self):
if self.protocol == "CIFS":