Fix unit tests

The unit tests were broken by a change to openstacklib
Id09c3358c5843510e6a2a8c0e2d4aeb3607e098b which renamed some of the
resources in the openstacklib classes. The problem is that our tests in
this module should not have been testing what occurs within openstacklib
so this fix updates the tests to only check what we are doing within
this module.

Change-Id: I0daf11f459ceffecd53a1291a700bb7fcfa21483
Depends-On: I9d535ab38afea852559df2b3073bd4b74a2a3947
This commit is contained in:
Alex Schultz 2017-07-13 15:12:57 -06:00
parent 131a8be8be
commit 6d1d70ac8b
1 changed files with 41 additions and 70 deletions

View File

@ -3,56 +3,29 @@ require 'spec_helper'
describe 'aodh::wsgi::apache' do
shared_examples_for 'apache serving aodh with mod_wsgi' do
it { is_expected.to contain_service('httpd').with_name(platform_parameters[:httpd_service_name]) }
it { is_expected.to contain_class('aodh::deps') }
it { is_expected.to contain_class('aodh::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
describe 'with default parameters' do
it { is_expected.to contain_file("#{platform_parameters[:wsgi_script_path]}").with(
'ensure' => 'directory',
'owner' => 'aodh',
'group' => 'aodh',
'require' => 'Package[httpd]'
context 'with default parameters' do
it { is_expected.to contain_class('aodh::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to contain_class('apache::mod::ssl') }
it { is_expected.to contain_openstacklib__wsgi__apache('aodh_wsgi').with(
:bind_port => 8042,
:group => 'aodh',
:path => '/',
:servername => facts[:fqdn],
:ssl => true,
:threads => facts[:os_workers],
:user => 'aodh',
:workers => 1,
:wsgi_daemon_process => 'aodh',
:wsgi_process_group => 'aodh',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source],
)}
it { is_expected.to contain_file('aodh_wsgi').with(
'ensure' => 'file',
'path' => "#{platform_parameters[:wsgi_script_path]}/app",
'source' => platform_parameters[:wsgi_script_source],
'owner' => 'aodh',
'group' => 'aodh',
'mode' => '0644'
)}
it { is_expected.to contain_file('aodh_wsgi').that_requires("File[#{platform_parameters[:wsgi_script_path]}]") }
it { is_expected.to contain_apache__vhost('aodh_wsgi').with(
'servername' => 'some.host.tld',
'ip' => nil,
'port' => '8042',
'docroot' => "#{platform_parameters[:wsgi_script_path]}",
'docroot_owner' => 'aodh',
'docroot_group' => 'aodh',
'ssl' => 'true',
'wsgi_daemon_process' => 'aodh',
'wsgi_daemon_process_options' => {
'user' => 'aodh',
'group' => 'aodh',
'processes' => 1,
'threads' => '8',
'display-name' => 'aodh_wsgi',
},
'wsgi_process_group' => 'aodh',
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'require' => 'File[aodh_wsgi]'
)}
it { is_expected.to contain_concat("#{platform_parameters[:httpd_ports_file]}") }
end
describe 'when overriding parameters using different ports' do
context 'when overriding parameters using different ports' do
let :params do
{
:servername => 'dummy.host',
@ -63,29 +36,27 @@ describe 'aodh::wsgi::apache' do
:workers => 37,
}
end
it { is_expected.to contain_apache__vhost('aodh_wsgi').with(
'servername' => 'dummy.host',
'ip' => '10.42.51.1',
'port' => '12345',
'docroot' => "#{platform_parameters[:wsgi_script_path]}",
'docroot_owner' => 'aodh',
'docroot_group' => 'aodh',
'ssl' => 'false',
'wsgi_daemon_process' => 'aodh',
'wsgi_daemon_process_options' => {
'user' => 'aodh',
'group' => 'aodh',
'processes' => '37',
'threads' => '8',
'display-name' => 'aodh',
},
'wsgi_process_group' => 'aodh',
'wsgi_script_aliases' => { '/' => "#{platform_parameters[:wsgi_script_path]}/app" },
'require' => 'File[aodh_wsgi]'
it { is_expected.to contain_class('aodh::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to_not contain_class('apache::mod::ssl') }
it { is_expected.to contain_openstacklib__wsgi__apache('aodh_wsgi').with(
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'aodh',
:path => '/',
:servername => 'dummy.host',
:ssl => false,
:threads => facts[:os_workers],
:user => 'aodh',
:workers => 37,
:wsgi_daemon_process => 'aodh',
:wsgi_process_display_name => 'aodh',
:wsgi_process_group => 'aodh',
:wsgi_script_dir => platform_params[:wsgi_script_path],
:wsgi_script_file => 'app',
:wsgi_script_source => platform_params[:wsgi_script_source],
)}
it { is_expected.to contain_concat("#{platform_parameters[:httpd_ports_file]}") }
end
end
@ -101,7 +72,7 @@ describe 'aodh::wsgi::apache' do
}))
end
let(:platform_parameters) do
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{