From 9eb93da056112f06d10f363df6dac0c30c89e1ea Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Fri, 22 Jan 2016 18:52:12 +0100 Subject: [PATCH] cleanup beaker tests - use beaker/puppet_install_helper to install puppet - installed dependency modules like they are listed in the metadata.json - changed apt repo source from https to http, https produced ssl errors under certain ruby versions and needs additional packages on some systems and the packages are signed anyways --- Gemfile | 2 +- README.md | 1 + manifests/repo/apt.pp | 4 ++-- .../{default.yml => ubuntu-server-1204-x64.yml} | 3 --- spec/classes/fluentd_repo_apt_spec.rb | 4 ++-- spec/spec_helper_acceptance.rb | 14 ++++---------- 6 files changed, 10 insertions(+), 18 deletions(-) rename spec/acceptance/nodesets/{default.yml => ubuntu-server-1204-x64.yml} (51%) diff --git a/Gemfile b/Gemfile index 9ae7356..565186b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,4 +6,4 @@ gem 'puppetlabs_spec_helper', '>= 0.8.2' gem 'puppet-lint', '>= 1.0.0' gem 'facter', '>= 1.7.0' gem 'beaker-rspec' -gem 'pry' +gem 'beaker-puppet_install_helper' diff --git a/README.md b/README.md index 181c42c..1a880dd 100644 --- a/README.md +++ b/README.md @@ -264,6 +264,7 @@ To run the tests install the ruby dependencies with `bundler` and execute bundle install --path vendor/bundle bundle exec rake spec bundle exec rake lint +bundle exec rake beaker BEAKER_set=ubuntu-server-1204-x64 ``` ## License diff --git a/manifests/repo/apt.pp b/manifests/repo/apt.pp index 9b72ab6..1832ea0 100644 --- a/manifests/repo/apt.pp +++ b/manifests/repo/apt.pp @@ -2,12 +2,12 @@ # class fluentd::repo::apt ( $ensure = 'present', - $location = downcase("https://packages.treasuredata.com/2/${::operatingsystem}/${::lsbdistcodename}"), + $location = downcase("http://packages.treasuredata.com/2/${::operatingsystem}/${::lsbdistcodename}"), $release = $::lsbdistcodename, $repos = 'contrib', $key = { 'id' => 'C901622B5EC4AF820C38AB861093DB45A12E206F', - 'source' => 'https://packages.treasuredata.com/GPG-KEY-td-agent' + 'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent' }, ) { diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml similarity index 51% rename from spec/acceptance/nodesets/default.yml rename to spec/acceptance/nodesets/ubuntu-server-1204-x64.yml index e007e9a..3cc4198 100644 --- a/spec/acceptance/nodesets/default.yml +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -4,9 +4,6 @@ HOSTS: - master platform: ubuntu-12.04-amd64 box: puppetlabs/ubuntu-12.04-64-nocm - #box: wywy-ubuntu-12.04.5 - box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-12.04-64-nocm - #box_url: http://files.munich.wywy.com/vagrant/box/wywy-ubuntu-12.04.5.box hypervisor: vagrant CONFIG: log_level: verbose diff --git a/spec/classes/fluentd_repo_apt_spec.rb b/spec/classes/fluentd_repo_apt_spec.rb index a232fdb..6af87a2 100644 --- a/spec/classes/fluentd_repo_apt_spec.rb +++ b/spec/classes/fluentd_repo_apt_spec.rb @@ -15,12 +15,12 @@ describe 'fluentd::repo::apt', :type => :class do should contain_class('apt') should contain_apt__source('treasure-data').with({ 'ensure' => 'present', - 'location' => 'https://packages.treasuredata.com/2/ubuntu/precise', + 'location' => 'http://packages.treasuredata.com/2/ubuntu/precise', 'release' => 'precise', 'repos' => 'contrib', 'key' => { 'id' => 'C901622B5EC4AF820C38AB861093DB45A12E206F', - 'source' => 'https://packages.treasuredata.com/GPG-KEY-td-agent' + 'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent' } }) } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 6e1be13..c836b51 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,13 +1,7 @@ require 'beaker-rspec' -require 'pry' +require 'beaker/puppet_install_helper' -hosts.each do |host| - # Install Puppet - on host, 'apt-get -y install ruby1.9.1 rubygems ruby1.9.1-dev libaugeas-ruby1.9.1' - on host, 'update-alternatives --set ruby /usr/bin/ruby1.9.1' - on host, 'update-alternatives --set gem /usr/bin/gem1.9.1' - on host, install_puppet -end +run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' RSpec.configure do |c| # Project root @@ -21,8 +15,8 @@ RSpec.configure do |c| # Install module puppet_module_install(:source => module_root, :module_name => 'fluentd') hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib', '--version', '4.9.0') - on host, puppet('module', 'install', 'puppetlabs-apt', '--version', '2.1.1') + on host, puppet('module', 'install', 'puppetlabs-stdlib', '--version', '4.6.0') + on host, puppet('module', 'install', 'puppetlabs-apt', '--version', '2.0.0') end end end