Project

General

Profile

« Previous | Next » 

Revision ac09db0a

Added by Dominic Cleal over 8 years ago

modulesync: speed improvements, new helpers and rspec 3.x minimum

View differences:

.travis.yml
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.5
- 2.0.0
- 1.9.3
- 1.8.7
env:
- PUPPET_VERSION=2.7.0
- PUPPET_VERSION=3.5
- PUPPET_VERSION=3.5 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes
- PUPPET_VERSION=4.0
# First test the major distros
- PUPPET_VERSION=4.0 ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64
- PUPPET_VERSION=3.5 ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes
- PUPPET_VERSION=3.5 ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64
# Test FreeBSD explicitly so we can exclude ruby 1.8.7 tests
- PUPPET_VERSION=4.0 ONLY_OS=freebsd-9-amd64,freebsd-10-amd64
- PUPPET_VERSION=3.5 ONLY_OS=freebsd-9-amd64,freebsd-10-amd64 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes
- PUPPET_VERSION=3.5 ONLY_OS=freebsd-9-amd64,freebsd-10-amd64
# Test the rest of the supported platforms
- PUPPET_VERSION=4.0 EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64,freebsd-9-amd64,freebsd-10-amd64
- PUPPET_VERSION=3.5 EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64,freebsd-9-amd64,freebsd-10-amd64 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes
- PUPPET_VERSION=3.5 EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64,freebsd-9-amd64,freebsd-10-amd64
# Only test Puppet 2.7 on ubuntu 12 and centos 6
- PUPPET_VERSION=2.7.0 ONLY_OS=ubuntu-12-x86_64,centos-6-x86_64
matrix:
fast_finish: true
exclude:
# No real support for Ruby 1.9.3 on Puppet 2.x
- rvm: 1.9.3
env: PUPPET_VERSION=2.7.0
env: PUPPET_VERSION=2.7.0 ONLY_OS=ubuntu-12-x86_64,centos-6-x86_64
# No support for Ruby 2.0 before Puppet 3.2
- rvm: 2.0.0
env: PUPPET_VERSION=2.7.0
env: PUPPET_VERSION=2.7.0 ONLY_OS=ubuntu-12-x86_64,centos-6-x86_64
# No support for Ruby 2.1 before Puppet 3.5
- rvm: 2.1.5
env: PUPPET_VERSION=2.7.0
env: PUPPET_VERSION=2.7.0 ONLY_OS=ubuntu-12-x86_64,centos-6-x86_64
# No support for Ruby 1.8.7 on Puppet 4.x
- rvm: 1.8.7
env: PUPPET_VERSION=4.0
env: PUPPET_VERSION=4.0 ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64
- rvm: 1.8.7
env: PUPPET_VERSION=4.0 EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64,freebsd-9-amd64,freebsd-10-amd64
- rvm: 1.8.7
env: PUPPET_VERSION=4.0 ONLY_OS=freebsd-9-amd64,freebsd-10-amd64
# Exclude FreeBSD tests on Ruby 1.8.7
- rvm: 1.8.7
env: PUPPET_VERSION=3.5 ONLY_OS=freebsd-9-amd64,freebsd-10-amd64 FUTURE_PARSER=yes TRUSTED_NODE_DATA=yes
- rvm: 1.8.7
env: PUPPET_VERSION=3.5 ONLY_OS=freebsd-9-amd64,freebsd-10-amd64
bundler_args: --without development
sudo: false
Gemfile
gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '>= 2.7'
if RUBY_VERSION.start_with? '1.8'
gem 'rspec', '>= 3', '< 3.2'
else
gem 'rspec', '~> 3.0'
end
gem 'rake'
gem 'rspec-puppet', '~> 2.0'
gem 'puppetlabs_spec_helper', '>= 0.8.0'
......
gem 'mime-types', '~> 1.0', {"platforms"=>["ruby_18"], "groups"=>["development"]}
gem 'rspec-puppet-facts'
gem 'metadata-json-lint'
gem 'rspec', '< 3.2.0', {"platforms"=>["ruby_18"]}
# vim:ft=ruby
spec/spec_helper.rb
def inspect; 'undef'; end
end
# Running tests with the ONLY_OS environment variable set
# limits the tested platforms to the specified values.
# Example: ONLY_OS=centos-7-x86_64,ubuntu-14-x86_64
def only_test_os
if ENV.key?('ONLY_OS')
ENV['ONLY_OS'].split(',')
end
end
# Running tests with the EXCLUDE_OS environment variable set
# limits the tested platforms to all but the specified values.
# Example: EXCLUDE_OS=centos-7-x86_64,ubuntu-14-x86_64
def exclude_test_os
if ENV.key?('EXCLUDE_OS')
ENV['EXCLUDE_OS'].split(',')
end
end
def get_content(subject, title)
content = subject.resource('file', title).send(:parameters)[:content]
content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }
......
def verify_concat_fragment_contents(subject, title, expected_lines)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
(content.split("\n") & expected_lines).should == expected_lines
expect(content.split("\n") & expected_lines).to eq(expected_lines)
end
def verify_concat_fragment_exact_contents(subject, title, expected_lines)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }.should == expected_lines
expect(content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }).to eq(expected_lines)
end
# See https://github.com/rodjek/rspec-puppet/issues/215
# Without this patch the @@cache variable grows huge and causes memory usage issues
# with a large amount of examples.
module RSpec::Puppet
module Support
def build_catalog(*args)
if @@cache.has_key?(args)
@@cache[args]
else
@@cache = {}
@@cache[args] ||= self.build_catalog_without_cache(*args)
end
end
end
end

Also available in: Unified diff