Skip to content

Commit

Permalink
Adds tests for Ubuntu 1404 and Trusty package
Browse files Browse the repository at this point in the history
* We say we support 1404, but aren't testing
* But 1404 has an older package, and certain 
config settings aren't present (See voxpupuli#111)
* Add 2.8.X config file and logic to fix that
* Add to CI, add docker and vagrant SUTs
  • Loading branch information
petems committed May 3, 2017
1 parent 391c240 commit 8455d5a
Show file tree
Hide file tree
Showing 8 changed files with 955 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ matrix:
env: PUPPET_INSTALL_VERSION="1.5.2" PUPPET_INSTALL_TYPE=agent BEAKER_set="ubuntu-1604-docker"
script: bundle exec rake acceptance
bundler_args: --without development
- sudo: required
services: docker
rvm: '2.3.3'
env: PUPPET_INSTALL_VERSION="1.5.2" PUPPET_INSTALL_TYPE=agent BEAKER_set="ubuntu-1404-docker"
script: bundle exec rake acceptance
bundler_args: --without development
3 changes: 3 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
/^2.4./: {
File[$::redis::config_file_orig] { content => template('redis/redis.conf.2.4.10.erb') }
}
/^2.8./: {
File[$::redis::config_file_orig] { content => template('redis/redis.conf.2.8.erb') }
}
default: {
File[$::redis::config_file_orig] { content => template($::redis::conf_template) }
}
Expand Down
17 changes: 15 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,21 @@
case $::operatingsystem {
'Ubuntu': {
$config_group = 'redis'
# Latest from PPA is 3.0.7
$minimum_version = '3.0.7'

case $::operatingsystemmajrelease {
'14.04': {
# upstream package is 2.8.5
$minimum_version = '2.8.5'
}
'16.04': {
# upstream package is 3.0.3
$minimum_version = '3.0.3'
}
default: {
warning("Ubuntu release ${operatingsystemmajrelease} isn't 'officially' supported by module, but will git it a shot")
$minimum_version = '2.8.5'
}
}
}
default: {
$config_group = 'root'
Expand Down
16 changes: 16 additions & 0 deletions spec/acceptance/nodesets/ubuntu-1404-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
HOSTS:
ubuntu-14-04:
roles:
- master
platform: ubuntu-14.04-amd64
image: electrical/ubuntu:14.04
hypervisor: docker
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'apt-get update'
- 'apt-get install -yq lsb-release wget net-tools curl'
docker_preserve_image: true
CONFIG:
type: foss
log_level: debug
:trace_limit: 100 # Get more than 10 lines of trace when something fails.
11 changes: 11 additions & 0 deletions spec/acceptance/nodesets/ubuntu-1404-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
HOSTS:
ubuntu-14-04:
roles:
- default
- master
platform: ubuntu-14.04-amd64
box: bento/ubuntu-14.04
hypervisor: vagrant
CONFIG:
type: foss
log_level: debug
54 changes: 54 additions & 0 deletions spec/classes/redis_ubuntu_1404_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require 'spec_helper'

describe 'redis' do
context 'on Ubuntu 1404' do

let(:facts) {
ubuntu_1404_facts
}

context 'should set Ubuntu specific values' do

context 'when $::redis_server_version fact is not present (older features not enabled)' do

let(:facts) {
ubuntu_1404_facts.merge({
:redis_server_version => nil,
})
}

it { should contain_file('/etc/redis/redis.conf.puppet').with('content' => /^hash-max-ziplist-entries/) }
it { should contain_file('/etc/redis/redis.conf.puppet').without('content' => /^tcp-backlog/) }

end

context 'when $::redis_server_version fact is present but the older version (older features not enabled)' do

let(:facts) {
ubuntu_1404_facts.merge({
:redis_server_version => '2.8.5',
})
}

it { should contain_file('/etc/redis/redis.conf.puppet').with('content' => /^hash-max-ziplist-entries/) }
it { should contain_file('/etc/redis/redis.conf.puppet').without('content' => /^tcp-backlog/) }

end

context 'when $::redis_server_version fact is present but a newer version (older features enabled)' do

let(:facts) {
ubuntu_1404_facts.merge({
:redis_server_version => '3.2.1',
})
}

it { should contain_file('/etc/redis/redis.conf.puppet').with('content' => /^hash-max-ziplist-entries/) }
it { should contain_file('/etc/redis/redis.conf.puppet').with('content' => /^tcp-backlog/) }

end
end

end

end
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def centos_6_facts
}
end

def ubuntu_1404_facts
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:operatingsystemmajrelease => '14.04',
}
end

def archlinux_facts
{
:operatingsystem => 'Archlinux',
Expand Down
Loading

0 comments on commit 8455d5a

Please sign in to comment.