Skip to content
This repository has been archived by the owner on Jun 28, 2018. It is now read-only.

Commit

Permalink
refs #15217 - puppet 4 support (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
stbenjam authored Jun 24, 2016
1 parent fba7adb commit 3bf93d2
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 72 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
107 changes: 51 additions & 56 deletions spec/classes/crane_config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,71 +1,66 @@
require 'spec_helper'

describe 'crane' do
let :default_facts do
{
:fqdn => 'localhost.localdomain',
:concat_basedir => '/tmp',
:interfaces => '',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6.4',
:operatingsystemmajrelease => '6.4',
:osfamily => 'RedHat',
:processorcount => 3
}
end
on_supported_os.each do |os, facts|
context "os #{os}" do
let :default_facts do
facts.merge(:concat_basedir => '/tmp')
end

context 'with no parameters' do
let :pre_condition do
"class {'crane':}"
end
context 'with no parameters' do
let :pre_condition do
"class {'crane':}"
end

let :facts do
default_facts
end
let :facts do
default_facts
end

it "should set up the config file" do
should contain_file('/etc/crane.conf').
with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
}).
with_content(/^endpoint: localhost.localdomain:5000$/)
end
end
it "should set up the config file" do
should contain_file('/etc/crane.conf').
with({
'ensure' => 'file',
'owner' => 'root',
'group' => 'root',
'mode' => '0644',
}).
with_content(/^endpoint: foo.example.com:5000$/)
end
end

context 'with parameters' do
let :pre_condition do
"class {'crane':
port => 5001
}"
end
context 'with parameters' do
let :pre_condition do
"class {'crane':
port => 5001
}"
end

let :facts do
default_facts
end
let :facts do
default_facts
end

it "should set the port" do
should contain_file('/etc/crane.conf').
with_content(/^endpoint: localhost.localdomain:5001$/)
end
end
it "should set the port" do
should contain_file('/etc/crane.conf').
with_content(/^endpoint: foo.example.com:5001$/)
end
end

context 'with data dir ' do
let :pre_condition do
"class {'crane':
data_dir => 'foo'
}"
end
context 'with data dir ' do
let :pre_condition do
"class {'crane':
data_dir => 'foo'
}"
end

let :facts do
default_facts
end
let :facts do
default_facts
end

it "should set the data_dir" do
should contain_file('/etc/crane.conf').
with_content(/^data_dir: foo$/)
it "should set the data_dir" do
should contain_file('/etc/crane.conf').
with_content(/^data_dir: foo$/)
end
end
end
end
end
22 changes: 8 additions & 14 deletions spec/classes/crane_spec.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
require 'spec_helper'

describe 'crane' do

context 'on redhat' do
let :facts do
{
:concat_basedir => '/tmp',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6.4',
:operatingsystemmajrelease => '6.4',
:osfamily => 'RedHat',
}
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts.merge(:concat_basedir => '/tmp')
end

it { should contain_class('crane::install') }
it { should contain_class('crane::config') }
end

it { should contain_class('crane::install') }
it { should contain_class('crane::config') }
end

end
2 changes: 1 addition & 1 deletion templates/crane.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
debug: false
#data_dir_polling_interval: 60
data_dir: <%= scope['crane::data_dir'] %>
endpoint: <%= @fqdn %>:<%= @port %>
endpoint: <%= @fqdn %>:<%= scope['crane::port'] %>

0 comments on commit 3bf93d2

Please sign in to comment.