beaker 2.19.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmIxNzA1NzI5Y2I5YjE1M2RkYTgyYTk3MTU1NDM5OWFmOWQ5YjRiMg==
4
+ ODkwNTk3ZWZmNDQ4MDc0YTVhYTk1OWJiYTU2Njc4YTAyYmM5NWUxZA==
5
5
  data.tar.gz: !binary |-
6
- NGM4MDNjNTAyYWM3MGE5ZmRiZjg4MTY3ZDRiMzhkMmI3NGI2ZWZiNQ==
6
+ NDU1Y2QzYzUyNGU0ZWM3YzI2MmNiNGM3M2M1YjIyOTllNjQ2YTg2NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjFkNTViOTBiM2NlZjhlMDQwMmJlYmI2ZmFmYWIxMGNmNTI3YjQ2NWEwMjk4
10
- YzMxNjE2MzI0NDU1OWFmY2FiYTY3OGI5YzljY2E2M2NlNzg0YWYyMzhmZTFk
11
- YjNjMmRhMzg2ZDVmZmNmNWEwYzAzODVjOTdlOWEzOTI2N2RiZDc=
9
+ MDAwZTY4MTZlNTQxMmMxNDVhMjRkOGVkYTQ2OGZhNjgzYjE2Y2FiNmY0ZGU2
10
+ Yzg0ZjI2OGY2ZjAzODQ2NjM0ZDczY2Y3OGYxMzM0NWI3YjM0MTgwNmJlZTRk
11
+ YmQ2NDcxNjI0ODA0Y2Q4NWEwYzYwYjk2Mzk5NGIyYTEzMTI1NDU=
12
12
  data.tar.gz: !binary |-
13
- ZTJjZTQwMzRjZjI0NTExMzM1MTU1ZDQzOTg3ZTVlMjUwNGQzZGI4NGVjYWU3
14
- MTAxYzFiZGVkMWIyZDcwZDc3NTBjMDg3NDBkNTMzMWQzNTEwY2QyYzJkMjdk
15
- YjViZWUzNWFkNGE4NWIwNmFkZmUyMTY4ZTE1NmRlNDhiYzg4NmM=
13
+ ZDQ1MGM4ZmY0YzY3MGMzNTVjNWExZGZlMTM0MmUxNmZhNDNhM2U0ODliNjg4
14
+ ZDRmNjcyNTJjMzg3MGJlNDE1YzZkOWEwMjE0ZDIzMTc1MjJmYzc2ZjlmZDQ2
15
+ ZmIwOTAwODVhYWUwNzdmMjQ0ODJmNTkzYjJmZTJjMWJkOWEwZWQ=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 13 Aug, 2015 (821aefba)](#LATEST)
3
+ * [LATEST - 17 Aug, 2015 (1d735a7a)](#LATEST)
4
+ * [2.19.0 - 13 Aug, 2015 (80897129)](#2.19.0)
4
5
  * [2.18.3 - 28 Jul, 2015 (d9a02474)](#2.18.3)
5
6
  * [2.18.2 - 27 Jul, 2015 (c84f6f23)](#2.18.2)
6
7
  * [2.18.1 - 14 Jul, 2015 (6a82f99f)](#2.18.1)
@@ -91,7 +92,100 @@
91
92
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
92
93
 
93
94
  ## Details
94
- ### <a name = "LATEST">LATEST - 13 Aug, 2015 (821aefba)
95
+ ### <a name = "LATEST">LATEST - 17 Aug, 2015 (1d735a7a)
96
+
97
+ * (GEM) update beaker version to 2.20.0 (1d735a7a)
98
+
99
+ * Merge pull request #925 from objectverbobject/BKR-448 (d76d2a4a)
100
+
101
+
102
+ ```
103
+ Merge pull request #925 from objectverbobject/BKR-448
104
+
105
+ (BKR-448) Check for connection object during host.close
106
+ ```
107
+ * Merge pull request #924 from anodelman/puppet-agent (ba4b3d4e)
108
+
109
+
110
+ ```
111
+ Merge pull request #924 from anodelman/puppet-agent
112
+
113
+ (BKR-447) Ubuntu PE puppet-agent urls not being generated correctly
114
+ ```
115
+ * Merge pull request #904 from dylanratcliffe/add-per-node-memory (cc3d716a)
116
+
117
+
118
+ ```
119
+ Merge pull request #904 from dylanratcliffe/add-per-node-memory
120
+
121
+ (BKR-423) Added the ability to set CPUs and memory per node
122
+ ```
123
+ * Merge pull request #923 from puppetlabs/bkr-428/change-assertion-in-teardown-behavior (5f60c353)
124
+
125
+
126
+ ```
127
+ Merge pull request #923 from puppetlabs/bkr-428/change-assertion-in-teardown-behavior
128
+
129
+ [BKR-428] gracefully handle assert failure in teardown
130
+ ```
131
+ * (BKR-448) Check for connection object during host.close (255f43f6)
132
+
133
+
134
+ ```
135
+ (BKR-448) Check for connection object during host.close
136
+
137
+ The close method for hosts assumed the connection object existed when
138
+ trying to set the hostname; this fix checks to ensure the connection
139
+ object exists prior to calling any methods on it.
140
+ ```
141
+ * (BKR-447) Ubuntu PE puppet-agent urls not being generated correctly (bb71b7ba)
142
+
143
+
144
+ ```
145
+ (BKR-447) Ubuntu PE puppet-agent urls not being generated correctly
146
+
147
+ - incorrectly adding additional '.' to ubuntu version strings that were
148
+ already correct
149
+ - added spec test to ensure correct behavior
150
+ - passed local testing
151
+ ```
152
+ * Merge pull request #922 from anodelman/many-names (334d63a8)
153
+
154
+
155
+ ```
156
+ Merge pull request #922 from anodelman/many-names
157
+
158
+ (BKR-446) add ability to identify a host by vmhostname/ip
159
+ ```
160
+ * (BKR-428) gracefully handle assert failure in teardown (f8b97d7b)
161
+
162
+
163
+ ```
164
+ (BKR-428) gracefully handle assert failure in teardown
165
+
166
+ Prior to this commit, if a teardown method ran code which contained assertions,
167
+ and an assertion failed, the exception raised by the assertion failure was
168
+ uncaught and beaker would crash.
169
+
170
+ This change treats the assertion failure as a test failure and allows beaker
171
+ to continue running.
172
+ ```
173
+ * (BKR-446) add ability to identify a host by vmhostname/ip (24ecdf4b)
174
+
175
+
176
+ ```
177
+ (BKR-446) add ability to identify a host by vmhostname/ip
178
+
179
+ - make it possible to run commands like:
180
+
181
+ on 'vmhostname', "command"
182
+ on '0.0.0.0', "command"
183
+ ```
184
+ * (BKR-423) Added the ability to set CPUs and memory per node (132b6b7e)
185
+
186
+ ### <a name = "2.19.0">2.19.0 - 13 Aug, 2015 (80897129)
187
+
188
+ * (HISTORY) update beaker history for gem release 2.19.0 (80897129)
95
189
 
96
190
  * (GEM) update beaker version to 2.19.0 (821aefba)
97
191
 
@@ -1203,7 +1203,7 @@ module Beaker
1203
1203
  if arch == 'x86_64'
1204
1204
  arch = 'amd64'
1205
1205
  end
1206
- version = version[0,2] + '.' + version[2,2] if variant =~ /ubuntu/ && version =~ /\.{0}/
1206
+ version = version[0,2] + '.' + version[2,2] if (variant =~ /ubuntu/ && !version.include?("."))
1207
1207
  release_file = "/repos/apt/#{codename}/pool/#{opts[:puppet_collection]}/p/puppet-agent/puppet-agent*#{arch}.deb"
1208
1208
  download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
1209
1209
  when /^windows$/
@@ -243,11 +243,13 @@ module Beaker
243
243
  end
244
244
 
245
245
  def close
246
- @connection.close if @connection
247
- # update connection information
248
- @connection.ip = self['ip'] if self['ip']
249
- @connection.vmhostname = self['vmhostname'] if self['vmhostname']
250
- @connection.hostname = @name
246
+ if @connection
247
+ @connection.close
248
+ # update connection information
249
+ @connection.ip = self['ip'] if self['ip']
250
+ @connection.vmhostname = self['vmhostname'] if self['vmhostname']
251
+ @connection.hostname = @name
252
+ end
251
253
  @connection = nil
252
254
  end
253
255
 
@@ -16,9 +16,13 @@ class Beaker::VagrantVirtualbox < Beaker::Vagrant
16
16
  end
17
17
 
18
18
  def self.provider_vfile_section(host, options)
19
+ # Allow memory and CPUs to be set at a per node level or overall, and take the most specific setting
20
+ host_memory = host['vagrant_memsize'] ? host['vagrant_memsize'] : (options['vagrant_memsize'] ? options['vagrant_memsize'] : 1024)
21
+ host_cpus = host['vagrant_cpus'] ? host['vagrant_cpus'] : (options['vagrant_cpus'] ? options['vagrant_cpus'] : 1)
22
+
19
23
  provider_section = ""
20
24
  provider_section << " v.vm.provider :virtualbox do |vb|\n"
21
- provider_section << " vb.customize ['modifyvm', :id, '--memory', '#{options['vagrant_memsize'] ||= '1024'}', '--cpus', '#{options['vagrant_cpus'] ||= '1'}']\n"
25
+ provider_section << " vb.customize ['modifyvm', :id, '--memory', '#{host_memory}', '--cpus', '#{host_cpus}']\n"
22
26
  provider_section << " vb.vbguest.auto_update = false" if options[:vbguest_plugin] == 'disable'
23
27
 
24
28
  # Guest volume support
@@ -17,13 +17,14 @@ module Beaker
17
17
  end
18
18
  end
19
19
 
20
- #Find hosts from a given array of hosts that all have the desired name.
20
+ #Find hosts from a given array of hosts that all have the desired name, match against host name,
21
+ #vmhostname and ip (the three valid ways to identify an individual host)
21
22
  #@param [Array<Host>] hosts The hosts to examine
22
- #@param [String] name The hosts returned will have this name
23
- #@return [Array<Host>] The hosts that have the desired name
23
+ #@param [String] name The hosts returned will have this name/vmhostname/ip
24
+ #@return [Array<Host>] The hosts that have the desired name/vmhostname/ip
24
25
  def hosts_with_name(hosts, name = nil)
25
26
  hosts.select do |host|
26
- name.nil? or host.name =~ /\A#{name}/
27
+ name.nil? or host.name =~ /\A#{name}/ or host[:vmhostname] =~ /\A#{name}/ or host[:ip] =~ /\A#{name}/
27
28
  end
28
29
  end
29
30
 
@@ -33,7 +33,7 @@ module Beaker
33
33
  # an instance of {Beaker::Logger}.
34
34
  attr_accessor :logger
35
35
 
36
- # Necessary for many methods in {Beaker::DSL::Helpers}. Assumed to be
36
+ # Necessary for many methods in {Beaker::DSL::Helpers}. Assumed to be
37
37
  # a hash.
38
38
  attr_accessor :metadata
39
39
 
@@ -139,7 +139,7 @@ module Beaker
139
139
  @teardown_procs.each do |teardown|
140
140
  begin
141
141
  teardown.call
142
- rescue StandardError, SignalException => e
142
+ rescue StandardError, SignalException, TEST_EXCEPTION_CLASS => e
143
143
  log_and_fail_test(e)
144
144
  end
145
145
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.19.0'
3
+ STRING = '2.20.0'
4
4
  end
5
5
  end
@@ -912,7 +912,7 @@ describe ClassMixedWithDSLInstallUtils do
912
912
 
913
913
  describe '#install_puppet_agent_pe_promoted_repo_on' do
914
914
 
915
- it 'splits the platform string version correctly to get ubuntu puppet-agent packages' do
915
+ it 'splits the platform string version correctly to get ubuntu puppet-agent packages (format 9999)' do
916
916
  platform = Object.new()
917
917
  allow(platform).to receive(:to_array) { ['ubuntu', '9999', 'x42']}
918
918
  host = basic_hosts.first
@@ -927,6 +927,21 @@ describe ClassMixedWithDSLInstallUtils do
927
927
  subject.install_puppet_agent_pe_promoted_repo_on( host, {} )
928
928
  end
929
929
 
930
+ it 'doesn\'t split the platform string version correctly to get ubuntu puppet-agent packages when unnecessary (format 99.99)' do
931
+ platform = Object.new()
932
+ allow(platform).to receive(:to_array) { ['ubuntu', '99.99', 'x42']}
933
+ host = basic_hosts.first
934
+ host['platform'] = platform
935
+
936
+ expect(subject).to receive(:fetch_http_file).once.with(/\/puppet-agent\//, "puppet-agent-ubuntu-99.99-x42.tar.gz", /ubuntu/)
937
+ expect(subject).to receive(:scp_to).once.with(host, /-ubuntu-99.99-x42\./, "/root")
938
+ expect(subject).to receive(:on).ordered.with(host, /^tar.*-ubuntu-99.99-x42/)
939
+ expect(subject).to receive(:on).ordered.with(host, /dpkg\ -i\ --force-all/)
940
+ expect(subject).to receive(:on).ordered.with(host, /apt-get\ update/)
941
+
942
+ subject.install_puppet_agent_pe_promoted_repo_on( host, {} )
943
+ end
944
+
930
945
  end
931
946
 
932
947
  describe '#install_cert_on_windows' do
@@ -649,5 +649,18 @@ module Beaker
649
649
  expect( "#{host}" ).to be === 'name'
650
650
  end
651
651
 
652
+ describe 'host close' do
653
+ context 'with a nil connection object' do
654
+ before do
655
+ conn = nil
656
+ host.instance_variable_set :@connection, conn
657
+ allow(host).to receive(:close).and_call_original
658
+ end
659
+ it 'does not raise an error' do
660
+ expect { host.close }.to_not raise_error
661
+ end
662
+ end
663
+ end
664
+
652
665
  end
653
666
  end
@@ -15,7 +15,44 @@ module Beaker
15
15
  hosts[2][:roles] = ['agent', role2]
16
16
  hosts }
17
17
 
18
- context "hosts_with_role" do
18
+ context "#hosts_with_name" do
19
+
20
+ it "can identify the host by name" do
21
+
22
+ expect( host_handler.hosts_with_name( hosts, 'vm1' )).to be === [hosts[0]]
23
+
24
+ end
25
+
26
+ it "can identify the host by vmhostname" do
27
+
28
+ hosts[0][:vmhostname] = 'myname.whatever'
29
+
30
+ expect( host_handler.hosts_with_name( hosts, 'myname.whatever' )).to be === [hosts[0]]
31
+
32
+ end
33
+
34
+ it "can identify the host by ip" do
35
+
36
+ hosts[0][:ip] = '0.0.0.0'
37
+
38
+ expect( host_handler.hosts_with_name( hosts, '0.0.0.0' )).to be === [hosts[0]]
39
+
40
+ end
41
+
42
+ it "returns [] when no match is found in a set of hosts" do
43
+
44
+ hosts[0][:ip] = '0.0.0.0'
45
+ hosts[0][:vmhostname] = 'myname.whatever'
46
+
47
+ expect( host_handler.hosts_with_name( hosts, 'surprise' )).to be === []
48
+
49
+ end
50
+
51
+
52
+
53
+ end
54
+
55
+ context "#hosts_with_role" do
19
56
  it "can find the master in a set of hosts" do
20
57
 
21
58
  expect( host_handler.hosts_with_role( hosts, 'master' ) ).to be === [hosts[1]]
@@ -36,7 +73,7 @@ module Beaker
36
73
 
37
74
  end
38
75
 
39
- context "only_host_with_role" do
76
+ context "#only_host_with_role" do
40
77
  it "can find the single master in a set of hosts" do
41
78
 
42
79
  expect( host_handler.only_host_with_role( hosts, 'master' ) ).to be === hosts[1]
@@ -56,7 +93,7 @@ module Beaker
56
93
  end
57
94
  end
58
95
 
59
- context "find_at_most_one_host_with_role" do
96
+ context "#find_at_most_one_host_with_role" do
60
97
  it "can find the single master in a set of hosts" do
61
98
 
62
99
  expect( host_handler.find_at_most_one_host_with_role( hosts, 'master' ) ).to be === hosts[1]
@@ -76,7 +113,7 @@ module Beaker
76
113
  end
77
114
  end
78
115
 
79
- context "run_block_on" do
116
+ context "#run_block_on" do
80
117
  it "can execute a block against hosts identified by a string" do
81
118
  myhosts = host_handler.run_block_on( hosts, role0 ) do |hosts|
82
119
  hosts
@@ -94,6 +94,20 @@ module Beaker
94
94
  expect( testcase ).to receive( :log_and_fail_test ).once.with(kind_of(Host::CommandFailure))
95
95
  testcase.run_test
96
96
  end
97
+
98
+ it 'records a test failure if an assertion fails in a teardown block' do
99
+ path = 'test.rb'
100
+ File.open(path, 'w') do |f|
101
+ f.write <<-EOF
102
+ teardown do
103
+ assert_equal(1, 2, 'Oh noes!')
104
+ end
105
+ EOF
106
+ end
107
+ @path = path
108
+ expect( testcase ).to receive( :log_and_fail_test ).once.with(kind_of(Minitest::Assertion))
109
+ testcase.run_test
110
+ end
97
111
  end
98
112
 
99
113
  context 'metadata' do
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: 2.19.0
4
+ version: 2.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec