-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #15217 - puppet 4 support (#132)
- Loading branch information
Showing
8 changed files
with
173 additions
and
243 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 |
---|---|---|
@@ -1,96 +1,91 @@ | ||
require 'spec_helper' | ||
|
||
describe 'katello::config' do | ||
let :facts do | ||
{ | ||
:concat_basedir => '/tmp', | ||
:interfaces => '', | ||
:osfamily => 'RedHat', | ||
:operatingsystem => 'CentOS', | ||
:operatingsystemrelease => '6.5', | ||
:fqdn => 'host.example.org', | ||
} | ||
end | ||
|
||
context 'default config settings' do | ||
let(:pre_condition) do | ||
[ | ||
'include foreman', | ||
'include certs', | ||
'class {"katello":' \ | ||
'post_sync_token => test_token,' \ | ||
'oauth_secret => secret' \ | ||
'}' | ||
] | ||
on_supported_os.each do |os, facts| | ||
let :facts do | ||
facts.merge(:concat_basedir => '/tmp', :mongodb_version => '2.4.14') | ||
end | ||
|
||
it 'should NOT set the cdn-ssl-version' do | ||
should_not contain_file('/etc/foreman/plugins/katello.yaml'). | ||
with_content(/cdn_ssl_version/) | ||
end | ||
context 'default config settings' do | ||
let(:pre_condition) do | ||
[ | ||
'include foreman', | ||
'include certs', | ||
'class {"katello":' \ | ||
'post_sync_token => test_token,' \ | ||
'oauth_secret => secret' \ | ||
'}' | ||
] | ||
end | ||
|
||
it 'should generate correct katello.yaml' do | ||
should contain_file('/etc/foreman/plugins/katello.yaml') | ||
content = catalogue.resource('file', '/etc/foreman/plugins/katello.yaml').send(:parameters)[:content] | ||
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [ | ||
':katello:', | ||
' :rest_client_timeout: 3600', | ||
' :post_sync_url: https://host.example.org/katello/api/v2/repositories/sync_complete?token=test_token', | ||
' :candlepin:', | ||
' :url: https://host.example.org:8443/candlepin', | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :pulp:', | ||
" :url: https://#{facts[:fqdn]}/pulp/api/v2/", | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :qpid:', | ||
" :url: amqp:ssl:#{facts[:fqdn]}:5671", | ||
' :subscriptions_queue_address: katello_event_queue' | ||
] | ||
end | ||
end | ||
it 'should NOT set the cdn-ssl-version' do | ||
should_not contain_file('/etc/foreman/plugins/katello.yaml'). | ||
with_content(/cdn_ssl_version/) | ||
end | ||
|
||
context 'when http proxy parameters are specified' do | ||
let(:pre_condition) do | ||
[ | ||
'include foreman', | ||
'include certs', | ||
'class {"katello":' \ | ||
'post_sync_token => "test_token",' \ | ||
'oauth_secret => "secret",' \ | ||
'proxy_url => "http://myproxy.org",' \ | ||
'proxy_port => 8888,' \ | ||
'proxy_username => "admin",' \ | ||
'proxy_password => "secret_password"' \ | ||
'}' | ||
] | ||
it 'should generate correct katello.yaml' do | ||
should contain_file('/etc/foreman/plugins/katello.yaml') | ||
content = catalogue.resource('file', '/etc/foreman/plugins/katello.yaml').send(:parameters)[:content] | ||
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [ | ||
':katello:', | ||
' :rest_client_timeout: 3600', | ||
' :post_sync_url: https://foo.example.com/katello/api/v2/repositories/sync_complete?token=test_token', | ||
' :candlepin:', | ||
' :url: https://foo.example.com:8443/candlepin', | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :pulp:', | ||
" :url: https://#{facts[:fqdn]}/pulp/api/v2/", | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :qpid:', | ||
" :url: amqp:ssl:#{facts[:fqdn]}:5671", | ||
' :subscriptions_queue_address: katello_event_queue' | ||
] | ||
end | ||
end | ||
|
||
it 'should generate correct katello.yaml' do | ||
should contain_file('/etc/foreman/plugins/katello.yaml') | ||
content = catalogue.resource('file', '/etc/foreman/plugins/katello.yaml').send(:parameters)[:content] | ||
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [ | ||
':katello:', | ||
' :rest_client_timeout: 3600', | ||
' :post_sync_url: https://host.example.org/katello/api/v2/repositories/sync_complete?token=test_token', | ||
' :candlepin:', | ||
' :url: https://host.example.org:8443/candlepin', | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :pulp:', | ||
" :url: https://#{facts[:fqdn]}/pulp/api/v2/", | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :qpid:', | ||
" :url: amqp:ssl:#{facts[:fqdn]}:5671", | ||
' :subscriptions_queue_address: katello_event_queue', | ||
' :cdn_proxy:', | ||
' :host: http://myproxy.org', | ||
' :port: 8888', | ||
' :user: admin', | ||
' :password: secret_password' | ||
] | ||
context 'when http proxy parameters are specified' do | ||
let(:pre_condition) do | ||
[ | ||
'include foreman', | ||
'include certs', | ||
'class {"katello":' \ | ||
'post_sync_token => "test_token",' \ | ||
'oauth_secret => "secret",' \ | ||
'proxy_url => "http://myproxy.org",' \ | ||
'proxy_port => 8888,' \ | ||
'proxy_username => "admin",' \ | ||
'proxy_password => "secret_password"' \ | ||
'}' | ||
] | ||
end | ||
|
||
it 'should generate correct katello.yaml' do | ||
should contain_file('/etc/foreman/plugins/katello.yaml') | ||
content = catalogue.resource('file', '/etc/foreman/plugins/katello.yaml').send(:parameters)[:content] | ||
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [ | ||
':katello:', | ||
' :rest_client_timeout: 3600', | ||
' :post_sync_url: https://foo.example.com/katello/api/v2/repositories/sync_complete?token=test_token', | ||
' :candlepin:', | ||
' :url: https://foo.example.com:8443/candlepin', | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :pulp:', | ||
" :url: https://#{facts[:fqdn]}/pulp/api/v2/", | ||
' :oauth_key: katello', | ||
' :oauth_secret: secret', | ||
' :qpid:', | ||
" :url: amqp:ssl:#{facts[:fqdn]}:5671", | ||
' :subscriptions_queue_address: katello_event_queue', | ||
' :cdn_proxy:', | ||
' :host: http://myproxy.org', | ||
' :port: 8888', | ||
' :user: admin', | ||
' :password: secret_password' | ||
] | ||
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 |
---|---|---|
@@ -1,39 +1,37 @@ | ||
require 'spec_helper' | ||
|
||
describe 'katello::install' do | ||
let :facts do | ||
{ | ||
:concat_basedir => '/tmp', | ||
:interfaces => '', | ||
:osfamily => 'RedHat', | ||
:operatingsystem => 'CentOS', | ||
:operatingsystemrelease => '6.5', | ||
:fqdn => 'host.example.org', | ||
} | ||
end | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let :facts do | ||
facts.merge(:concat_basedir => '/tmp', :mongodb_version => '2.4.14') | ||
end | ||
|
||
describe 'with enable_ostree == false' do | ||
let(:pre_condition) do | ||
['include foreman', | ||
'include certs', | ||
"class {'katello': | ||
enable_ostree => false, | ||
}" | ||
] | ||
end | ||
it { should_not contain_package("tfm-rubygem-katello_ostree")} | ||
end | ||
describe 'with enable_ostree == false' do | ||
let(:pre_condition) do | ||
['include foreman', | ||
'include certs', | ||
"class {'katello': | ||
enable_ostree => false, | ||
}" | ||
] | ||
end | ||
|
||
it { should_not contain_package("tfm-rubygem-katello_ostree")} | ||
end | ||
|
||
describe 'with enable_ostree == true' do | ||
let(:pre_condition) do | ||
['include foreman', | ||
'include certs', | ||
"class {'katello': | ||
enable_ostree => true, | ||
}" | ||
] | ||
describe 'with enable_ostree == true' do | ||
let(:pre_condition) do | ||
['include foreman', | ||
'include certs', | ||
"class {'katello': | ||
enable_ostree => true, | ||
}" | ||
] | ||
end | ||
it { should contain_package("tfm-rubygem-katello_ostree").with_ensure('installed'). | ||
with_notify(["Service[foreman-tasks]", "Service[httpd]"]) } | ||
end | ||
end | ||
it { should contain_package("tfm-rubygem-katello_ostree").with_ensure('installed'). | ||
with_notify(["Service[foreman-tasks]", "Service[httpd]"]) } | ||
end | ||
end |
Oops, something went wrong.