require 'spec_helper' describe 'glare' do shared_examples 'glare' do context 'with default parameters' do let :pre_condition do "class { '::glare::keystone::authtoken': password => 'ChangeMe' }" end it 'contains the params class' do is_expected.to contain_class('glare::params') end it 'contains the db class' do is_expected.to contain_class('glare::db') end it 'contains the logging class' do is_expected.to contain_class('glare::logging') end it 'installs package' do is_expected.to contain_package('glare').with( :ensure => 'present', :name => platform_params[:glare_package_name] ) end it { is_expected.to contain_glare_config('DEFAULT/bind_host').with_value('') } it { is_expected.to contain_glare_config('DEFAULT/bind_port').with_value('') } it { is_expected.to contain_glare_config('DEFAULT/backlog').with_value('') } it 'configures storage' do is_expected.to contain_glare_config('glance_store/os_region_name').with_value('RegionOne') is_expected.to contain_glare_config('glance_store/stores').with_value('') is_expected.to contain_glare_config('glance_store/default_store').with_value('') is_expected.to contain_glare_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glare/images') end it 'is_expected.to configure itself for keystone if it needed' do if :auth_strategy == 'keystone' is_expected.to contain_class('glare::authtoken') end end it 'configures ssl' do is_expected.to contain_glare_config('DEFAULT/cert_file').with_value('') is_expected.to contain_glare_config('DEFAULT/key_file').with_value('') is_expected.to contain_glare_config('DEFAULT/ca_file').with_value('') end it { is_expected.to contain_service('glare').with( 'ensure' => 'running', 'name' => platform_params[:glare_service_name], 'enable' => true, ) } end end on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| context "on #{os}" do let (:facts) do facts.merge!(OSDefaults.get_facts()) end case facts[:osfamily] when 'Debian' let (:platform_params) do { :glare_package_name => 'glare', :glare_service_name => 'glare-api' } end when 'RedHat' let (:platform_params) do { :glare_package_name => 'openstack-glare', :glare_service_name => 'openstack-glare-api' } end end it_behaves_like 'glare' end end end