beaker 3.9.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDY0YzA0OTYzZWUyZDJiZmIzODQ1Y2I2MzkzMDE2ZDFjYTM4Y2VlOA==
4
+ ZmJlZmIyZTkxMzE4ZDg2YTRkNmU1YTkwZWE3YjM1N2JlZGFiM2E5Ng==
5
5
  data.tar.gz: !binary |-
6
- MzE2ODZhNDQxOWY4OTczMzZiNWQ4NzViYzFlNTFkOGFmZGJlMjJjMQ==
6
+ N2ExOTAxZWZhODM5NjcwYjVmYTk2NzcyNzEyMzU3MzNjMDE5ZDhmMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2MyM2FiYjEyNDE5NzI4YWE5YzliYjEzMzI4M2M3MGI0NDQ0NmRiMTYzMDc1
10
- OGM5Njc4MzBjMDUxYmU4ZjY5YjQ5YWQ0YTJmZDRkMWZiODE3MWFmNTNkNjA2
11
- NWRiOGJiNDllZGM5MDFjYzEwYzBiYjJlZmI5NGQ2OTdkZGViNDU=
9
+ YmQwYTZlMDM0YTBlZWUzMWIyNzU5ZTE4NmMzMzllN2U2ZDA2OThmZWQ1NWNh
10
+ MWFlMzUwZDg2N2FlYWQ1OWYwMGZlMmNlNzQ1ODdkNTU1NjRkMGFkZDFkZmQ5
11
+ Nzc3YWI5YjE2ZDhlNGY4NDFjYzcxMjg0NmI1OTYwZjk2ODliZDc=
12
12
  data.tar.gz: !binary |-
13
- M2Y5OWE2NGJiYjFjNjFlNzhlNWI2M2UwMWIyNjA1ZjU2OTExMWRjMjM5NDQy
14
- MTYzY2JiODcxNmI5YjMxM2M2NDZjOTZiOWZlN2I3ZDI2YTlmZjI0ODIyYjYz
15
- NzNhMzRjYWMyNjM2NWVkOTY3YWFjZTY4ZjEwNTgyNzYyMzdiZTQ=
13
+ MmViMTUyYzY3NDY0YzczMGRiZDcwMTJkZTU0MWI3ZTcwY2U2NThiY2MwZTY3
14
+ NWY0NmM4YzZkYzE1ZjkzODM1YzQwMWQzMTRjNWNhYzM3ODZkMDU4ODc3Yjk3
15
+ NzE5NDY2Nzg2YjA0MWFkYzJjMmFjODM2MWFmYmVhYzBjNDVlYTg=
data/beaker.gemspec CHANGED
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'rspec', '~> 3.0'
24
24
  s.add_development_dependency 'rspec-its'
25
25
  s.add_development_dependency 'fakefs', '~> 0.6'
26
- s.add_development_dependency 'rake', '~> 11.2'
27
26
  s.add_development_dependency 'simplecov'
28
27
  s.add_development_dependency 'pry', '~> 0.10'
29
28
 
@@ -43,6 +42,7 @@ Gem::Specification.new do |s|
43
42
  ## indicating test from puppet acceptance:
44
43
  ## tests/security/cve-2013-1652_improper_query_params.rb
45
44
 
45
+ s.add_runtime_dependency 'rake', '~> 10.0'
46
46
  s.add_runtime_dependency 'rsync', '~> 1.0.9'
47
47
  s.add_runtime_dependency 'open_uri_redirections', '~> 0.2.1'
48
48
  s.add_runtime_dependency 'in-parallel', '~> 0.1'
@@ -51,7 +51,6 @@ Gem::Specification.new do |s|
51
51
  # Run time dependencies that are Beaker libraries
52
52
  s.add_runtime_dependency 'stringify-hash', '~> 0.0'
53
53
  s.add_runtime_dependency 'beaker-hiera', '~> 0.0'
54
- s.add_runtime_dependency 'beaker-facter', '~> 0.0'
55
54
  s.add_runtime_dependency 'beaker-hostgenerator'
56
55
 
57
56
  # Optional provisioner specific support
@@ -0,0 +1,29 @@
1
+ # Testing Beaker Itself
2
+
3
+ While Beaker provides the testing harness for much of the acceptance testing that happens at Puppet, Beaker itself must also go through a testing process for changes submitted to itself to ensure that releases of Beaker do not break pipelines, jobs, and tests that rely on it. This document describes what is actually covered in Beaker's own testing and how that testing is accomplished.
4
+
5
+ ## Testing Coverage
6
+
7
+ ### Product Coverage
8
+
9
+ Beaker test coverage covers the LTS PE version, currently 2016.4.0, and the latest released version of PE, currently 2016.5.0.
10
+ Since there is only a single major version of Puppet itself currently supported, beaker only run tests on the latest y-release of Puppet 4, currently 4.8.z. This currently resolves to puppet-agent 1.8.x.
11
+
12
+ ### Platform Coverage
13
+
14
+ The platforms that beaker covers in its regression testing are largely what is supported by either Puppet or Puppet Enterprise. All variants that are supported by Puppet Enterprise as master platforms are tested. Variants that are agent only are more sparsely covered, generally testing the latest released version.
15
+
16
+ ## Test Suite Phases
17
+
18
+ ### Beaker Spec
19
+ The initial step in Beaker's pipeline is to execute spec testing with supported and future rubies; 2.2.5 and 2.3.1.
20
+
21
+ ### Beaker Acceptance
22
+ All acceptance tests use actual OS's with beaker installed and use beaker itself to verify that its own methods and classes are working.
23
+
24
+ * The Base tests are tests that do not require puppet be installed on the SUT. This includes much of the DSL and host helpers.
25
+ * The puppet tests rely on puppet being installed in the pre-suite
26
+
27
+ ### Beaker Regression
28
+
29
+ The Beaker regression tests are an ever evolving set of Jenkins jobs that use acceptance jobs defined in other pipelines with the Beaker PR changes. We run these jobs to ensure the PR changes do not cause breakage in existing acceptance jobs. The tests themselves are maintained by each separate team.
@@ -1,10 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
- [ 'host', 'puppet', 'test', 'tk', 'web', 'hocon' ].each do |lib|
2
+ [ 'facter', 'host', 'puppet', 'test', 'tk', 'web', 'hocon' ].each do |lib|
3
3
  require "beaker/dsl/helpers/#{lib}_helpers"
4
4
  end
5
5
 
6
- require 'beaker-hiera'
7
- require 'beaker-facter'
6
+ require "beaker-hiera"
8
7
  module Beaker
9
8
  module DSL
10
9
 
@@ -24,6 +23,7 @@ module Beaker
24
23
  #
25
24
  #
26
25
  module Helpers
26
+ include Beaker::DSL::Helpers::FacterHelpers
27
27
  include Beaker::DSL::Helpers::HostHelpers
28
28
  include Beaker::DSL::Helpers::PuppetHelpers
29
29
  include Beaker::DSL::Helpers::TestHelpers
@@ -31,7 +31,6 @@ module Beaker
31
31
  include Beaker::DSL::Helpers::WebHelpers
32
32
  include Beaker::DSL::Helpers::HoconHelpers
33
33
  include Beaker::DSL::Helpers::Hiera
34
- include Beaker::DSL::Helpers::Facter
35
34
  end
36
35
  end
37
36
  end
@@ -0,0 +1,57 @@
1
+ module Beaker
2
+ module DSL
3
+ module Helpers
4
+ # Methods that help you interact with your facter installation, facter must be installed
5
+ # for these methods to execute correctly
6
+ #
7
+ module FacterHelpers
8
+
9
+ # @!macro [new] common_opts
10
+ # @param [Hash{Symbol=>String}] opts Options to alter execution.
11
+ # @option opts [Boolean] :silent (false) Do not produce log output
12
+ # @option opts [Array<Fixnum>] :acceptable_exit_codes ([0]) An array
13
+ # (or range) of integer exit codes that should be considered
14
+ # acceptable. An error will be thrown if the exit code does not
15
+ # match one of the values in this list.
16
+ # @option opts [Boolean] :accept_all_exit_codes (false) Consider all
17
+ # exit codes as passing.
18
+ # @option opts [Boolean] :dry_run (false) Do not actually execute any
19
+ # commands on the SUT
20
+ # @option opts [String] :stdin (nil) Input to be provided during command
21
+ # execution on the SUT.
22
+ # @option opts [Boolean] :pty (false) Execute this command in a pseudoterminal.
23
+ # @option opts [Boolean] :expect_connection_failure (false) Expect this command
24
+ # to result in a connection failure, reconnect and continue execution.
25
+ # @option opts [Hash{String=>String}] :environment ({}) These will be
26
+ # treated as extra environment variables that should be set before
27
+ # running the command.
28
+ #
29
+
30
+ # Get a facter fact from a provided host
31
+ #
32
+ # @param [Host, Array<Host>, String, Symbol] host One or more hosts to act upon,
33
+ # or a role (String or Symbol) that identifies one or more hosts.
34
+ # @param [String] name The name of the fact to query for
35
+ # @!macro common_opts
36
+ #
37
+ # @return String The value of the fact 'name' on the provided host
38
+ # @raise [FailTest] Raises an exception if call to facter fails
39
+ def fact_on(host, name, opts = {})
40
+ result = on host, facter(name, opts)
41
+ if result.kind_of?(Array)
42
+ result.map { |res| res.stdout.chomp }
43
+ else
44
+ result.stdout.chomp
45
+ end
46
+ end
47
+
48
+ # Get a facter fact from the default host
49
+ # @see #fact_on
50
+ def fact(name, opts = {})
51
+ fact_on(default, name, opts)
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1143,7 +1143,12 @@ module Beaker
1143
1143
  when /^(sles|aix|el)$/
1144
1144
  # NOTE: AIX does not support repo management. This block assumes
1145
1145
  # that the desired rpm has been mirrored to the 'repos' location.
1146
- on host, "rpm -ivh #{onhost_copied_file}"
1146
+ # NOTE: the AIX 7.1 package will only install on 7.2 with
1147
+ # --ignoreos. This is a bug in package building on AIX 7.1's RPM
1148
+ if variant == "aix" and version == "7.2"
1149
+ aix_72_ignoreos_hack = "--ignoreos"
1150
+ end
1151
+ on host, "rpm -ivh #{aix_72_ignoreos_hack} #{onhost_copied_file}"
1147
1152
  when /^windows$/
1148
1153
  result = on host, "echo #{onhost_copied_file}"
1149
1154
  onhost_copied_file = result.raw_output.chomp
@@ -403,6 +403,7 @@ module Unix::Pkg
403
403
  when /^(sles|aix|el|centos|oracle|redhat|scientific)$/
404
404
  variant = 'el' if variant.match(/(?:el|centos|oracle|redhat|scientific)/)
405
405
  arch = 'ppc' if variant == 'aix' && arch == 'power'
406
+ version = '7.1' if variant == 'aix' && version == '7.2'
406
407
  release_path_end = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
407
408
  release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.rpm"
408
409
  else
@@ -407,7 +407,7 @@ module Beaker
407
407
  end
408
408
  wait_for_status(:running, instances)
409
409
  rescue Exception => ex
410
- @logger.notify("aws-sdk: exception - #{ex}")
410
+ @logger.notify("aws-sdk: exception #{ex.class}: #{ex}")
411
411
  kill_instances(instances.map{|x| x[:instance]})
412
412
  raise ex
413
413
  end
@@ -805,10 +805,18 @@ module Beaker
805
805
  # @param [String] pair_name the name of the key to be created
806
806
  #
807
807
  # @return [AWS::EC2::KeyPair] key pair created
808
+ # @raise [RuntimeError] raised if AWS keypair not created
808
809
  def create_new_key_pair(region, pair_name)
809
- @logger.debug("aws-sdk: generating new key pair: #{pair_name}")
810
+ @logger.debug("aws-sdk: importing new key pair: #{pair_name}")
810
811
  ssh_string = public_key()
811
812
  region.key_pairs.import(pair_name, ssh_string)
813
+ kp = region.key_pairs[pair_name]
814
+ if kp.exists?
815
+ @logger.debug("aws-sdk: key pair #{pair_name} imported")
816
+ kp
817
+ else
818
+ raise RuntimeError, "AWS key pair #{pair_name} can not be queried, even after import"
819
+ end
812
820
  end
813
821
 
814
822
  # Return a reproducable security group identifier based on input ports
@@ -51,6 +51,7 @@ module Beaker
51
51
  # quick start tasks
52
52
  def self.require_tasks()
53
53
  rake_file = determine_rake_file()
54
+ FileUtils.touch(rake_file)
54
55
  unless File.readlines(rake_file).grep(/#{BEAKER_REQUIRE}/).any?
55
56
  File.open(rake_file, "a+") { |f| f.puts(BEAKER_REQUIRE) }
56
57
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '3.9.0'
3
+ STRING = '3.10.0'
4
4
  end
5
5
  end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLHelpers
4
+ include Beaker::DSL::Helpers
5
+ include Beaker::DSL::Wrappers
6
+ include Beaker::DSL::Roles
7
+ include Beaker::DSL::Patterns
8
+
9
+ def logger
10
+ RSpec::Mocks::Double.new('logger').as_null_object
11
+ end
12
+
13
+ end
14
+
15
+ describe ClassMixedWithDSLHelpers do
16
+ let( :command ){ 'ls' }
17
+ let( :host ) { double.as_null_object }
18
+ let( :result ) { Beaker::Result.new( host, command ) }
19
+
20
+ let( :master ) { make_host( 'master', :roles => %w( master agent default) ) }
21
+ let( :agent ) { make_host( 'agent', :roles => %w( agent ) ) }
22
+ let( :custom ) { make_host( 'custom', :roles => %w( custom agent ) ) }
23
+ let( :dash ) { make_host( 'console', :roles => %w( dashboard agent ) ) }
24
+ let( :db ) { make_host( 'db', :roles => %w( database agent ) ) }
25
+ let( :hosts ) { [ master, agent, dash, db, custom ] }
26
+
27
+
28
+ describe '#fact_on' do
29
+ it 'retrieves a fact on a single host' do
30
+ result.stdout = "family\n"
31
+ expect( subject ).to receive(:facter).with('osfamily',{}).once
32
+ expect( subject ).to receive(:on).and_return(result)
33
+
34
+ expect( subject.fact_on('host','osfamily') ).to be === result.stdout.chomp
35
+ end
36
+
37
+ it 'retrieves an array of facts from multiple hosts' do
38
+ allow( subject ).to receive( :hosts ).and_return( hosts )
39
+ times = hosts.length
40
+ result.stdout = "family\n"
41
+ hosts.each do |host|
42
+ expect( host ).to receive(:exec).and_return(result)
43
+ end
44
+
45
+ expect( subject.fact_on(hosts,'osfamily') ).to be === [result.stdout.chomp] * hosts.length
46
+
47
+ end
48
+ end
49
+
50
+ describe '#fact' do
51
+ it 'delegates to #fact_on with the default host' do
52
+ allow( subject ).to receive(:hosts).and_return(hosts)
53
+ expect( subject ).to receive(:fact_on).with(master,"osfamily",{}).once
54
+
55
+ subject.fact('osfamily')
56
+ end
57
+ end
58
+
59
+ end
@@ -825,16 +825,29 @@ module Beaker
825
825
  end
826
826
 
827
827
  describe '#create_new_key_pair' do
828
- let( :region ) { double('region', :name => 'test_region_name') }
828
+ let(:region) { double('region', :name => 'test_region_name') }
829
+ let(:ssh_string) { 'ssh_string_test_0867' }
830
+ let(:pairs) { double('keypairs') }
831
+ let(:pair) { double('keypair') }
832
+ let(:pair_name) { 'pair_name_1555432' }
833
+
834
+ before :each do
835
+ allow(aws).to receive(:public_key).and_return(ssh_string)
836
+ expect(pairs).to receive(:import).with(pair_name, ssh_string)
837
+ expect(pairs).to receive(:[]).with(pair_name).and_return(pair)
838
+ expect(region).to receive(:key_pairs).and_return(pairs).twice
839
+ end
829
840
 
830
841
  it 'imports the key given from public_key' do
831
- ssh_string = 'ssh_string_test_0867'
832
- allow( aws ).to receive( :public_key ).and_return( ssh_string )
833
- pairs = double('keypairs')
834
- pair_name = 'pair_name_1555432'
835
- expect( pairs ).to receive( :import ).with( pair_name, ssh_string )
836
- expect( region ).to receive(:key_pairs).and_return(pairs).once
837
- aws.create_new_key_pair( region, pair_name )
842
+ expect(pair).to receive(:exists?).and_return (true)
843
+ aws.create_new_key_pair(region, pair_name)
844
+ end
845
+
846
+ it 'raises an exception if subsequent keypair check is false' do
847
+ expect(pair).to receive(:exists?).and_return (false)
848
+ expect { aws.create_new_key_pair(region, pair_name) }.
849
+ to raise_error(RuntimeError,
850
+ "AWS key pair #{pair_name} can not be queried, even after import")
838
851
  end
839
852
  end
840
853
 
@@ -181,6 +181,7 @@ module Beaker
181
181
  allow(File).to receive(:readlines).with("Rakefile").and_return([""])
182
182
  allow(File).to receive(:open).with("Rakefile", "a+").and_yield(file)
183
183
  allow(File).to receive(:puts).with("require 'beaker/tasks/quick_start'").and_return(true)
184
+ expect(FileUtils).to receive(:touch).with("Rakefile").exactly(1).times
184
185
  expect(File).to receive(:open).with("Rakefile", "a+").and_yield(file).exactly(1).times
185
186
  expect(file).to receive(:puts).with("require 'beaker/tasks/quick_start'").exactly(1).times
186
187
  subject.require_tasks
@@ -191,6 +192,7 @@ module Beaker
191
192
  allow(File).to receive(:readlines).with("Rakefile").and_return(["require 'beaker/tasks/quick_start'"])
192
193
  allow(File).to receive(:open).with("Rakefile", "a+").and_yield(file)
193
194
  allow(File).to receive(:puts).with("require 'beaker/tasks/quick_start'").and_return(true)
195
+ expect(FileUtils).to receive(:touch).with("Rakefile").exactly(1).times
194
196
  expect(File).to receive(:open).with("Rakefile", "a+").and_yield(file).exactly(0).times
195
197
  expect(file).to receive(:puts).with("require 'beaker/tasks/quick_start'").exactly(0).times
196
198
  subject.require_tasks
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.6'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: '11.2'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: '11.2'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: simplecov
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +178,20 @@ dependencies:
192
178
  - - ~>
193
179
  - !ruby/object:Gem::Version
194
180
  version: '2.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rake
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ~>
186
+ - !ruby/object:Gem::Version
187
+ version: '10.0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ~>
193
+ - !ruby/object:Gem::Version
194
+ version: '10.0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rsync
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -276,20 +276,6 @@ dependencies:
276
276
  - - ~>
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0.0'
279
- - !ruby/object:Gem::Dependency
280
- name: beaker-facter
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - ~>
284
- - !ruby/object:Gem::Version
285
- version: '0.0'
286
- type: :runtime
287
- prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
289
- requirements:
290
- - - ~>
291
- - !ruby/object:Gem::Version
292
- version: '0.0'
293
279
  - !ruby/object:Gem::Dependency
294
280
  name: beaker-hostgenerator
295
281
  requirement: !ruby/object:Gem::Requirement
@@ -545,6 +531,7 @@ files:
545
531
  - docs/concepts/shared_options_for_executing_beaker_commands.md
546
532
  - docs/concepts/style_guide.md
547
533
  - docs/concepts/test_tagging.md
534
+ - docs/concepts/testing_beaker_itself.md
548
535
  - docs/concepts/ticket_process.md
549
536
  - docs/concepts/types_puppet_4_and_the_all_in_one_agent.md
550
537
  - docs/how_to/access_the_live_test_console_with_pry.md
@@ -597,6 +584,7 @@ files:
597
584
  - lib/beaker/dsl.rb
598
585
  - lib/beaker/dsl/assertions.rb
599
586
  - lib/beaker/dsl/helpers.rb
587
+ - lib/beaker/dsl/helpers/facter_helpers.rb
600
588
  - lib/beaker/dsl/helpers/hocon_helpers.rb
601
589
  - lib/beaker/dsl/helpers/host_helpers.rb
602
590
  - lib/beaker/dsl/helpers/puppet_helpers.rb
@@ -707,6 +695,7 @@ files:
707
695
  - spec/beaker/command_spec.rb
708
696
  - spec/beaker/dsl/assertions_spec.rb
709
697
  - spec/beaker/dsl/ezbake_utils_spec.rb
698
+ - spec/beaker/dsl/helpers/facter_helpers_spec.rb
710
699
  - spec/beaker/dsl/helpers/host_helpers_spec.rb
711
700
  - spec/beaker/dsl/helpers/puppet_helpers_spec.rb
712
701
  - spec/beaker/dsl/helpers/test_helpers_spec.rb