Skip to content

Commit

Permalink
refs #15217 - puppet 4 support (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
stbenjam authored Jun 24, 2016
1 parent 3b27fd9 commit bfa326c
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 243 deletions.
21 changes: 20 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,30 @@
# This file is managed centrally by modulesync
# https://github.com/katello/foreman-installer-modulesync
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.5
env:
- PUPPET_VERSION=3.5
- PUPPET_VERSION=3.5 FUTURE_PARSER=yes
- PUPPET_VERSION=4.0
matrix:
fast_finish: true
exclude:
# No support for Ruby 1.9.3 on Puppet 4.x
- rvm: 1.9.3
env: PUPPET_VERSION=4.0
include:
# Only platforms left to support ruby 1.8.7
- rvm: 1.8.7
env: PUPPET_VERSION=3.5
- rvm: 1.8.7
env: PUPPET_VERSION=3.5 FUTURE_PARSER=yes
# Only Puppet 4.x supports Ruby 2.2. Also limit the OS set we test Ruby 2.2 with.
- rvm: 2.2.3
env: PUPPET_VERSION=4.0
# Only Puppet >= 4.4 supports Ruby 2.3. Also limit the OS set we test Ruby 2.3 with.
- rvm: 2.3.0
env: PUPPET_VERSION=4.4
bundler_args: --without development
sudo: false
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 3.2.0 < 4.0.0"
"version_requirement": ">= 3.2.0 < 5.0.0"
}
],
"operatingsystem_support": [
Expand Down
163 changes: 79 additions & 84 deletions spec/classes/katello_config_spec.rb
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
60 changes: 29 additions & 31 deletions spec/classes/katello_install_spec.rb
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
Loading

0 comments on commit bfa326c

Please sign in to comment.