Merge "Use tempest-plugin service client registration"
diff --git a/manila_tempest_tests/common/remote_client.py b/manila_tempest_tests/common/remote_client.py
index 29f1b49..45f85d8 100644
--- a/manila_tempest_tests/common/remote_client.py
+++ b/manila_tempest_tests/common/remote_client.py
@@ -80,7 +80,7 @@
# Shell options below add more clearness on failures,
# path is extended for some non-cirros guest oses (centos7)
cmd = CONF.validation.ssh_shell_prologue + " " + cmd
- LOG.debug("Remote command: %s" % cmd)
+ LOG.debug("Remote command: %s", cmd)
return self.ssh_client.exec_command(cmd)
@debug_ssh
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages.py b/manila_tempest_tests/tests/api/admin/test_user_messages.py
index a887970..6bcd7cf 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages.py
@@ -61,7 +61,7 @@
# for number of keys in response's dict, if there is only single
# key, it returns directly this key, otherwise it returns
# parsed body. If limit param is used, then API returns
- # multiple keys in reponse ('messages' and 'message_links')
+ # multiple keys in response ('messages' and 'message_links')
messages = body['messages']
self.assertIsInstance(messages, list)
ids = [x['resource_id'] for x in messages]
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 1f173fb..94e496a 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -88,7 +88,7 @@
return False # Do not suppress error if any
if exc_traceback:
LOG.error("Suppressed cleanup error in Manila: "
- "\n%s" % traceback.format_exc())
+ "\n%s", traceback.format_exc())
return True # Suppress error if any
@@ -931,7 +931,7 @@
client.wait_for_resource_deletion(replica_id=res_id)
else:
LOG.warning("Provided unsupported resource type for "
- "cleanup '%s'. Skipping." % res["type"])
+ "cleanup '%s'. Skipping.", res["type"])
res["deleted"] = True
@classmethod
diff --git a/manila_tempest_tests/tests/api/test_rules.py b/manila_tempest_tests/tests/api/test_rules.py
index 229263e..0b44a5c 100644
--- a/manila_tempest_tests/tests/api/test_rules.py
+++ b/manila_tempest_tests/tests/api/test_rules.py
@@ -93,15 +93,17 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@ddt.data(*itertools.chain(
- itertools.product({'1.0', '2.9', '2.37', LATEST_MICROVERSION},
- {utils.rand_ip()}),
- itertools.product({'2.37', LATEST_MICROVERSION},
- {utils.rand_ipv6_ip()})
+ itertools.product({'1.0', '2.9', '2.37', LATEST_MICROVERSION}, {4}),
+ itertools.product({'2.38', LATEST_MICROVERSION}, {6})
))
@ddt.unpack
def test_create_delete_access_rules_with_one_ip(self, version,
- access_to):
+ ip_version):
+ if ip_version == 4:
+ access_to = utils.rand_ip()
+ else:
+ access_to = utils.rand_ipv6_ip()
# create rule
if utils.is_microversion_eq(version, '1.0'):
rule = self.shares_client.create_access_rule(
@@ -145,14 +147,15 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_BACKEND)
@ddt.data(*itertools.chain(
- itertools.product({'1.0', '2.9', '2.37', LATEST_MICROVERSION},
- {utils.rand_ip(network=True)}),
- itertools.product({'2.37', LATEST_MICROVERSION},
- {utils.rand_ipv6_ip(network=True)})
+ itertools.product({'1.0', '2.9', '2.37', LATEST_MICROVERSION}, {4}),
+ itertools.product({'2.38', LATEST_MICROVERSION}, {6})
))
@ddt.unpack
- def test_create_delete_access_rule_with_cidr(self, version, access_to):
-
+ def test_create_delete_access_rule_with_cidr(self, version, ip_version):
+ if ip_version == 4:
+ access_to = utils.rand_ip(network=True)
+ else:
+ access_to = utils.rand_ipv6_ip(network=True)
# create rule
if utils.is_microversion_eq(version, '1.0'):
rule = self.shares_client.create_access_rule(
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index 2e28703..fd884f2 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -183,7 +183,7 @@
LOG.warning("Caught exception. It is expected in case backend "
"fails having security-service with improper data "
"that leads to share-server creation error. "
- "%s" % six.text_type(e))
+ "%s", six.text_type(e))
update_data = {
"name": "name",
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index e8f034c..4b4912d 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -115,7 +115,7 @@
LOG.warning("Caught exception. It is expected in case backend "
"fails having security-service with improper data "
"that leads to share-server creation error. "
- "%s" % six.text_type(e))
+ "%s", six.text_type(e))
self.assertRaises(lib_exc.Forbidden,
self.cl.remove_sec_service_from_share_network,
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index 7537865..1f8e188 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -101,7 +101,7 @@
LOG.warning("Caught exception. It is expected in case backend "
"fails having security-service with improper data "
"that leads to share-server creation error. "
- "%s" % six.text_type(e))
+ "%s", six.text_type(e))
self.assertRaises(lib_exc.Forbidden,
self.shares_client.update_security_service,
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index e12990e..cf179bf 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -338,7 +338,15 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@base.skip_if_microversion_lt("2.36")
- def test_list_shares_with_detail_filter_by_nonexistent_name(self):
+ def test_list_shares_with_detail_filter_by_existed_description(self):
+ # list shares by description, at least one share is expected
+ params = {"description": self.share_desc}
+ shares = self.shares_v2_client.list_shares_with_detail(params)
+ self.assertEqual(self.share_name, shares[0]["name"])
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
+ @base.skip_if_microversion_lt("2.36")
+ def test_list_shares_with_detail_filter_by_inexact_name(self):
# list shares by name, at least one share is expected
params = {"name~": 'tempest-share'}
shares = self.shares_v2_client.list_shares_with_detail(params)
@@ -563,6 +571,22 @@
@tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(CONF.share.run_snapshot_tests,
"Snapshot tests are disabled.")
+ @base.skip_if_microversion_not_supported("2.35")
+ def test_list_snapshots_with_detail_filter_by_description(self):
+ filters = {'description': self.snap_desc}
+
+ # list snapshots
+ snaps = self.shares_client.list_snapshots_with_detail(
+ params=filters)
+
+ # verify response
+ self.assertGreater(len(snaps), 0)
+ for snap in snaps:
+ self.assertEqual(filters['description'], snap['description'])
+
+ @tc.attr(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):
filters = {'sort_key': 'share_id', 'sort_dir': 'asc'}
diff --git a/manila_tempest_tests/tests/api/test_shares_actions_negative.py b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
index 1f3da5f..6d1fa6c 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions_negative.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions_negative.py
@@ -15,6 +15,7 @@
import ddt
from tempest import config
+from tempest.lib.common.utils import data_utils
from tempest.lib import exceptions as lib_exc
import testtools
from testtools import testcase as tc
@@ -30,7 +31,18 @@
def resource_setup(cls):
super(SharesActionsNegativeTest, cls).resource_setup()
cls.admin_client = cls.admin_shares_v2_client
- cls.share = cls.create_share()
+ cls.share_name = data_utils.rand_name("tempest-share-name")
+ cls.share_desc = data_utils.rand_name("tempest-share-description")
+ cls.share = cls.create_share(
+ name=cls.share_name,
+ description=cls.share_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)
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
@testtools.skipUnless(
@@ -167,7 +179,7 @@
self.assertEqual(0, len(shares))
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
- @base.skip_if_microversion_not_supported("2.35")
+ @base.skip_if_microversion_not_supported("2.36")
def test_list_shares_with_like_filter_and_invalid_version(self):
# In API versions < v2.36, querying the share API by inexact
# filter (name or description) should have no effect. Those
@@ -182,7 +194,7 @@
self.assertGreater(len(shares), 0)
@tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
- @base.skip_if_microversion_not_supported("2.35")
+ @base.skip_if_microversion_not_supported("2.36")
def test_list_shares_with_like_filter_not_exist(self):
filters = {
'name~': 'fake_not_exist',
@@ -191,3 +203,43 @@
shares = self.shares_v2_client.list_shares(params=filters)
self.assertEqual(0, len(shares))
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ def test_list_shares_with_name_not_exist(self):
+ filters = {
+ 'name': "tempest-share",
+ }
+ shares = self.shares_v2_client.list_shares(params=filters)
+
+ self.assertEqual(0, len(shares))
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ @base.skip_if_microversion_not_supported("2.36")
+ def test_list_shares_with_description_not_exist(self):
+ filters = {
+ 'description': "tempest-share",
+ }
+ shares = self.shares_v2_client.list_shares(params=filters)
+
+ self.assertEqual(0, len(shares))
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ @base.skip_if_microversion_not_supported("2.36")
+ def test_list_snapshots_with_description_not_exist(self):
+ filters = {
+ 'description': "tempest-snapshot",
+ }
+ shares = self.shares_v2_client.list_snapshots_with_detail(
+ params=filters)
+
+ self.assertEqual(0, len(shares))
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ def test_list_snapshots_with_name_not_exist(self):
+ filters = {
+ 'name': "tempest-snapshot",
+ }
+ shares = self.shares_v2_client.list_snapshots_with_detail(
+ params=filters)
+
+ self.assertEqual(0, len(shares))
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index e9b51ca..cec567b 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -221,7 +221,7 @@
try:
linux_client.validate_authentication()
except Exception:
- LOG.exception('Initializing SSH connection to %s failed' % ip)
+ LOG.exception('Initializing SSH connection to %s failed', ip)
self._log_console_output()
raise
diff --git a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
index ea79ef2..7dba83b 100644
--- a/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
+++ b/manila_tempest_tests/tests/scenario/test_share_basic_ops.py
@@ -189,7 +189,7 @@
first_address = net_addresses.values()[0][0]
ip = first_address['addr']
except Exception:
- LOG.debug("Instance: %s" % instance)
+ LOG.debug("Instance: %s", instance)
# In case on an error ip will be still none
LOG.exception("Instance does not have a valid IP address."
"Falling back to default")