2015-04-16 20:22:58 -04:00
|
|
|
require 'spec_helper_acceptance'
|
|
|
|
|
|
|
|
describe 'glance class' do
|
|
|
|
|
|
|
|
context 'default parameters' do
|
2015-10-30 16:52:35 -08:00
|
|
|
pp= <<-EOS
|
2015-11-18 17:55:02 +01:00
|
|
|
include ::openstack_integration
|
|
|
|
include ::openstack_integration::repos
|
|
|
|
include ::openstack_integration::mysql
|
|
|
|
include ::openstack_integration::keystone
|
2015-04-16 20:22:58 -04:00
|
|
|
|
|
|
|
# Glance resources
|
|
|
|
include ::glance
|
|
|
|
include ::glance::client
|
2015-10-02 12:59:38 -04:00
|
|
|
include ::glance::backend::file
|
2015-04-16 20:22:58 -04:00
|
|
|
class { '::glance::db::mysql':
|
|
|
|
# https://bugs.launchpad.net/puppet-glance/+bug/1446375
|
|
|
|
collate => 'utf8_general_ci',
|
|
|
|
password => 'a_big_secret',
|
|
|
|
}
|
|
|
|
class { '::glance::keystone::auth':
|
|
|
|
password => 'a_big_secret',
|
|
|
|
}
|
|
|
|
class { '::glance::api':
|
2015-11-18 16:40:03 +03:00
|
|
|
database_connection => 'mysql+pymysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8',
|
2015-04-16 20:22:58 -04:00
|
|
|
verbose => false,
|
2015-06-08 13:32:27 -07:00
|
|
|
keystone_password => 'a_big_secret',
|
2015-04-16 20:22:58 -04:00
|
|
|
}
|
|
|
|
class { '::glance::registry':
|
2015-11-18 16:40:03 +03:00
|
|
|
database_connection => 'mysql+pymysql://glance:a_big_secret@127.0.0.1/glance?charset=utf8',
|
2015-04-16 20:22:58 -04:00
|
|
|
verbose => false,
|
|
|
|
keystone_password => 'a_big_secret',
|
|
|
|
}
|
2015-05-13 17:32:19 -07:00
|
|
|
|
|
|
|
glance_image { 'test_image':
|
|
|
|
ensure => present,
|
|
|
|
container_format => 'bare',
|
|
|
|
disk_format => 'qcow2',
|
|
|
|
is_public => 'yes',
|
|
|
|
source => 'http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img',
|
|
|
|
}
|
2015-10-30 16:52:35 -08:00
|
|
|
EOS
|
|
|
|
|
|
|
|
it 'should configure the glance endpoint before the glance-api service uses it' do
|
2015-12-24 14:22:25 +01:00
|
|
|
pp2 = pp + "Service['glance-api'] -> Keystone_endpoint['RegionOne/Image Service::image']"
|
2015-10-30 16:52:35 -08:00
|
|
|
expect(apply_manifest(pp2, :expect_failures => true, :noop => true).stderr).to match(/Found 1 dependency cycle/i)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should configure the glance user before the glance-api service uses it' do
|
|
|
|
pp2 = pp + "Service['glance-api'] -> Keystone_user_role['glance@services']"
|
|
|
|
expect(apply_manifest(pp2, :expect_failures => true, :noop => true).stderr).to match(/Found 1 dependency cycle/i)
|
|
|
|
end
|
2015-04-16 20:22:58 -04:00
|
|
|
|
2015-10-30 16:52:35 -08:00
|
|
|
it 'should configure the glance user before the glance-registry service uses it' do
|
|
|
|
pp2 = pp + "Service['glance-registry'] -> Keystone_user_role['glance@services']"
|
|
|
|
expect(apply_manifest(pp2, :expect_failures => true, :noop => true).stderr).to match(/Found 1 dependency cycle/i)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should configure the glance-api service before using it to provision glance_images' do
|
|
|
|
pp2 = pp + "Glance_image['test_image'] -> Service['glance-api']"
|
|
|
|
expect(apply_manifest(pp2, :expect_failures => true, :noop => true).stderr).to match(/Found 1 dependency cycle/i)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should work with no errors' do
|
2015-04-16 20:22:58 -04:00
|
|
|
# Run it twice and test for idempotency
|
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
apply_manifest(pp, :catch_changes => true)
|
|
|
|
end
|
|
|
|
|
2015-05-13 17:32:19 -07:00
|
|
|
describe 'glance images' do
|
|
|
|
it 'should create a glance image' do
|
|
|
|
shell('openstack --os-username glance --os-password a_big_secret --os-tenant-name services --os-auth-url http://127.0.0.1:5000/v2.0 image list') do |r|
|
|
|
|
expect(r.stdout).to match(/test_image/)
|
|
|
|
expect(r.stderr).to be_empty
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-04-16 20:22:58 -04:00
|
|
|
end
|
|
|
|
end
|