Revision 529a3669
Added by Ewoud Kohl van Wijngaarden about 4 years ago
spec/classes/pulp_config_spec.rb | ||
---|---|---|
require 'spec_helper'
|
||
|
||
|
||
describe 'pulp::config' do
|
||
let :default_facts do
|
||
let :facts do
|
||
on_supported_os['redhat-7-x86_64'].merge(:processorcount => 3)
|
||
end
|
||
|
||
... | ... | |
"class {'pulp':}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it "should configure pulp_workers" do
|
||
should contain_file('/etc/default/pulp_workers').with({
|
||
'ensure' => 'file',
|
||
'owner' => 'root',
|
||
'group' => 'root',
|
||
'mode' => '0644',
|
||
'content' => /^PULP_CONCURRENCY=3$/,
|
||
})
|
||
end
|
||
|
||
describe 'with processor count less than 8' do
|
||
|
||
it "should set the PULP_CONCURRENCY to the processor count" do
|
||
should contain_file('/etc/default/pulp_workers').with_content(/^PULP_CONCURRENCY=3$/)
|
||
end
|
||
|
||
end
|
||
|
||
describe 'with processor count more than 8' do
|
||
let :facts do
|
||
default_facts.merge({
|
||
:processorcount => 12
|
||
})
|
||
let(:facts) do
|
||
super().merge(:processorcount => 12)
|
||
end
|
||
|
||
it "should set the PULP_CONCURRENCY to 8" do
|
||
... | ... | |
}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it "should configure auth" do
|
||
should contain_file('/etc/pulp/server.conf').
|
||
with_content(/^username: rspec$/).
|
||
... | ... | |
}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it "should configure worker timeout param" do
|
||
should contain_file('/etc/pulp/server.conf').
|
||
with_content(/^worker_timeout: 80$/)
|
||
... | ... | |
}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it "should produce valid json" do
|
||
should contain_file("/etc/pulp/server/plugins.conf.d/yum_importer.json").with_content(
|
||
/"proxy_host": "http:\/\/fake.com",/
|
||
... | ... | |
}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it 'should configure server.conf' do
|
||
should contain_file('/etc/pulp/server.conf').
|
||
with_content(/^topic_exchange: 'amq.topic'$/).
|
||
... | ... | |
"class {'pulp':}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it 'defaults to false' do
|
||
should contain_file('/etc/pulp/repo_auth.conf').
|
||
with_content(/^enabled: false$/)
|
||
... | ... | |
}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it 'sets enabled to true' do
|
||
should contain_file('/etc/pulp/repo_auth.conf').
|
||
with_content(/^enabled: true$/)
|
||
... | ... | |
}"
|
||
end
|
||
|
||
let :facts do
|
||
default_facts
|
||
end
|
||
|
||
it 'sets enabled to false' do
|
||
should contain_file('/etc/pulp/repo_auth.conf').
|
||
with_content(/^enabled: false$/)
|
Also available in: Unified diff
Refactor specs to use inheritance