Allow Tempest to skip snapshot tests

On last midcycle meetup was decided to make snapshots optional feature.
So, at first step, add possibility to skip all functional tests that
use snapshots.

Partially implements bp snapshots-optional

Change-Id: Ib7dd3303e3974298439b6ac543b9df628b69e6ae
This commit is contained in:
Valeriy Ponomaryov 2015-08-10 12:52:51 +03:00
parent 687153838b
commit 7b244b33b7
8 changed files with 178 additions and 86 deletions

View File

@ -13,9 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools # noqa
from tempest.api.share import base
from tempest import config_share as config
from tempest import test
CONF = config.CONF
class AdminActionsTest(base.BaseSharesAdminTest):
@ -25,7 +30,8 @@ class AdminActionsTest(base.BaseSharesAdminTest):
cls.states = ["error", "available"]
cls.bad_status = "error_deleting"
cls.sh = cls.create_share()
cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
if CONF.share.run_snapshot_tests:
cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
@test.attr(type=["gate", ])
def test_reset_share_state(self):
@ -34,6 +40,8 @@ class AdminActionsTest(base.BaseSharesAdminTest):
self.shares_client.wait_for_share_status(self.sh["id"], status)
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_reset_snapshot_state_to_error(self):
for status in self.states:
self.shares_client.reset_state(
@ -56,6 +64,8 @@ class AdminActionsTest(base.BaseSharesAdminTest):
self.shares_client.wait_for_resource_deletion(share_id=share["id"])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_force_delete_snapshot(self):
sn = self.create_snapshot_wait_for_active(self.sh["id"])

View File

@ -14,6 +14,7 @@
# under the License.
from tempest_lib import exceptions as lib_exc # noqa
import testtools # noqa
from tempest.api.share import base
from tempest import clients_share as clients
@ -29,7 +30,8 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
def resource_setup(cls):
super(AdminActionsNegativeTest, cls).resource_setup()
cls.sh = cls.create_share()
cls.sn = cls.create_snapshot_wait_for_active(cls.sh["id"])
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
@test.attr(type=["gate", "negative", ])
@ -38,6 +40,8 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
self.shares_client.reset_state, "fake")
@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")
@ -49,6 +53,8 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
self.sh["id"], status="fake")
@test.attr(type=["gate", "negative", ])
@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,
@ -62,6 +68,8 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
self.sh["id"])
@test.attr(type=["gate", "negative", ])
@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,
@ -74,6 +82,8 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
self.shares_client.force_delete, "fake")
@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,
@ -88,6 +98,8 @@ class AdminActionsNegativeTest(base.BaseSharesAdminTest):
self.sh["id"])
@test.attr(type=["gate", "negative", ])
@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,

View File

@ -30,6 +30,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
def resource_setup(cls):
super(SharesActionsAdminTest, cls).resource_setup()
cls.shares = []
# create share type for share filtering purposes
cls.st_name = data_utils.rand_name("tempest-st-name")
cls.extra_specs = cls.add_required_extra_specs_to_dict(
@ -48,41 +50,43 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
'bar_key_share_1': 'foo_value_share_1',
}
cls.share_size = 1
cls.share = cls.create_share(
cls.shares.append(cls.create_share(
name=cls.share_name,
description=cls.share_desc,
size=cls.share_size,
metadata=cls.metadata,
share_type_id=cls.st['share_type']['id'],
)
))
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name("tempest-snapshot-description")
cls.snap = cls.create_snapshot_wait_for_active(
cls.share["id"], cls.snap_name, cls.snap_desc)
if CONF.share.run_snapshot_tests:
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(
"tempest-snapshot-description")
cls.snap = cls.create_snapshot_wait_for_active(
cls.shares[0]["id"], cls.snap_name, cls.snap_desc)
# create second share from snapshot for purposes of sorting and
# snapshot filtering
cls.share_name2 = data_utils.rand_name("tempest-share-name")
cls.share_desc2 = data_utils.rand_name("tempest-share-description")
cls.metadata2 = {
'foo_key_share_2': 'foo_value_share_2',
'bar_key_share_2': 'foo_value_share_2',
}
cls.share2 = cls.create_share(
name=cls.share_name2,
description=cls.share_desc2,
size=cls.share_size,
metadata=cls.metadata2,
snapshot_id=cls.snap['id'],
)
# create second share from snapshot for purposes of sorting and
# snapshot filtering
cls.share_name2 = data_utils.rand_name("tempest-share-name")
cls.share_desc2 = data_utils.rand_name("tempest-share-description")
cls.metadata2 = {
'foo_key_share_2': 'foo_value_share_2',
'bar_key_share_2': 'foo_value_share_2',
}
cls.shares.append(cls.create_share(
name=cls.share_name2,
description=cls.share_desc2,
size=cls.share_size,
metadata=cls.metadata2,
snapshot_id=cls.snap['id'],
))
@test.attr(type=["gate", ])
def test_get_share(self):
# get share
share = self.shares_client.get_share(self.share['id'])
share = self.shares_client.get_share(self.shares[0]['id'])
# verify keys
expected_keys = ["status", "description", "links", "availability_zone",
@ -116,8 +120,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
[self.assertIn(key, sh.keys()) for sh in shares for key in keys]
# our share id in list and have no duplicates
for share_id in [self.share["id"], self.share2["id"]]:
gen = [sid["id"] for sid in shares if sid["id"] in share_id]
for share in self.shares:
gen = [sid["id"] for sid in shares if sid["id"] in share["id"]]
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@ -136,8 +140,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
[self.assertIn(key, sh.keys()) for sh in shares for key in keys]
# our shares in list and have no duplicates
for share_id in [self.share["id"], self.share2["id"]]:
gen = [sid["id"] for sid in shares if sid["id"] in share_id]
for share in self.shares:
gen = [sid["id"] for sid in shares if sid["id"] in share["id"]]
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@ -153,7 +157,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
for share in shares:
self.assertDictContainsSubset(
filters['metadata'], share['metadata'])
self.assertFalse(self.share2['id'] in [s['id'] for s in shares])
if CONF.share.run_snapshot_tests:
self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_extra_specs(self):
@ -167,8 +172,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
# verify response
self.assertTrue(len(shares) > 0)
shares_ids = [s["id"] for s in shares]
self.assertTrue(self.share["id"] in shares_ids)
self.assertTrue(self.share2["id"] in shares_ids)
for share in self.shares:
self.assertTrue(share["id"] in shares_ids)
for share in shares:
st_list = self.shares_client.list_share_types()
# find its name or id, get id
@ -214,12 +219,12 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertEqual(
filters['share_type_id'], st_id)
share_ids = [share['id'] for share in shares]
self.assertTrue(self.share['id'] in share_ids)
self.assertTrue(self.share2['id'] in share_ids)
for share in self.shares:
self.assertTrue(share['id'] in share_ids)
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_host(self):
base_share = self.shares_client.get_share(self.share['id'])
base_share = self.shares_client.get_share(self.shares[0]['id'])
filters = {'host': base_share['host']}
# list shares
@ -234,7 +239,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_list_shares_with_detail_filter_by_share_network_id(self):
base_share = self.shares_client.get_share(self.share['id'])
base_share = self.shares_client.get_share(self.shares[0]['id'])
filters = {'share_network_id': base_share['share_network_id']}
# list shares
@ -247,6 +252,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
filters['share_network_id'], share['share_network_id'])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_shares_with_detail_filter_by_snapshot_id(self):
filters = {'snapshot_id': self.snap['id']}
@ -257,7 +264,7 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertTrue(len(shares) > 0)
for share in shares:
self.assertEqual(filters['snapshot_id'], share['snapshot_id'])
self.assertFalse(self.share['id'] in [s['id'] for s in shares])
self.assertFalse(self.shares[0]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_with_asc_sorting(self):
@ -302,6 +309,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertEqual(0, len(shares))
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_get_snapshot(self):
# get snapshot
@ -324,10 +333,12 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertEqual(self.snap_desc, get["description"], msg)
msg = "Expected share_id: '%s', "\
"actual share_id: '%s'" % (self.share["id"], get["share_id"])
self.assertEqual(self.share["id"], get["share_id"], msg)
"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", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots(self):
# list share snapshots
@ -343,6 +354,8 @@ class SharesActionsAdminTest(base.BaseSharesAdminTest):
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail(self):
# list share snapshots

View File

@ -14,6 +14,7 @@
# under the License.
from tempest_lib import exceptions as lib_exc # noqa
import testtools # noqa
from tempest.api.share import base
from tempest import config_share as config
@ -34,8 +35,9 @@ class ShareIpRulesForNFSNegativeTest(base.BaseSharesTest):
raise cls.skipException(msg)
# create share
cls.share = cls.create_share(cls.protocol)
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
if CONF.share.run_snapshot_tests:
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_ip_with_wrong_target_1(self):
@ -128,8 +130,9 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
raise cls.skipException(msg)
# create share
cls.share = cls.create_share(cls.protocol)
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
if CONF.share.run_snapshot_tests:
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@test.attr(type=["negative", "gate", ])
def test_create_access_rule_user_with_wrong_input_2(self):
@ -164,6 +167,8 @@ class ShareUserRulesForNFSNegativeTest(base.BaseSharesTest):
"try+")
@test.attr(type=["negative", "gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_access_rule_user_to_snapshot(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_access_rule,
@ -207,8 +212,9 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
raise cls.skipException(cls.message)
# create share
cls.share = cls.create_share()
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
if CONF.share.run_snapshot_tests:
# create snapshot
cls.snap = cls.create_snapshot_wait_for_active(cls.share["id"])
@test.attr(type=["negative", "gate", ])
def test_delete_access_rule_with_wrong_id(self):
@ -229,6 +235,8 @@ class ShareRulesNegativeTest(base.BaseSharesTest):
"wrong_share_id")
@test.attr(type=["negative", "gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_access_rule_ip_to_snapshot(self):
self.assertRaises(lib_exc.NotFound,
self.shares_client.create_access_rule,

View File

@ -61,6 +61,8 @@ class SharesNFSTest(base.BaseSharesTest):
share['id'])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_delete_snapshot(self):
# create snapshot
@ -81,6 +83,8 @@ class SharesNFSTest(base.BaseSharesTest):
self.shares_client.get_snapshot, snap['id'])
@test.attr(type=["gate", "smoke", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_from_snapshot(self):
# If multitenant driver used, share_network will be provided by default
@ -101,6 +105,8 @@ class SharesNFSTest(base.BaseSharesTest):
@test.attr(type=["gate", "smoke", ])
@testtools.skipIf(not CONF.share.multitenancy_enabled,
"Only for multitenancy.")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_from_snapshot_share_network_not_provided(self):
# We expect usage of share network from parent's share
# when creating share from snapshot using multitenant driver.

View File

@ -30,6 +30,8 @@ class SharesActionsTest(base.BaseSharesTest):
def resource_setup(cls):
super(SharesActionsTest, cls).resource_setup()
cls.shares = []
# create share
cls.share_name = data_utils.rand_name("tempest-share-name")
cls.share_desc = data_utils.rand_name("tempest-share-description")
@ -38,40 +40,42 @@ class SharesActionsTest(base.BaseSharesTest):
'bar_key_share_1': 'foo_value_share_1',
}
cls.share_size = 1
cls.share = cls.create_share(
cls.shares.append(cls.create_share(
name=cls.share_name,
description=cls.share_desc,
size=cls.share_size,
metadata=cls.metadata,
)
))
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name("tempest-snapshot-description")
cls.snap = cls.create_snapshot_wait_for_active(
cls.share["id"], cls.snap_name, cls.snap_desc)
if CONF.share.run_snapshot_tests:
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(
"tempest-snapshot-description")
cls.snap = cls.create_snapshot_wait_for_active(
cls.shares[0]["id"], cls.snap_name, cls.snap_desc)
# create second share from snapshot for purposes of sorting and
# snapshot filtering
cls.share_name2 = data_utils.rand_name("tempest-share-name")
cls.share_desc2 = data_utils.rand_name("tempest-share-description")
cls.metadata2 = {
'foo_key_share_2': 'foo_value_share_2',
'bar_key_share_2': 'foo_value_share_2',
}
cls.share2 = cls.create_share(
name=cls.share_name2,
description=cls.share_desc2,
size=cls.share_size,
metadata=cls.metadata2,
snapshot_id=cls.snap['id'],
)
# create second share from snapshot for purposes of sorting and
# snapshot filtering
cls.share_name2 = data_utils.rand_name("tempest-share-name")
cls.share_desc2 = data_utils.rand_name("tempest-share-description")
cls.metadata2 = {
'foo_key_share_2': 'foo_value_share_2',
'bar_key_share_2': 'foo_value_share_2',
}
cls.shares.append(cls.create_share(
name=cls.share_name2,
description=cls.share_desc2,
size=cls.share_size,
metadata=cls.metadata2,
snapshot_id=cls.snap['id'],
))
@test.attr(type=["gate", ])
def test_get_share(self):
# get share
share = self.shares_client.get_share(self.share['id'])
share = self.shares_client.get_share(self.shares[0]['id'])
# verify keys
expected_keys = ["status", "description", "links", "availability_zone",
@ -105,8 +109,8 @@ class SharesActionsTest(base.BaseSharesTest):
[self.assertIn(key, sh.keys()) for sh in shares for key in keys]
# our share id in list and have no duplicates
for share_id in [self.share["id"], self.share2["id"]]:
gen = [sid["id"] for sid in shares if sid["id"] in share_id]
for share in self.shares:
gen = [sid["id"] for sid in shares if sid["id"] in share["id"]]
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@ -125,8 +129,8 @@ class SharesActionsTest(base.BaseSharesTest):
[self.assertIn(key, sh.keys()) for sh in shares for key in keys]
# our shares in list and have no duplicates
for share_id in [self.share["id"], self.share2["id"]]:
gen = [sid["id"] for sid in shares if sid["id"] in share_id]
for share in self.shares:
gen = [sid["id"] for sid in shares if sid["id"] in share["id"]]
msg = "expected id lists %s times in share list" % (len(gen))
self.assertEqual(1, len(gen), msg)
@ -142,11 +146,12 @@ class SharesActionsTest(base.BaseSharesTest):
for share in shares:
self.assertDictContainsSubset(
filters['metadata'], share['metadata'])
self.assertFalse(self.share2['id'] in [s['id'] for s in shares])
if CONF.share.run_snapshot_tests:
self.assertFalse(self.shares[1]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_filter_by_host(self):
base_share = self.shares_client.get_share(self.share['id'])
base_share = self.shares_client.get_share(self.shares[0]['id'])
filters = {'host': base_share['host']}
# list shares
@ -161,7 +166,7 @@ class SharesActionsTest(base.BaseSharesTest):
@testtools.skipIf(
not CONF.share.multitenancy_enabled, "Only for multitenancy.")
def test_list_shares_with_detail_filter_by_share_network_id(self):
base_share = self.shares_client.get_share(self.share['id'])
base_share = self.shares_client.get_share(self.shares[0]['id'])
filters = {'share_network_id': base_share['share_network_id']}
# list shares
@ -174,6 +179,8 @@ class SharesActionsTest(base.BaseSharesTest):
filters['share_network_id'], share['share_network_id'])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_shares_with_detail_filter_by_snapshot_id(self):
filters = {'snapshot_id': self.snap['id']}
@ -184,7 +191,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertTrue(len(shares) > 0)
for share in shares:
self.assertEqual(filters['snapshot_id'], share['snapshot_id'])
self.assertFalse(self.share['id'] in [s['id'] for s in shares])
self.assertFalse(self.shares[0]['id'] in [s['id'] for s in shares])
@test.attr(type=["gate", ])
def test_list_shares_with_detail_with_asc_sorting(self):
@ -236,7 +243,7 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertTrue(len(shares) > 0)
# get share with detailed info, we need its 'project_id'
share = self.shares_client.get_share(self.share["id"])
share = self.shares_client.get_share(self.shares[0]["id"])
project_id = share["project_id"]
for share in shares:
self.assertEqual(share["project_id"], project_id)
@ -275,6 +282,8 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertFalse(any([s["id"] == private_share["id"] for s in shares]))
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_get_snapshot(self):
# get snapshot
@ -297,10 +306,12 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(self.snap_desc, get["description"], msg)
msg = "Expected share_id: '%s', "\
"actual share_id: '%s'" % (self.share["id"], get["share_id"])
self.assertEqual(self.share["id"], get["share_id"], msg)
"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", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots(self):
# list share snapshots
@ -316,6 +327,8 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(1, len(gen), msg)
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail(self):
# list share snapshots
@ -333,9 +346,15 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(len(gen), 1, msg)
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail_use_limit(self):
for l, o in [('1', '1'), ('0', '1')]:
filters = {'limit': l, 'offset': o, 'share_id': self.share['id']}
filters = {
'limit': l,
'offset': o,
'share_id': self.shares[0]['id'],
}
# list snapshots
snaps = self.shares_client.list_snapshots_with_detail(
@ -346,12 +365,15 @@ class SharesActionsTest(base.BaseSharesTest):
# Only our one snapshot should be listed
snaps = self.shares_client.list_snapshots_with_detail(
params={'limit': '1', 'offset': '0', 'share_id': self.share['id']})
params={'limit': '1', 'offset': '0',
'share_id': self.shares[0]['id']})
self.assertEqual(1, len(snaps['snapshots']))
self.assertEqual(self.snap['id'], snaps['snapshots'][0]['id'])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail_filter_by_status_and_name(self):
filters = {'status': 'available', 'name': self.snap_name}
@ -366,6 +388,8 @@ class SharesActionsTest(base.BaseSharesTest):
self.assertEqual(filters['name'], snap['name'])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_list_snapshots_with_detail_and_asc_sorting(self):
filters = {'sort_key': 'share_id', 'sort_dir': 'asc'}
@ -425,11 +449,13 @@ class SharesRenameTest(base.BaseSharesTest):
name=cls.share_name, description=cls.share_desc,
size=cls.share_size)
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name("tempest-snapshot-description")
cls.snap = cls.create_snapshot_wait_for_active(
cls.share["id"], cls.snap_name, cls.snap_desc)
if CONF.share.run_snapshot_tests:
# create snapshot
cls.snap_name = data_utils.rand_name("tempest-snapshot-name")
cls.snap_desc = data_utils.rand_name(
"tempest-snapshot-description")
cls.snap = cls.create_snapshot_wait_for_active(
cls.share["id"], cls.snap_name, cls.snap_desc)
@test.attr(type=["gate", ])
def test_update_share(self):
@ -456,6 +482,8 @@ class SharesRenameTest(base.BaseSharesTest):
self.assertTrue(share["is_public"])
@test.attr(type=["gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_rename_snapshot(self):
# get snapshot

View File

@ -83,12 +83,16 @@ class SharesNegativeTest(base.BaseSharesTest):
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,
@ -110,6 +114,8 @@ class SharesNegativeTest(base.BaseSharesTest):
self.shares_client.create_share, size=0)
@test.attr(type=["negative", "gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_try_delete_share_with_existing_snapshot(self):
# share can not be deleted while snapshot exists
@ -124,6 +130,8 @@ class SharesNegativeTest(base.BaseSharesTest):
self.shares_client.delete_share, share["id"])
@test.attr(type=["negative", "gate", ])
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_from_snap_with_less_size(self):
# requires minimum 5Gb available space
@ -157,6 +165,8 @@ class SharesNegativeTest(base.BaseSharesTest):
@test.attr(type=["negative", "smoke", "gate", ])
@testtools.skipIf(not CONF.share.multitenancy_enabled,
"Only for multitenancy.")
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
def test_create_share_from_snap_with_different_share_network(self):
# create share
share = self.create_share(cleanup_in_class=False)

View File

@ -123,6 +123,11 @@ ShareGroup = [
help="Defines whether to run share shrink tests or not. "
"Disable this feature if used driver doesn't "
"support it."),
cfg.BoolOpt("run_snapshot_tests",
default=True,
help="Defines whether to run tests that use share snapshots "
"or not. Disable this feature if used driver doesn't "
"support it."),
cfg.StrOpt("image_with_share_tools",
default="manila-service-image",
help="Image name for vm booting with nfs/smb clients tool."),