forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parameters to configure negotiation module
- Loading branch information
Showing
7 changed files
with
182 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'apache::mod::negotiation class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do | ||
case fact('osfamily') | ||
when 'Debian' | ||
vhost_dir = '/etc/apache2/sites-enabled' | ||
mod_dir = '/etc/apache2/mods-available' | ||
service_name = 'apache2' | ||
when 'RedHat' | ||
vhost_dir = '/etc/httpd/conf.d' | ||
mod_dir = '/etc/httpd/conf.d' | ||
service_name = 'httpd' | ||
when 'FreeBSD' | ||
vhost_dir = '/usr/local/etc/apache22/Vhosts' | ||
mod_dir = '/usr/local/etc/apache22/Modules' | ||
service_name = 'apache22' | ||
end | ||
|
||
context "default negotiation config" do | ||
it 'succeeds in puppeting negotiation' do | ||
pp= <<-EOS | ||
class { '::apache': } | ||
class { '::apache::mod::negotiation': } | ||
EOS | ||
apply_manifest(pp, :catch_failures => true) | ||
end | ||
|
||
describe file("#{$mod_dir}/negotiation.conf") do | ||
it { should contain "LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | ||
ForceLanguagePriority Prefer Fallback" } | ||
end | ||
|
||
describe service(service_name) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end | ||
|
||
context "with alternative force_language_priority" do | ||
it 'succeeds in puppeting negotiation' do | ||
pp= <<-EOS | ||
class { '::apache': } | ||
class { '::apache::mod::negotiation': | ||
force_language_priority => 'Prefer', | ||
} | ||
EOS | ||
apply_manifest(pp, :catch_failures => true) | ||
end | ||
|
||
describe file("#{$mod_dir}/negotiation.conf") do | ||
it { should contain "ForceLanguagePriority Prefer" } | ||
end | ||
|
||
describe service(service_name) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end | ||
|
||
context "with alternative language_priority" do | ||
it 'succeeds in puppeting negotiation' do | ||
pp= <<-EOS | ||
class { '::apache': } | ||
class { '::apache::mod::negotiation': | ||
language_priority => [ 'en', 'es' ], | ||
} | ||
EOS | ||
apply_manifest(pp, :catch_failures => true) | ||
end | ||
|
||
describe file("#{$mod_dir}/negotiation.conf") do | ||
it { should contain "LanguagePriority en es" } | ||
end | ||
|
||
describe service(service_name) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require 'spec_helper' | ||
|
||
describe 'apache::mod::negotiation', :type => :class do | ||
describe "OS independent tests" do | ||
|
||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystemrelease => '6', | ||
:concat_basedir => '/dne', | ||
} | ||
end | ||
|
||
context "default params" do | ||
let :pre_condition do | ||
'class {"::apache": }' | ||
end | ||
it { should contain_class("apache") } | ||
it do | ||
should contain_file('negotiation.conf').with( { | ||
:ensure => 'file', | ||
:content => 'LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | ||
ForceLanguagePriority Prefer Fallback | ||
', | ||
} ) | ||
end | ||
end | ||
|
||
context 'with force_language_priority parameter' do | ||
let :pre_condition do | ||
'class {"::apache": default_mods => ["negotiation"]}' | ||
end | ||
let :params do | ||
{ :force_language_priority => 'Prefer' } | ||
end | ||
it do | ||
should contain_file('negotiation.conf').with( { | ||
:ensure => 'file', | ||
:content => /^ForceLanguagePriority Prefer$/, | ||
} ) | ||
end | ||
end | ||
|
||
context 'with language_priority parameter' do | ||
let :pre_condition do | ||
'class {"::apache": default_mods => ["negotiation"]}' | ||
end | ||
let :params do | ||
{ :language_priority => [ 'en', 'es' ] } | ||
end | ||
it do | ||
should contain_file('negotiation.conf').with( { | ||
:ensure => 'file', | ||
:content => /^LanguagePriority en es$/, | ||
} ) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This is a file only for spec testing | ||
|
||
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | ||
ForceLanguagePriority Prefer Fallback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# This is a template only for spec testing | ||
|
||
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | ||
ForceLanguagePriority Prefer Fallback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW | ||
ForceLanguagePriority Prefer Fallback | ||
LanguagePriority <%= @language_priority.join(' ') %> | ||
ForceLanguagePriority <%= @force_language_priority %> |