Skip to content

Commit

Permalink
Merge pull request puppetlabs#72 from er0ck/fix/stable/maint-fix_acce…
Browse files Browse the repository at this point in the history
…ptance_no_bundler_net-ssh_pin

(maint) fix acceptance bundle
  • Loading branch information
samwoods1 authored Apr 5, 2017
2 parents b5f1f6f + 974dc6c commit 2a5b832
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 27 deletions.
39 changes: 22 additions & 17 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,40 @@ def location_for(place, fake_version = nil)
end
end

# in the Rakefile, so we require it in all groups
rake_version = '>= 0.9.0'
if ENV['RAKE_VER']
rake_version = "~> #{ENV['RAKE_VER']}"
end
gem 'rake' , "#{rake_version}"
# unit tests: --without system_tests development
gem 'rake'
gem "rototiller", *location_for(ENV['TILLER_VERSION'] || '~> 0.1.0')
gem 'rspec' ,'~> 3.4.0'

group :system_tests do
gem 'beaker' ,'~> 3.0'
beaker_version = '~> 3.0'
nokogiri_version = '~> 1' # any
public_suffix_version = '~> 1' # any
activesupport_version = '~> 1' # any
# restrict gems to enable ruby versions
#
# nokogiri comes along for the ride but needs some restriction too
if Gem::Version.new(RUBY_VERSION).between?(Gem::Version.new('2.0.0'),Gem::Version.new('2.2.4'))
beaker_version = '< 3.9.0'
nokogiri_version = '< 1.7.0'
elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
beaker_version = '~> 2.0'
nokogiri_version = '< 1.7.0'
public_suffix_version = '< 1.5.0'
activesupport_version = '< 5.0.0'
end
gem 'beaker' ,"#{beaker_version}"
gem 'beaker-hostgenerator'
gem 'public_suffix' ,'<= 1.4.6'
gem 'nokogiri' ,'<= 1.6.9'
gem 'nokogiri' ,"#{nokogiri_version}"
gem 'public_suffix' ,"#{public_suffix_version}"
gem 'activesupport' ,"#{activesupport_version}"
end

group :development do
gem 'simplecov'
#Documentation dependencies
gem 'yard' ,'~> 0'
gem 'markdown' ,'~> 0'
# restrict version to enable ruby 1.9.3
gem 'mime-types' ,'~> 2.0'
gem 'google-api-client' ,'<= 0.9.4'
gem 'activesupport' ,'< 5.0.0'
# restrict version to enable ruby 1.9.3 <-> 2.0.0
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0.0')
gem 'public_suffix' ,'<= 1.4.6'
end
end

local_gemfile = "#{__FILE__}.local"
Expand Down
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require "bundler/gem_tasks"
require 'rspec/core/rake_task'
require 'fileutils'
require 'rototiller'
Expand All @@ -23,11 +22,13 @@ task :generate_host_config do |t, args|
sh "cat acceptance/hosts.cfg"
end

default_rake_ver = '11.0'

rototiller_task :acceptance => [:generate_host_config] do |t|
t.add_env({:name => 'LAYOUT', :default => 'centos7-64',
:message => 'The argument to pass to beaker-hostgenerator',
:set_env => true})
t.add_env({:name => 'RAKE_VER', :default => '12.0',
t.add_env({:name => 'RAKE_VER', :default => default_rake_ver,
:message => 'The rake version to use when running unit and acceptance tests',
:set_env => true})

Expand Down Expand Up @@ -73,7 +74,7 @@ end

rototiller_task :check_test do |t|
t.add_env({:name => 'SPEC_PATTERN', :default => 'spec/', :message => 'The pattern RSpec will use to find tests', :set_env => true})
t.add_env({:name => 'RAKE_VER', :default => '11.0', :message => 'The rake version to use when running unit tests', :set_env => true})
t.add_env({:name => 'RAKE_VER', :default => default_rake_ver, :message => 'The rake version to use when running unit tests', :set_env => true})
end

task :yard => [:'docs:gen']
Expand Down
2 changes: 1 addition & 1 deletion acceptance/lib/test_utilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def execute_task_on(host, task_name=nil, rakefile_path=nil, opts={})
step "Execute task '#{task_name}', ensure success"
end

command = "bundle exec rake #{task_name}"
command = "rake #{task_name}"
command = command + " --verbose" if opts[:verbose]
command = command + " --rakefile #{rakefile_path}" if rakefile_path
on(host, command, :accept_all_exit_codes => true) do |result|
Expand Down
8 changes: 5 additions & 3 deletions acceptance/pre-suite/01_install_rototiller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
scp_to(sut, gem_name, gem_name)

if ENV['RAKE_VER']
on(sut, "gem install rake --no-document --version #{ENV['RAKE_VER']}")
rake_version = Gem::Version.new(ENV['RAKE_VER']).approximate_recommendation
on(sut, "gem install rake --force --version '#{rake_version}'")
else
on(sut, "gem install --no-document rake")
on(sut, "gem install rake --force")
end
on(sut, "gem install --no-document ./#{gem_name}")

on(sut, "gem install ./#{gem_name}")
end
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def create_rakefile_task_segment(options)

tasks.each do |task|
step "Use the -T rake switch to test task '#{task[:task_name]}' description" do
on(sut, "bundle exec rake -T --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result|
on(sut, "rake -T --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result|
assert(result.exit_code == 0, 'The expected exit code 0 was not observed')
assert_no_match(/error/i, result.output, 'An unexpected error was observed')
if task[:description]
Expand Down
2 changes: 1 addition & 1 deletion acceptance/tests/rototillerTask/environment_variables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
rakefile_path = create_rakefile_on(sut, rakefile_contents)

step 'Execute task defined in rake task' do
on(sut, "bundle exec rake #{@task_name} --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result|
on(sut, "rake #{@task_name} --rakefile #{rakefile_path}", :accept_all_exit_codes => true) do |result|
# exit code & no error in output
assert(result.exit_code == 1, 'The expected exit code 1 was not observed')

Expand Down
2 changes: 1 addition & 1 deletion rototiller.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Gem::Specification.new do |s|

# RAKE_VER=0.9, 10.0, 11.0
# don't use 11.0.0, which probably installs 11.0.1 which has issues
s.add_runtime_dependency 'rake'
s.add_runtime_dependency 'rake', '< 12.0.0'
end

0 comments on commit 2a5b832

Please sign in to comment.