test_server_basic_ops: Test metadata service
Add a minimum test for metadata service. Toggled via CONF.compute_feature_enabled.metadata_service. Change-Id: I14b20c797fbcbe0f83f550d44ca8e4892bf9b606
This commit is contained in:
parent
608cbe3573
commit
1f62af2449
|
@ -377,6 +377,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
|
||||
|
|
|
@ -334,6 +334,10 @@ ComputeFeaturesGroup = [
|
|||
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 "
|
||||
|
|
|
@ -37,6 +37,7 @@ class TestServerBasicOps(manager.ScenarioTest):
|
|||
* 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 @@ class TestServerBasicOps(manager.ScenarioTest):
|
|||
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 @@ class TestServerBasicOps(manager.ScenarioTest):
|
|||
self.security_group = self._create_security_group()
|
||||
self.boot_instance()
|
||||
self.verify_ssh()
|
||||
self.verify_metadata()
|
||||
self.servers_client.delete_server(self.instance['id'])
|
||||
|
|
Loading…
Reference in New Issue