Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix testing #288

Merged
merged 4 commits into from
Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
---
sudo: false
branches:
only:
- master

language: ruby
bundler_args: --without acceptance
script:
- "bundle exec rake lint"
- "bundle exec rake syntax"
- "bundle exec rake spec SPEC_OPTS='--format documentation'"

sudo: false

before_install:
- 'gem update --system'
- 'gem update bundler'

bundler_args: --without acceptance

script: "SPEC_OPTS='--format documentation' bundle exec rake lint syntax spec"

after_success:
- git clone -q git://github.com/puppetlabs/ghpublisher.git .forge-releng
- .forge-releng/publish

rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- jruby-19mode

env:
- PUPPET_VERSION="~> 2.7.0"
- PUPPET_VERSION="~> 3.1.0"
- PUPPET_VERSION="~> 3.2.0"
- PUPPET_VERSION="~> 3.3.0"
Expand All @@ -31,16 +34,11 @@ env:

global:
- PUBLISHER_LOGIN=acidprime

matrix:
exclude:
- rvm: 1.9.3
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_VERSION="~> 3.1.0"
- rvm: jruby-19mode
env: PUPPET_VERSION="~> 2.7.0"
- rvm: jruby-19mode
env: PUPPET_VERSION="~> 3.1.0"
- rvm: jruby-19mode
Expand All @@ -56,13 +54,12 @@ matrix:
include:
- rvm: 2.1.5
env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
# - rvm: 2.1.6
# env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"

notifications:
email: false
webhooks:
urls:
- 'https://webhooks.gitter.im/e/8936500cc6a369ff46ee'
- 'https://webhooks.gitter.im/e/8936500cc6a369ff46ee'
on_success: change
on_failure: always
on_start: false
47 changes: 23 additions & 24 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :development, :test do
if RUBY_VERSION < '1.9.3'
gem 'rake', '~> 10.5.0', :require => false
else
gem 'rake', :require => false
end
gem 'puppetlabs_spec_helper', :require => false
gem "rspec", '< 3.2.0'
gem "rspec-core", "3.1.7"
gem "rspec-puppet", "~> 2.1"
gem 'puppet-lint', :require => false
gem 'puppet-syntax', :require => false
end

group :acceptance do
gem "beaker", "> 2.0.0"
gem "beaker-rspec", ">= 5.1.0"
gem 'serverspec', :require => false
gem "vagrant-wrapper"
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', '~> 3.0', :require => false
end

if facterversion = ENV['FACTER_GEM_VERSION']
Expand All @@ -27,10 +12,24 @@ else
gem 'facter', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', '3.7.0', :require => false
gem 'puppetlabs_spec_helper', '>= 1.2.0'
gem 'rspec-puppet'
gem 'puppet-lint', '~> 2.0'

gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION < '1.9'
gem 'rspec', :require => false if RUBY_VERSION >= '1.9'
gem 'rake', '~> 10.0', :require => false if RUBY_VERSION < '1.9'
gem 'rake', :require => false if RUBY_VERSION >= '1.9'
gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9'
gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9'

group :acceptance do
gem 'beaker', '> 2.0.0', :require => false
gem 'beaker-rspec', '>= 5.1.0', :require => false
gem 'serverspec', :require => false
gem 'vagrant-wrapper', :require => false
end

# vim:ft=ruby
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,17 +617,6 @@ This project contains tests for [rspec-puppet](http://rspec-puppet.com/) to veri

Quickstart:

####Ruby > 1.8.7

```
gem install bundler
bundle install
bundle exec rake spec
bundle exec rake lint
```

####Ruby = 1.8.7

```
gem install bundler
bundle install --without system_tests
Expand Down
6 changes: 3 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
if $package_name == '' {
case $provider {
'openbsd': {
if (versioncmp($::kernelversion, '5.8') < 0) {
if (versioncmp("${::kernelversion}", '5.8') < 0) { #lint:ignore:only_variable_string
$real_package_name = 'ruby21-r10k'
} else {
$real_package_name = 'ruby22-r10k'
Expand Down Expand Up @@ -79,8 +79,8 @@
}

# Puppet Enterprise 3.8 and ships an embedded r10k so thats all thats supported
# This conditional should not effect FOSS customers based on the fact
unless ($::is_pe == 'true' or $::is_pe == true) and versioncmp($::pe_version, '3.8.0') >= 0 and $puppet_master {
# This conditional should not effect FOSS customers based on the fact
unless ($::is_pe == 'true' or $::is_pe == true) and versioncmp("${::pe_version}", '3.8.0') >= 0 and $puppet_master { #lint:ignore:only_variable_string
package { $real_package_name:
ensure => $version,
provider => $provider,
Expand Down
2 changes: 1 addition & 1 deletion manifests/install/pe_gem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Puppet Enterprise 3.8 ships code to manage this symlink on install
# This conditional should not effect FOSS customers based on the fact
unless versioncmp($::pe_version, '3.8.0') >= 0 and $puppet_master {
unless versioncmp("${::pe_version}", '3.8.0') >= 0 and $puppet_master { #lint:ignore:only_variable_string
file { '/usr/bin/r10k':
ensure => link,
target => '/opt/puppet/bin/r10k',
Expand Down
2 changes: 1 addition & 1 deletion manifests/install/puppet_gem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

require git

if versioncmp($::puppetversion, '4.2.0') >= 0 {
if versioncmp("${::puppetversion}", '4.2.0') >= 0 { #lint:ignore:only_variable_string
file { '/usr/bin/r10k':
ensure => link,
target => '/opt/puppetlabs/puppet/bin/r10k',
Expand Down
2 changes: 1 addition & 1 deletion manifests/mcollective.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
group => '0',
mode => '0644',
}

# Install the agent and its ddl file
file { "${app_path}/${app_name}":
source => "puppet:///modules/${module_name}/application/${agent_name}",
Expand Down
10 changes: 5 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$sources = undef
$puppet_master = true

if versioncmp($::puppetversion, '4.0.0') >= 0 {
if versioncmp("${::puppetversion}", '4.0.0') >= 0 { #lint:ignore:only_variable_string
$r10k_basedir = $::settings::environmentpath
$r10k_cache_dir = "${::settings::vardir}/r10k"
} else {
Expand Down Expand Up @@ -82,7 +82,7 @@
$is_pe_server = false
}

if $is_pe_server and versioncmp($::puppetversion, '4.0.0') >= 0 {
if $is_pe_server and versioncmp("${::puppetversion}", '4.0.0') >= 0 { #lint:ignore:only_variable_string
# PE 4 or greater specific settings
# r10k configuration
$r10k_config_file = '/etc/r10k.yaml'
Expand All @@ -106,7 +106,7 @@
$webhook_certname = 'peadmin'
$webhook_certpath = '/var/lib/peadmin/.mcollective.d'
}
elsif $is_pe_server and versioncmp($::puppetversion, '4.0.0') == -1 {
elsif $is_pe_server and versioncmp("${::puppetversion}", '4.0.0') == -1 { #lint:ignore:only_variable_string
# PE 3.x.x specific settings
# r10k configuration
$r10k_config_file = '/etc/r10k.yaml'
Expand All @@ -130,7 +130,7 @@
$webhook_certname = 'peadmin'
$webhook_certpath = '/var/lib/peadmin/.mcollective.d'
}
elsif versioncmp($::puppetversion, '4.0.0') >= 0 {
elsif versioncmp("${::puppetversion}", '4.0.0') >= 0 { #lint:ignore:only_variable_string
#FOSS 4 or greater specific settings
# r10k configuration
$r10k_config_file = '/etc/puppetlabs/r10k/r10k.yaml'
Expand Down Expand Up @@ -196,7 +196,7 @@
'openbsd': {
$plugins_dir = '/usr/local/libexec/mcollective/mcollective'
$provider = 'openbsd'
if (versioncmp($::kernelversion, '5.8') < 0) {
if (versioncmp("${::kernelversion}", '5.8') < 0) { #lint:ignore:only_variable_string
$r10k_binary = 'r10k21'
} else {
$r10k_binary = 'r10k22'
Expand Down
4 changes: 2 additions & 2 deletions manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$is_pe_server = $r10k::params::is_pe_server,
$manage_packages = true,
) inherits r10k::params {

File {
ensure => $ensure,
owner => 'root',
Expand Down Expand Up @@ -87,7 +87,7 @@
# Only managed this file if you are using mcollective mode
# We don't remove it as its part of PE and this is legacy
if $use_mcollective {
if $is_pe_server and versioncmp($::puppetversion, '3.7.0') >= 0 {
if $is_pe_server and versioncmp("${::puppetversion}", '3.7.0') >= 0 { #lint:ignore:only_variable_string
# 3.7 does not place the certificate in peadmin's ~
# This places it there as if it was an upgrade
file { 'peadmin-cert.pem':
Expand Down
10 changes: 5 additions & 5 deletions manifests/webhook/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
class r10k::webhook::package (
$is_pe_server = $r10k::params::is_pe_server,
) inherits r10k::params {

if $is_pe_server {
# PE 4.2 and up ships a vendor provided ruby.
# Using puppet_gem uses that instead of the PE's ruby.
if (versioncmp($::puppetversion, '4.2.0') >= 0) {
if (versioncmp("${::puppetversion}", '4.2.0') >= 0) { #lint:ignore:only_variable_string
$provider = 'puppet_gem'
} else {
$provider = 'pe_gem'
Expand All @@ -21,7 +21,7 @@
}
}

if versioncmp($::puppetversion, '3.7.0') >= 0 {
if versioncmp("${::puppetversion}", '3.7.0') >= 0 { #lint:ignore:only_variable_string
if !defined(Package['rack']) {
package { 'rack':
ensure => installed,
Expand All @@ -34,7 +34,7 @@

# Puppet FOSS 4.2 and up ships a vendor provided ruby.
# Using puppet_gem uses that instead of the system ruby.
if (versioncmp($::puppetversion, '4.2.0') >= 0) {
if (versioncmp("${::puppetversion}", '4.2.0') >= 0) { #lint:ignore:only_variable_string
$provider = 'puppet_gem'
} else {
$provider = 'gem'
Expand Down Expand Up @@ -67,7 +67,7 @@
}
}

if versioncmp($::puppetversion, '3.7.0') >= 0 {
if versioncmp("${::puppetversion}", '3.7.0') >= 0 { #lint:ignore:only_variable_string
if !defined(Package['rack']) {
package { 'rack':
ensure => installed,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Zach Smith",
"license": "Apache License, Version 2.0",
"license": "Apache-2.0",
"name": "zack-r10k",
"operatingsystem_support": [],
"project_page": "https://github.com/acidprime/r10k",
Expand Down
80 changes: 0 additions & 80 deletions spec/classes/install/gem_spec.rb
Original file line number Diff line number Diff line change
@@ -1,46 +1,5 @@
require 'spec_helper'
describe 'r10k::install::gem' , :type => 'class' do
context "on a RedHat 5 OS installing 1.1.0 via gem with puppet FOSS 2.7.19" do
let :params do
{
:manage_ruby_dependency => 'declare',
:version => '1.1.0',
}
end
let :facts do
{
:osfamily => 'RedHat',
:puppetversion => '2.7.19',
:operatingsystemrelease => '5'
}
end
it { should contain_class("ruby").with(
'rubygems_update' => false
)
}
it { should contain_class("ruby::dev") }

it { should_not contain_class("gcc") }
it { should_not contain_class("make") }
context 'when manage_ruby_dependency is set to "include"' do
let (:params) {{
:manage_ruby_dependency => 'include',
:version => '1.1.0',
}}
it { should contain_class("ruby").with('rubygems_update' => false)}
it { should contain_class("ruby::dev") }
end
context 'when manage_ruby_dependency is set to "ignore"' do
let (:params) {{
:manage_ruby_dependency => 'ignore',
:version => '1.1.0',
}}
it 'should not declare the ruby or ruby::dev classes' do
should_not contain_class('ruby')
should_not contain_class('ruby::dev')
end
end
end
context "on a RedHat 5 OS installing 1.1.0 via gem with puppet FOSS 3.2.3" do
let :params do
{
Expand Down Expand Up @@ -79,43 +38,4 @@
end
end
end
context "on a RedHat 5 OS installing 0.0.9 via gem with puppet FOSS 2.7.19" do
let :params do
{
:manage_ruby_dependency => 'declare',
:version => '0.0.9',
}
end
let :facts do
{
:osfamily => 'RedHat',
:puppetversion => '3.2.3',
:operatingsystemrelease => '5'
}
end
let(:pre_condition) {
'package { "r10k":
ensure => present,
}' }
it { should contain_class("make") }
it { should contain_class("gcc") }
context 'when manage_ruby_dependency is set to "include"' do
let (:params) {{
:manage_ruby_dependency => 'include',
:version => '0.0.9',
}}
it { should contain_class("ruby").with('rubygems_update' => false)}
it { should contain_class("ruby::dev") }
end
context 'when manage_ruby_dependency is set to "ignore"' do
let (:params) {{
:manage_ruby_dependency => 'ignore',
:version => '0.0.9',
}}
it 'should not declare the ruby or ruby::dev classes' do
should_not contain_class('ruby')
should_not contain_class('ruby::dev')
end
end
end
end
Loading