Merge "Modify scenario tests"

This commit is contained in:
Jenkins 2015-11-11 18:44:22 +00:00 committed by Gerrit Code Review
commit 81b82beef6
3 changed files with 8 additions and 29 deletions

View File

@ -107,13 +107,6 @@ class BaremetalBasicOps(manager.BaremetalScenarioTest):
return None
return int(ephemeral)
def add_floating_ip(self):
floating_ip = (self.floating_ips_client.create_floating_ip()
['floating_ip'])
self.floating_ips_client.associate_floating_ip_to_server(
floating_ip['ip'], self.instance['id'])
return floating_ip['ip']
def validate_ports(self):
for port in self.get_ports(self.node['uuid']):
n_port_id = port['extra']['vif_port_id']
@ -131,7 +124,7 @@ class BaremetalBasicOps(manager.BaremetalScenarioTest):
self.validate_ports()
self.verify_connectivity()
if CONF.compute.ssh_connect_method == 'floating':
floating_ip = self.add_floating_ip()
floating_ip = self.create_floating_ip(self.instance)['ip']
self.verify_connectivity(ip=floating_ip)
vm_client = self.get_remote_client(self.instance)

View File

@ -89,17 +89,10 @@ class TestServerBasicOps(manager.ScenarioTest):
def verify_ssh(self):
if self.run_ssh:
# Obtain a floating IP
self.floating_ip = (self.floating_ips_client.create_floating_ip()
['floating_ip'])
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
self.floating_ip['id'])
# Attach a floating IP
self.floating_ips_client.associate_floating_ip_to_server(
self.floating_ip['ip'], self.instance['id'])
self.fip = self.create_floating_ip(self.instance)['ip']
# Check ssh
self.ssh_client = self.get_remote_client(
server_or_ip=self.floating_ip['ip'],
server_or_ip=self.fip,
username=self.image_utils.ssh_user(self.image_ref),
private_key=self.keypair['private_key'])
@ -110,12 +103,11 @@ class TestServerBasicOps(manager.ScenarioTest):
def exec_cmd_and_verify_output():
cmd = 'curl ' + md_url
floating_ip = self.floating_ip['ip']
result = self.ssh_client.exec_command(cmd)
if result:
msg = ('Failed while verifying metadata on server. Result '
'of command "%s" is NOT "%s".' % (cmd, floating_ip))
self.assertEqual(floating_ip, result, msg)
'of command "%s" is NOT "%s".' % (cmd, self.fip))
self.assertEqual(self.fip, result, msg)
return 'Verification is successful!'
if not test.call_until_true(exec_cmd_and_verify_output,

View File

@ -79,15 +79,9 @@ class TestShelveInstance(manager.ScenarioTest):
create_kwargs=create_kwargs)
if CONF.compute.use_floatingip_for_ssh:
floating_ip = (self.floating_ips_client.create_floating_ip()
['floating_ip'])
self.addCleanup(self.delete_wrapper,
self.floating_ips_client.delete_floating_ip,
floating_ip['id'])
self.floating_ips_client.associate_floating_ip_to_server(
floating_ip['ip'], server['id'])
floating_ip = self.create_floating_ip(server)['ip']
timestamp = self.create_timestamp(
floating_ip['ip'], private_key=keypair['private_key'])
floating_ip, private_key=keypair['private_key'])
else:
timestamp = self.create_timestamp(
server, private_key=keypair['private_key'])
@ -97,7 +91,7 @@ class TestShelveInstance(manager.ScenarioTest):
# with the instance snapshot
self._shelve_then_unshelve_server(server)
if CONF.compute.use_floatingip_for_ssh:
timestamp2 = self.get_timestamp(floating_ip['ip'],
timestamp2 = self.get_timestamp(floating_ip,
private_key=keypair['private_key'])
else:
timestamp2 = self.get_timestamp(server,