Merge "Make set_flavor_extra_spec use **kwargs"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 07ee026..c97eb97 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -5,12 +5,14 @@
#
# Print debugging output (set logging level to DEBUG instead of
-# default WARNING level). (boolean value)
+# default INFO level). (boolean value)
#debug = false
-# Print more verbose output (set logging level to INFO instead of
-# default WARNING level). (boolean value)
-#verbose = false
+# If set to false, will disable INFO logging level, making WARNING the
+# default. (boolean value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+#verbose = true
# The name of a logging configuration file. This file is appended to
# any existing logging configuration files. For details about logging
@@ -376,6 +378,10 @@
# value)
#live_migration = true
+# Does the test environment support metadata service? Ignored unless
+# validation.run_validation=true. (boolean value)
+#metadata_service = true
+
# Does the test environment use block devices for live migration
# (boolean value)
#block_migration_for_live_migration = false
@@ -498,18 +504,29 @@
# From tempest.config
#
-# A regex to determine which requests should be traced. This is a
-# regex to match the caller for rest client requests to be able to
+# A regex to determine which requests should be traced.
+#
+# This is a regex to match the caller for rest client requests to be
+# able to
# selectively trace calls out of specific classes and methods. It
-# largely exists for test development, and is not expected to be used
-# in a real deploy of tempest. This will be matched against the
-# discovered ClassName:method in the test environment. Expected
-# values for this field are: * ClassName:test_method_name - traces
-# one test_method * ClassName:setUp(Class) - traces specific setup
-# functions * ClassName:tearDown(Class) - traces specific teardown
-# functions * ClassName:_run_cleanups - traces the cleanup functions
+# largely
+# exists for test development, and is not expected to be used in a
+# real deploy
+# of tempest. This will be matched against the discovered
+# ClassName:method
+# in the test environment.
+#
+# Expected values for this field are:
+#
+# * ClassName:test_method_name - traces one test_method
+# * ClassName:setUp(Class) - traces specific setup functions
+# * ClassName:tearDown(Class) - traces specific teardown functions
+# * ClassName:_run_cleanups - traces the cleanup functions
+#
# If nothing is specified, this feature is not enabled. To trace
-# everything specify .* as the regex. (string value)
+# everything
+# specify .* as the regex.
+# (string value)
#trace_requests =
diff --git a/setup.cfg b/setup.cfg
index f28c481..ab40f12 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -22,7 +22,7 @@
packages =
tempest
data_files =
- /etc/tempest = etc/*
+ etc/tempest = etc/*
[entry_points]
console_scripts =
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 13d6cc0..5ae6553 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -45,9 +45,9 @@
cidr='10.10.0.0/24'):
# Create Security Group default rule
rule = self.adm_client.create_security_default_group_rule(
- ip_protocol,
- from_port,
- to_port,
+ ip_protocol=ip_protocol,
+ from_port=from_port,
+ to_port=to_port,
cidr=cidr)
self.assertEqual(ip_protocol, rule['ip_protocol'])
self.assertEqual(from_port, rule['from_port'])
@@ -73,9 +73,9 @@
from_port = 80
to_port = 80
rule = self.adm_client.create_security_default_group_rule(
- ip_protocol,
- from_port,
- to_port)
+ ip_protocol=ip_protocol,
+ from_port=from_port,
+ to_port=to_port)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
self.assertNotEqual(0, rule['id'])
@@ -88,9 +88,9 @@
to_port = 10
cidr = ''
rule = self.adm_client.create_security_default_group_rule(
- ip_protocol,
- from_port,
- to_port,
+ ip_protocol=ip_protocol,
+ from_port=from_port,
+ to_port=to_port,
cidr=cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
diff --git a/tempest/api/compute/keypairs/test_keypairs.py b/tempest/api/compute/keypairs/test_keypairs.py
index 45eaa97..9243fdf 100644
--- a/tempest/api/compute/keypairs/test_keypairs.py
+++ b/tempest/api/compute/keypairs/test_keypairs.py
@@ -31,7 +31,10 @@
self.client.delete_keypair(keypair_name)
def _create_keypair(self, keypair_name, pub_key=None):
- body = self.client.create_keypair(keypair_name, pub_key)
+ kwargs = {'name': keypair_name}
+ if pub_key:
+ kwargs.update({'public_key': pub_key})
+ body = self.client.create_keypair(**kwargs)
self.addCleanup(self._delete_keypair, keypair_name)
return body
diff --git a/tempest/api/compute/keypairs/test_keypairs_negative.py b/tempest/api/compute/keypairs/test_keypairs_negative.py
index 54b07f0..3e6d400 100644
--- a/tempest/api/compute/keypairs/test_keypairs_negative.py
+++ b/tempest/api/compute/keypairs/test_keypairs_negative.py
@@ -29,7 +29,10 @@
cls.client = cls.keypairs_client
def _create_keypair(self, keypair_name, pub_key=None):
- self.client.create_keypair(keypair_name, pub_key)
+ kwargs = {'name': keypair_name}
+ if pub_key:
+ kwargs.update({'public_key': pub_key})
+ self.client.create_keypair(**kwargs)
self.addCleanup(self.client.delete_keypair, keypair_name)
@test.attr(type=['negative'])
@@ -72,7 +75,7 @@
def test_create_keypair_with_duplicate_name(self):
# Keypairs with duplicate names should not be created
k_name = data_utils.rand_name('keypair')
- self.client.create_keypair(k_name)
+ self.client.create_keypair(name=k_name)
# Now try the same keyname to create another key
self.assertRaises(lib_exc.Conflict, self._create_keypair,
k_name)
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index 2c1e69c..c243adf 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -63,7 +63,7 @@
# Specify a keypair while creating a server
key_name = data_utils.rand_name('key')
- self.keypairs_client.create_keypair(key_name)
+ self.keypairs_client.create_keypair(name=key_name)
self.addCleanup(self.keypairs_client.delete_keypair, key_name)
self.keypairs_client.list_keypairs()
server = self.create_test_server(key_name=key_name)
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index 8ee8ad4..7e2868e 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -78,7 +78,7 @@
cls.image = cls.images_client.show_image(image_id)
cls.keypairname = data_utils.rand_name('keypair')
- cls.keypairs_client.create_keypair(cls.keypairname)
+ cls.keypairs_client.create_keypair(name=cls.keypairname)
name = data_utils.rand_name('security')
description = data_utils.rand_name('description')
@@ -209,7 +209,8 @@
resp = {}
resp['status'] = None
self.assertRaises(lib_exc.BadRequest,
- self.alt_keypairs_client.create_keypair, k_name)
+ self.alt_keypairs_client.create_keypair,
+ name=k_name)
finally:
# Next request the base_url is back to normal
if (resp['status'] is not None):
diff --git a/tempest/api/orchestration/base.py b/tempest/api/orchestration/base.py
index 266f726..6578680 100644
--- a/tempest/api/orchestration/base.py
+++ b/tempest/api/orchestration/base.py
@@ -96,7 +96,7 @@
@classmethod
def _create_keypair(cls, name_start='keypair-heat-'):
kp_name = data_utils.rand_name(name_start)
- body = cls.keypairs_client.create_keypair(kp_name)
+ body = cls.keypairs_client.create_keypair(name=kp_name)
cls.keypairs.append(kp_name)
return body
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index 18f0b1d..852ee54 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -46,7 +46,7 @@
if validation_resources['keypair']:
keypair_name = data_utils.rand_name('keypair')
validation_data['keypair'] = \
- os.keypairs_client.create_keypair(keypair_name)
+ os.keypairs_client.create_keypair(name=keypair_name)
LOG.debug("Validation resource key %s created" % keypair_name)
add_rule = False
if validation_resources['security_group']:
diff --git a/tempest/config.py b/tempest/config.py
index bdfdcdc..ab503e3 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -331,6 +331,10 @@
default=True,
help="Does the test environment support live migration "
"available?"),
+ cfg.BoolOpt('metadata_service',
+ default=True,
+ help="Does the test environment support metadata service? "
+ "Ignored unless validation.run_validation=true."),
cfg.BoolOpt('block_migration_for_live_migration',
default=False,
help="Does the test environment use block devices for live "
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index e77d07c..67052b0 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -140,7 +140,7 @@
client = self.keypairs_client
name = data_utils.rand_name(self.__class__.__name__)
# We don't need to create a keypair by pubkey in scenario
- body = client.create_keypair(name)
+ body = client.create_keypair(name=name)
self.addCleanup(client.delete_keypair, name)
return body
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index d9918f3..f61b151 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -37,6 +37,7 @@
* Add simple permissive rules to the security group
* Launch an instance
* Perform ssh to instance
+ * Verify metadata service
* Terminate the instance
"""
@@ -81,19 +82,26 @@
def verify_ssh(self):
if self.run_ssh:
# Obtain a floating IP
- floating_ip = self.floating_ips_client.create_floating_ip()
+ self.floating_ip = self.floating_ips_client.create_floating_ip()
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
- floating_ip['id'])
+ self.floating_ip['id'])
# Attach a floating IP
self.floating_ips_client.associate_floating_ip_to_server(
- floating_ip['ip'], self.instance['id'])
+ self.floating_ip['ip'], self.instance['id'])
# Check ssh
- self.get_remote_client(
- server_or_ip=floating_ip['ip'],
+ self.ssh_client = self.get_remote_client(
+ server_or_ip=self.floating_ip['ip'],
username=self.image_utils.ssh_user(self.image_ref),
private_key=self.keypair['private_key'])
+ def verify_metadata(self):
+ if self.run_ssh and CONF.compute_feature_enabled.metadata_service:
+ # Verify metadata service
+ result = self.ssh_client.exec_command(
+ "curl http://169.254.169.254/latest/meta-data/public-ipv4")
+ self.assertEqual(self.floating_ip['ip'], result)
+
@test.idempotent_id('7fff3fb3-91d8-4fd0-bd7d-0204f1f180ba')
@test.attr(type='smoke')
@test.services('compute', 'network')
@@ -102,4 +110,5 @@
self.security_group = self._create_security_group()
self.boot_instance()
self.verify_ssh()
+ self.verify_metadata()
self.servers_client.delete_server(self.instance['id'])
diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py
index 6f819ae..e51671f 100644
--- a/tempest/services/compute/json/keypairs_client.py
+++ b/tempest/services/compute/json/keypairs_client.py
@@ -38,11 +38,8 @@
self.validate_response(schema.get_keypair, resp, body)
return service_client.ResponseBody(resp, body['keypair'])
- def create_keypair(self, name, pub_key=None):
- post_body = {'keypair': {'name': name}}
- if pub_key:
- post_body['keypair']['public_key'] = pub_key
- post_body = json.dumps(post_body)
+ def create_keypair(self, **kwargs):
+ post_body = json.dumps({'keypair': kwargs})
resp, body = self.post("os-keypairs", body=post_body)
body = json.loads(body)
self.validate_response(schema.create_keypair, resp, body)
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index fcc715a..658b89a 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -22,8 +22,7 @@
class SecurityGroupDefaultRulesClient(service_client.ServiceClient):
- def create_security_default_group_rule(self, ip_protocol, from_port,
- to_port, **kwargs):
+ def create_security_default_group_rule(self, **kwargs):
"""
Creating security group default rules.
ip_protocol : ip_protocol (icmp, tcp, udp).
@@ -31,13 +30,7 @@
to_port : Port at end of range.
cidr : CIDR for address range.
"""
- post_body = {
- 'ip_protocol': ip_protocol,
- 'from_port': from_port,
- 'to_port': to_port,
- 'cidr': kwargs.get('cidr'),
- }
- post_body = json.dumps({'security_group_default_rule': post_body})
+ post_body = json.dumps({'security_group_default_rule': kwargs})
url = 'os-security-group-default-rules'
resp, body = self.post(url, post_body)
body = json.loads(body)
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 3ba2a91..c48ad4b 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -26,7 +26,7 @@
def _create_keypair(self):
keyname = data_utils.rand_name("key")
- self.key = self.manager.keypairs_client.create_keypair(keyname)
+ self.key = self.manager.keypairs_client.create_keypair(name=keyname)
def _delete_keypair(self):
self.manager.keypairs_client.delete_keypair(self.key['name'])