Automatic upload of needed image files to glance for tempest tests
This change adds an automated upload of the needed (here just a standard cirros) images for the tempest integration tests. Change-Id: I95e8c01703822c4adc6d1fbf369fc6fa1115406b
This commit is contained in:
parent
2debea8459
commit
1d5758fbee
|
@ -38,12 +38,14 @@ default['openstack']['integration-test'] = {
|
|||
'image1' => {
|
||||
'name' => 'cirros',
|
||||
'id' => nil,
|
||||
'flavor' => 1
|
||||
'flavor' => 1,
|
||||
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
|
||||
},
|
||||
'image2' => {
|
||||
'name' => 'cirros',
|
||||
'id' => nil,
|
||||
'flavor' => 1
|
||||
'flavor' => 1,
|
||||
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,17 +82,26 @@ git '/opt/tempest' do
|
|||
end
|
||||
|
||||
%w{image1 image2}.each do |img|
|
||||
image_name = node['openstack']['integration-test'][img]['name']
|
||||
admin_user = node['openstack']['identity']['admin_user']
|
||||
admin_tenant = node['openstack']['identity']['admin_tenant_name']
|
||||
|
||||
openstack_image_image img do
|
||||
identity_user admin_user
|
||||
identity_pass admin_pass
|
||||
identity_tenant admin_tenant
|
||||
identity_uri auth_uri
|
||||
image_name image_name
|
||||
image_url node['openstack']['integration-test'][img]['source']
|
||||
end
|
||||
|
||||
# NOTE: This has to be done in a ruby_block so it gets executed at execution
|
||||
# time and not compile time (when glance does not yet exist).
|
||||
ruby_block "Get and set #{img}'s ID" do
|
||||
block do
|
||||
begin
|
||||
admin_user = node['openstack']['identity']['admin_user']
|
||||
admin_tenant = node['openstack']['identity']['admin_tenant_name']
|
||||
image_name = node['openstack']['integration-test'][img]['name']
|
||||
env = openstack_command_env admin_user, admin_tenant
|
||||
id = image_id image_name, env
|
||||
|
||||
node.set['openstack']['integration-test'][img]['id'] = id
|
||||
rescue RuntimeError => e
|
||||
Chef::Log.error("UUID not found for Glance image #{image_name}. Error was #{e.message}")
|
||||
|
|
|
@ -99,6 +99,28 @@ describe 'openstack-integration-test::setup' do
|
|||
)
|
||||
end
|
||||
|
||||
it 'uploads image1' do
|
||||
expect(chef_run).to upload_openstack_image_image('image1').with(
|
||||
identity_user: 'admin',
|
||||
identity_pass: 'admin',
|
||||
identity_tenant: 'admin',
|
||||
identity_uri: 'http://127.0.0.1:35357/v2.0',
|
||||
image_name: 'cirros',
|
||||
image_url: 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
|
||||
)
|
||||
end
|
||||
|
||||
it 'uploads image2' do
|
||||
expect(chef_run).to upload_openstack_image_image('image2').with(
|
||||
identity_user: 'admin',
|
||||
identity_pass: 'admin',
|
||||
identity_tenant: 'admin',
|
||||
identity_uri: 'http://127.0.0.1:35357/v2.0',
|
||||
image_name: 'cirros',
|
||||
image_url: 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
|
||||
)
|
||||
end
|
||||
|
||||
it 'runs ruby_block for image1' do
|
||||
expect(chef_run).to run_ruby_block("Get and set image1's ID")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue