Temp commit for debug on lab.
Add test for image action. Change fule to fuel_health for smokes
This commit is contained in:
parent
6d51c9e8cb
commit
c92dcc31fe
|
@ -88,7 +88,7 @@ build_interval = 3
|
|||
|
||||
# Number of seconds to time out on waiting for an instance
|
||||
# to build or reach an expected status
|
||||
build_timeout = 400
|
||||
build_timeout = 100
|
||||
|
||||
# Run additional tests that use SSH for instance validation?
|
||||
# This requires the instances be routable from the host
|
||||
|
@ -273,7 +273,7 @@ build_interval = 3
|
|||
|
||||
# Number of seconds to time out on waiting for an instance
|
||||
# to build or reach an expected status
|
||||
build_timeout = 400
|
||||
build_timeout = 20
|
||||
|
||||
# Run additional tests that use SSH for instance validation?
|
||||
# This requires the instances be routable from the host
|
||||
|
@ -284,10 +284,10 @@ run_ssh = false
|
|||
ssh_user = cirros
|
||||
|
||||
# Visible fixed network name
|
||||
fixed_network_name = private
|
||||
fixed_network_name = net04
|
||||
|
||||
# Network id used for SSH (public, private, etc)
|
||||
network_for_ssh = private
|
||||
network_for_ssh = net04
|
||||
|
||||
# IP version of the address used for SSH
|
||||
ip_version_for_ssh = 4
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import logging
|
||||
|
||||
from fuel_health.common.utils.data_utils import rand_name
|
||||
from fuel_health.common.ssh import Client
|
||||
from fuel_health import nmanager
|
||||
|
||||
|
||||
|
@ -28,7 +27,7 @@ class TestImageAction(nmanager.OfficialClientTest):
|
|||
flavor=flavor_id,
|
||||
key_name=self.keypair.name)
|
||||
self.addCleanup(self.compute_client.servers.delete, server)
|
||||
self.assertEqual(name, server.name)
|
||||
self.verify_response_body_content(name, server.name)
|
||||
self._wait_for_server_status(server, 'ACTIVE')
|
||||
server = client.servers.get(server) # getting network information
|
||||
LOG.debug("server:%s" % server)
|
||||
|
@ -38,34 +37,7 @@ class TestImageAction(nmanager.OfficialClientTest):
|
|||
name = rand_name('ost1_test-keypair-')
|
||||
self.keypair = self.compute_client.keypairs.create(name=name)
|
||||
self.addCleanup(self.compute_client.keypairs.delete, self.keypair)
|
||||
self.assertEqual(name, self.keypair.name)
|
||||
|
||||
def _create_security_group_rule(self):
|
||||
sgs = self.compute_client.security_groups.list()
|
||||
for sg in sgs:
|
||||
if sg.name == 'default':
|
||||
secgroup = sg
|
||||
|
||||
ruleset = {
|
||||
# ssh
|
||||
'ip_protocol': 'tcp',
|
||||
'from_port': 22,
|
||||
'to_port': 22,
|
||||
'cidr': '0.0.0.0/0',
|
||||
'group_id': None
|
||||
}
|
||||
sg_rule = self.compute_client.security_group_rules.create(secgroup.id,
|
||||
**ruleset)
|
||||
self.addCleanup(self.compute_client.security_group_rules.delete,
|
||||
sg_rule.id)
|
||||
|
||||
def _write_timestamp(self, server):
|
||||
username = self.config.compute.image_ssh_user
|
||||
self.assertEqual("", server.networks)
|
||||
host = server.networks[self.config.compute.network_for_ssh][0]
|
||||
ssh_client = Client(host, username, pkey=self.keypair.private_key)
|
||||
ssh_client.exec_command('date > /tmp/timestamp; sync')
|
||||
self.timestamp = ssh_client.exec_command('cat /tmp/timestamp')
|
||||
self.verify_response_body_content(name, self.keypair.name)
|
||||
|
||||
def _create_image(self, server):
|
||||
snapshot_name = rand_name('ost1_test-snapshot-')
|
||||
|
@ -75,30 +47,19 @@ class TestImageAction(nmanager.OfficialClientTest):
|
|||
self._wait_for_server_status(server, 'ACTIVE')
|
||||
self._wait_for_image_status(image_id, 'active')
|
||||
snapshot_image = self.image_client.images.get(image_id)
|
||||
self.assertEquals(snapshot_name, snapshot_image.name)
|
||||
self.verify_response_body_content(snapshot_name, snapshot_image.name)
|
||||
return image_id
|
||||
|
||||
def _check_timestamp(self, server):
|
||||
username = self.config.compute.image_ssh_user
|
||||
host = server.networks[self.config.compute.network_for_ssh][0]
|
||||
ssh_client = Client(host, username, pkey=self.keypair.private_key)
|
||||
got_timestamp = ssh_client.exec_command('cat /tmp/timestamp')
|
||||
self.assertEqual(self.timestamp, got_timestamp)
|
||||
|
||||
def test_snapshot_pattern(self):
|
||||
def test_snapshot(self):
|
||||
# prepare for booting a instance
|
||||
self._add_keypair()
|
||||
self._create_security_group_rule()
|
||||
#self._create_security_group_rule()
|
||||
|
||||
# boot a instance and create a timestamp file in it
|
||||
server = self._boot_image(self.config.compute.image_ref)
|
||||
self._write_timestamp(server)
|
||||
|
||||
# snapshot the instance
|
||||
snapshot_image_id = self._create_image(server)
|
||||
|
||||
# boot a second instance from the snapshot
|
||||
server_from_snapshot = self._boot_image(snapshot_image_id)
|
||||
|
||||
# check the existence of the timestamp file in the second instance
|
||||
self._check_timestamp(server_from_snapshot)
|
||||
self._boot_image(snapshot_image_id)
|
||||
|
|
|
@ -64,7 +64,7 @@ class TestUserTenantRole(base.BaseIdentityAdminTest):
|
|||
next='/')
|
||||
resp = client.post(url, data=login_data, headers=dict(Referer=url))
|
||||
self.verify_response_status(
|
||||
int(resp['status']), msg="Verify request was successful.")
|
||||
resp.status_code, msg="Verify request was successful.")
|
||||
else:
|
||||
csrftoken = client.cookies['csrftoken']
|
||||
login_data = dict(username=user['name'],
|
||||
|
@ -73,4 +73,4 @@ class TestUserTenantRole(base.BaseIdentityAdminTest):
|
|||
next='/')
|
||||
resp = client.post(url, data=login_data, headers=dict(Referer=url))
|
||||
self.verify_response_status(
|
||||
int(resp['status']), msg="Verify request was successful.")
|
||||
resp.status_code, msg="Verify request was successful.")
|
||||
|
|
Loading…
Reference in New Issue