beaker 2.30.1 → 2.31.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
- YmI0MWU4ZDExZjIzYjg0OGExZDg5Mzk3NTI0ZWM2MTM1MmM4YTZkMA==
4
+ YTVhYzY3M2U5ZTcxZWY2MzU4MjExNmZjMjZkMGUwZDQ3ZGI5OGIyNA==
5
5
  data.tar.gz: !binary |-
6
- ZGRlY2RhZDJkNTkxYmM0NGM0MTM1NTBmZWQ1OWU1MDJjNDU2NjdjMQ==
6
+ NzFlNDFlZjk3NGE0MTNiMTcxYWVmNzY1YWNkYTc3YjQ2MTM1OGM2MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWE2ODkwNWNkNWZkMDlmMGE1ZTg2N2M2ZmEzNmFlYWExMzE2ZmMwY2EyNjBm
10
- MmE4ZjFkNmZkZDg3MjYxNjg0Y2JhMzE4Y2Y2YmE2ZmU1NTQ3ZjJhMjA2NjYx
11
- ZmI3YjM2MGZiNGY1NmYwZjE4NTBiYjlhYmUyYjI0ODliM2VmZDg=
9
+ ZGFmOGI0Yjc3MzViMDE0MGU3ODBjZDA4ZDNmM2ExZDQ1NDZmODA2NWEwNDk3
10
+ N2YyYjM1NmNmNTY1Y2RjN2E3ZjU5ZDQ0ODVkYjJlYTBhMmU4M2JhMmRlMDBj
11
+ MzU3MGZiYzJiOTIzNGJiYTIxZTZjYzgxOWViY2E2NTUyOGJhYjU=
12
12
  data.tar.gz: !binary |-
13
- M2NjZDI3MTVlMGZkZGNlYThlYWRmMTcwODlkNjhkMzJhYjAxNDIyMmNiYTFh
14
- NGM4YWRmNTcwNTNjYjAzZmMzYWMxMWJjYzU3YWQ5YjdlNTFiYTVhYjc2NzU5
15
- YzViMjAyNDcyOTQ2NTIxMWMzYTQ1YzFmNTgzMjRhMWFhYzgyMjA=
13
+ NGZhNDUwMmIxZjhiOWIxNTkzOTAyMzA2MGZmZGQyOGI2ZDJjZjBhMDc4NmUw
14
+ YjAwMGE3ZDc3ZmJmYzE1MmVmODY1YTEwOTJlYjg5ZGNmYWE4ZGNiYTI1M2U4
15
+ Zjk2ODhlZTRlZDgzN2E5MDg3ODhkYzBlNjgxM2MwZTZhNGI0NDE=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 3 Dec, 2015 (a1ee5206)](#LATEST)
3
+ * [LATEST - 16 Dec, 2015 (da1729b0)](#LATEST)
4
+ * [2.30.1 - 3 Dec, 2015 (9f1376ef)](#2.30.1)
4
5
  * [2.30.0 - 2 Dec, 2015 (dbb72630)](#2.30.0)
5
6
  * [2.29.1 - 23 Nov, 2015 (5d824690)](#2.29.1)
6
7
  * [2.29.0 - 18 Nov, 2015 (33fd2399)](#2.29.0)
@@ -104,7 +105,193 @@
104
105
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
105
106
 
106
107
  ## Details
107
- ### <a name = "LATEST">LATEST - 3 Dec, 2015 (a1ee5206)
108
+ ### <a name = "LATEST">LATEST - 16 Dec, 2015 (da1729b0)
109
+
110
+ * (GEM) update beaker version to 2.31.0 (da1729b0)
111
+
112
+ * Revert "Added netscaler platform" (112ef320)
113
+
114
+
115
+ ```
116
+ Revert "Added netscaler platform"
117
+
118
+ This reverts commit 6a2abd36fe5b36db163582b12dca11b5cd018c7f.
119
+ ```
120
+ * Added netscaler platform (6a2abd36)
121
+
122
+ * Merge pull request #1034 from erikPrime/(BKR-237)_disable_updates.puppetlabs.com (23bc8f94)
123
+
124
+
125
+ ```
126
+ Merge pull request #1034 from erikPrime/(BKR-237)_disable_updates.puppetlabs.com
127
+
128
+ (BKR-237) disable updates.puppetlabs.com
129
+ ```
130
+ * (BKR-237) fixed option & updated tests (85a99ef8)
131
+
132
+ * Merge pull request #1033 from kevpl/bkr647_windows_pkgcygwin (e0d06f7f)
133
+
134
+
135
+ ```
136
+ Merge pull request #1033 from kevpl/bkr647_windows_pkgcygwin
137
+
138
+ (BKR-647) windows.install_package now uses SSL cygwin URL with fallback
139
+ ```
140
+ * (BKR-237) mods in response to review (af321acf)
141
+
142
+ * (MAINT) fix spec test for set_etc_hosts (cf6dc589)
143
+
144
+ * (MAINT) makes set_etc_hosts APPEND instead of REPLACE (09cbdf77)
145
+
146
+ * (BKR-237) updates.puppetlabs.com resolves to 127.0.0.1 (a78ee042)
147
+
148
+ * Merge pull request #1031 from kevpl/bkr642_aix_fix (ab4ebd1d)
149
+
150
+
151
+ ```
152
+ Merge pull request #1031 from kevpl/bkr642_aix_fix
153
+
154
+ (BKR-642) include aix exec, error checking to unix exec
155
+ ```
156
+ * Merge pull request #1032 from kevpl/bkr628_mac_group (2c79ac19)
157
+
158
+
159
+ ```
160
+ Merge pull request #1032 from kevpl/bkr628_mac_group
161
+
162
+ (BKR-628) fixed mac group_present check
163
+ ```
164
+ * (BKR-647) windows.install_package now uses SSL cygwin URL with fallback (95bf615b)
165
+
166
+ * Merge pull request #1025 from ody/add_privatebindir_to_path (6e7333f5)
167
+
168
+
169
+ ```
170
+ Merge pull request #1025 from ody/add_privatebindir_to_path
171
+
172
+ Add privatebindir to PATH
173
+ ```
174
+ * (BKR-628) fixed mac group_present check (35b12e53)
175
+
176
+ * Merge pull request #1029 from kevpl/bkr569_fetch_nocache (3ffd8b42)
177
+
178
+
179
+ ```
180
+ Merge pull request #1029 from kevpl/bkr569_fetch_nocache
181
+
182
+ (BKR-569) added caching disable option
183
+ ```
184
+ * (BKR-642) include aix exec, error checking to unix exec (7ba2bf64)
185
+
186
+ * Merge pull request #1026 from ody/reorder_permiteuserenv (77581a29)
187
+
188
+
189
+ ```
190
+ Merge pull request #1026 from ody/reorder_permiteuserenv
191
+
192
+ Swap the placement of PermiteUserEnvironment
193
+ ```
194
+ * Merge pull request #1030 from kevpl/bkr626_puppetagent_docs (7173bd15)
195
+
196
+
197
+ ```
198
+ Merge pull request #1030 from kevpl/bkr626_puppetagent_docs
199
+
200
+ (BKR-626) added puppet-agent doc links
201
+ ```
202
+ * Merge pull request #1018 from sathlan/feature/add_memory_option_to_vagrant_libvirt (91621239)
203
+
204
+
205
+ ```
206
+ Merge pull request #1018 from sathlan/feature/add_memory_option_to_vagrant_libvirt
207
+
208
+ (BKR-631) Add memory option to vagrant libvirt.
209
+ ```
210
+ * (BKR-626) added puppet-agent doc links (dee654e4)
211
+
212
+ * (BKR-569) added caching disable option (1cf628e4)
213
+
214
+ * Merge pull request #1028 from joshcooper/ticket/master/BKR-644-fedora-puppet-agent-dev-repo (a6e41cc1)
215
+
216
+
217
+ ```
218
+ Merge pull request #1028 from joshcooper/ticket/master/BKR-644-fedora-puppet-agent-dev-repo
219
+
220
+ (BKR-644) Prepend 'f' to the fedora version
221
+ ```
222
+ * Merge pull request #1027 from bmjen/fix-solaris (3df53898)
223
+
224
+
225
+ ```
226
+ Merge pull request #1027 from bmjen/fix-solaris
227
+
228
+ (maint) Fix typo in solaris install_pe util function.
229
+ ```
230
+ * (BKR-644) Prepend 'f' to the fedora version (1b15425d)
231
+
232
+
233
+ ```
234
+ (BKR-644) Prepend 'f' to the fedora version
235
+
236
+ Previously, install_puppet_agent_dev_repo_on did not work for fedora,
237
+ because we were constructing a URL of the form:
238
+
239
+ http://<host>/puppet-agent/<sha>/repos/fedora/22/PC1/x86_64/puppet-agent-1.3.2-1.fedora22.x86_64.rpm
240
+
241
+ However, we unfortunately prepend 'f' to the version string when
242
+ publishing the package, see RE-4191.
243
+
244
+ This commit prepends an 'f' to the version string for fedora-only, so
245
+ the new URL is:
246
+
247
+ http://<host>/puppet-agent/<sha>/repos/fedora/f22/PC1/x86_64/puppet-agent-1.3.2-1.fedoraf22.x86_64.rpm
248
+
249
+ Note f22 appears in two places, "fedora/f22" and
250
+ "puppet-agent...-fedoraf22.x86_64.rpm"
251
+ ```
252
+ * (maint) Fix typo in solaris install_pe util function. (3e68260a)
253
+
254
+ * (MAINT) Swap placement of PermitUserEnvironment (2cb7f6d6)
255
+
256
+
257
+ ```
258
+ (MAINT) Swap placement of PermitUserEnvironment
259
+
260
+ This commit will rework the way PermiteUserEnvironment is added to
261
+ sshd_config by putting it at the top of the file.
262
+
263
+ Without this commit you will create a bad sshd_config if your sut's
264
+ base image containes matching blocks the end of its sshd_config
265
+ because the PermitUserEnvironment option is not allowed there. This
266
+ ordering is likely perferred since it is generally the norm to put
267
+ matching blocks at the end of the sshd_config.
268
+ ```
269
+ * (MAINT) Add privatebindir to PATH (5e45c1f1)
270
+
271
+
272
+ ```
273
+ (MAINT) Add privatebindir to PATH
274
+
275
+ This commit will add privatebindir to the list of paths added to the
276
+ PATH variable stored in ~/.ssh/environment.
277
+
278
+ This needs to happen so that the gem command and any excutables
279
+ installed using that gem command are available for use during a suite.
280
+ A requirement if your suite deploys dependencies with r10k on both aio
281
+ and foss agent types.
282
+ ```
283
+ * (BKR-631) Add memory option to vagrant libvirt. (349501e0)
284
+
285
+
286
+ ```
287
+ (BKR-631) Add memory option to vagrant libvirt.
288
+
289
+ This add the possibility to specify the memory for each host separately
290
+ or for every host.
291
+ ```
292
+ ### <a name = "2.30.1">2.30.1 - 3 Dec, 2015 (9f1376ef)
293
+
294
+ * (HISTORY) update beaker history for gem release 2.30.1 (9f1376ef)
108
295
 
109
296
  * (GEM) update beaker version to 2.30.1 (a1ee5206)
110
297
 
@@ -47,7 +47,7 @@ module Beaker
47
47
  base_url.chomp!('/')
48
48
  src = "#{base_url}/#{file_name}"
49
49
  dst = File.join(dst_dir, file_name)
50
- if File.exists?(dst)
50
+ if options[:cache_files_locally] && File.exists?(dst)
51
51
  logger.notify "Already fetched #{dst}"
52
52
  else
53
53
  logger.notify "Fetching: #{src}"
@@ -1112,6 +1112,7 @@ module Beaker
1112
1112
  release_path << release_path_end
1113
1113
  when /^(fedora|el|centos|sles)$/
1114
1114
  variant = ((variant == 'centos') ? 'el' : variant)
1115
+ version = ((variant == 'fedora') ? "f#{version}" : version)
1115
1116
  release_path << "#{variant}/#{version}/#{opts[:puppet_collection]}/#{arch}"
1116
1117
  release_file = "puppet-agent-#{opts[:puppet_agent_version]}-1.#{variant}#{version}.#{arch}.rpm"
1117
1118
  when /^(aix)$/
@@ -1343,7 +1344,7 @@ NOASK
1343
1344
  arch = 'i386'
1344
1345
  end
1345
1346
  release_file = "/repos/solaris/#{version}/#{opts[:puppet_collection]}/puppet-agent-*#{arch}.pkg.gz"
1346
- download_file = "puppet-agent-#{varant}-#{version}-#{arch}.tar.gz"
1347
+ download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
1347
1348
  else
1348
1349
  raise "No pe-promoted installation step for #{variant} yet..."
1349
1350
  end
@@ -327,6 +327,9 @@ module Beaker
327
327
  # @note on windows, the +:ruby_arch+ host parameter can determine in addition
328
328
  # to other settings whether the 32 or 64bit install is used
329
329
  #
330
+ # @note for puppet-agent install options, refer to
331
+ # {Beaker::DSL::InstallUtils::FOSSUtils#install_puppet_agent_pe_promoted_repo_on}
332
+ #
330
333
  # @api private
331
334
  #
332
335
  def do_install hosts, opts = {}
@@ -548,6 +551,9 @@ module Beaker
548
551
  # Install file names are assumed to be of the format puppet-enterprise-VERSION-PLATFORM.(tar)|(tar.gz)
549
552
  # for Unix like systems and puppet-enterprise-VERSION.msi for Windows systems.
550
553
  #
554
+ # @note For further installation parameters (such as puppet-agent install)
555
+ # options, refer to {#do_install} documentation
556
+ #
551
557
  def install_pe_on(install_hosts, opts)
552
558
  confine_block(:to, {}, install_hosts) do
553
559
  sorted_hosts.each do |host|
@@ -35,7 +35,7 @@ module Beaker
35
35
  #Given a host construct a PATH that includes puppetbindir, facterbindir and hierabindir
36
36
  # @param [Host] host A single host to construct pathing for
37
37
  def construct_puppet_path(host)
38
- path = (%w(puppetbindir facterbindir hierabindir)).compact.reject(&:empty?)
38
+ path = (%w(puppetbindir privatebindir facterbindir hierabindir)).compact.reject(&:empty?)
39
39
  #get the PATH defaults
40
40
  path.map! { |val| host[val] }
41
41
  path = path.compact.reject(&:empty?)
@@ -3,6 +3,9 @@ require 'timeout'
3
3
  require 'benchmark'
4
4
  require 'rsync'
5
5
 
6
+ require 'beaker/dsl/helpers'
7
+ require 'beaker/dsl/patterns'
8
+
6
9
  [ 'command', 'ssh_connection'].each do |lib|
7
10
  require "beaker/#{lib}"
8
11
  end
@@ -11,6 +14,9 @@ module Beaker
11
14
  class Host
12
15
  SELECT_TIMEOUT = 30
13
16
 
17
+ include Beaker::DSL::Helpers
18
+ include Beaker::DSL::Patterns
19
+
14
20
  class CommandFailure < StandardError; end
15
21
 
16
22
  # This class provides array syntax for using puppet --configprint on a host
@@ -4,13 +4,14 @@ end
4
4
 
5
5
  module Aix
6
6
  class Host < Unix::Host
7
- [ 'user', 'group', 'file' ].each do |lib|
7
+ [ 'user', 'group', 'file', 'exec' ].each do |lib|
8
8
  require "beaker/host/aix/#{lib}"
9
9
  end
10
10
 
11
11
  include Aix::User
12
12
  include Aix::Group
13
13
  include Aix::File
14
+ include Aix::Exec
14
15
 
15
16
  end
16
17
  end
@@ -66,7 +66,7 @@ module Mac::Group
66
66
  # @param [Proc] block Additional actions or insertions
67
67
  def group_present(name, &block)
68
68
  group_exists = false
69
- execute("dscacheutil -q user -a name #{name}") do |result|
69
+ execute("dscacheutil -q group -a name #{name}") do |result|
70
70
  group_exists = result.stdout =~ /^name: #{name}/
71
71
  end
72
72
 
@@ -176,6 +176,8 @@ module Unix::Exec
176
176
  exec(Beaker::Command.new("svcadm restart svc:/network/ssh:default"))
177
177
  when /(free|open)bsd/
178
178
  exec(Beaker::Command.new("sudo /etc/rc.d/sshd restart"))
179
+ else
180
+ raise ArgumentError, "Unsupported Platform: '#{self['platform']}'"
179
181
  end
180
182
  end
181
183
 
@@ -187,19 +189,31 @@ module Unix::Exec
187
189
  def ssh_permit_user_environment
188
190
  case self['platform']
189
191
  when /debian|ubuntu|cumulus/
190
- exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
192
+ directory = create_tmpdir_on(self)
193
+ exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
194
+ exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
191
195
  when /el-7|centos-7|redhat-7|oracle-7|scientific-7|eos-7/
192
- exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
196
+ directory = create_tmpdir_on(self)
197
+ exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
198
+ exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
193
199
  when /el-|centos|fedora|redhat|oracle|scientific|eos/
194
- exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
200
+ directory = create_tmpdir_on(self)
201
+ exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
202
+ exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
195
203
  when /sles/
196
- exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
204
+ directory = create_tmpdir_on(self)
205
+ exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
206
+ exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
197
207
  when /solaris/
198
208
  # kept solaris here because refactoring it into its own Host module
199
209
  # conflicts with the solaris hypervisor that already exists
200
- exec(Beaker::Command.new("echo '\nPermitUserEnvironment yes' >> /etc/ssh/sshd_config"))
210
+ directory = create_tmpdir_on(self)
211
+ exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
212
+ exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
201
213
  when /(free|open)bsd/
202
214
  exec(Beaker::Command.new("sudo perl -pi -e 's/^#?PermitUserEnvironment no/PermitUserEnvironment yes/' /etc/ssh/sshd_config"), {:pty => true} )
215
+ else
216
+ raise ArgumentError, "Unsupported Platform: '#{self['platform']}'"
203
217
  end
204
218
 
205
219
  ssh_service_restart()
@@ -26,7 +26,13 @@ module Windows::Pkg
26
26
  end
27
27
 
28
28
  if not check_for_command(cygwin)
29
- execute("curl --retry 5 http://cygwin.com/#{cygwin} -o /cygdrive/c/Windows/System32/#{cygwin}")
29
+ command = "curl --retry 5 https://cygwin.com/#{cygwin} -o /cygdrive/c/Windows/System32/#{cygwin}"
30
+ begin
31
+ execute(command)
32
+ rescue Beaker::Host::CommandFailure
33
+ command.sub!('https', 'http')
34
+ execute(command)
35
+ end
30
36
  end
31
37
  execute("#{cygwin} -q -n -N -d -R #{cmdline_args} #{rootdir} -s http://cygwin.osuosl.org -P #{name}")
32
38
  end
@@ -323,7 +323,7 @@ module Beaker
323
323
  if host['platform'] =~ /freebsd/
324
324
  host.echo_to_file(etc_hosts, '/etc/hosts')
325
325
  else
326
- host.exec(Command.new("echo '#{etc_hosts}' > /etc/hosts"))
326
+ host.exec(Command.new("echo '#{etc_hosts}' >> /etc/hosts"))
327
327
  end
328
328
  end
329
329
 
@@ -377,6 +377,17 @@ module Beaker
377
377
  end
378
378
  end
379
379
 
380
+ # Update /etc/hosts to make updates.puppetlabs.com (aka the dujour server) resolve to 127.0.01,
381
+ # so that we don't pollute the server with test data. See SERVER-1000, BKR-182, BKR-237, DJ-10
382
+ # for additional details.
383
+ def disable_updates hosts, opts
384
+ logger = opts[:logger]
385
+ hosts.each do |host|
386
+ logger.notify "Disabling updates.puppetlabs.com by modifying hosts file to resolve updates to 127.0.0.1 on #{host}"
387
+ set_etc_hosts(host, "127.0.0.1\tupdates.puppetlabs.com\n")
388
+ end
389
+ end
390
+
380
391
  # Update sshd_config on debian, ubuntu, centos, el, redhat, cumulus, and fedora boxes to allow for root login
381
392
  #
382
393
  # Does nothing on other platfoms.
@@ -118,6 +118,9 @@ module Beaker
118
118
  if @options[:set_env]
119
119
  set_env(@hosts, @options)
120
120
  end
121
+ if @options[:disable_updates]
122
+ disable_updates(@hosts, @options)
123
+ end
121
124
  end
122
125
 
123
126
  #Default validation steps to be run for a given hypervisor. Ensures that SUTs meet requirements to be
@@ -1,11 +1,31 @@
1
1
  require 'beaker/hypervisor/vagrant'
2
2
 
3
3
  class Beaker::VagrantLibvirt < Beaker::Vagrant
4
+ @memory = nil
5
+
6
+ class << self
7
+ attr_reader :memory
8
+ end
9
+
4
10
  def provision(provider = 'libvirt')
5
11
  super
6
12
  end
7
13
 
8
14
  def self.provider_vfile_section(host, options)
9
- " v.vm.provider :libvirt"
15
+ " v.vm.provider :libvirt do |node|\n" +
16
+ " node.memory = #{memory(host, options)}\n" +
17
+ " end\n"
18
+ end
19
+
20
+ def self.memory(host, options)
21
+ return @memory unless @memory.nil?
22
+ @memory = case
23
+ when host['vagrant_memsize']
24
+ host['vagrant_memsize']
25
+ when options['vagrant_memsize']
26
+ options['vagrant_memsize']
27
+ else
28
+ '512'
29
+ end
10
30
  end
11
31
  end
@@ -161,6 +161,7 @@ module Beaker
161
161
  :timesync => false,
162
162
  :disable_iptables => false,
163
163
  :set_env => true,
164
+ :disable_updates => true,
164
165
  :repo_proxy => false,
165
166
  :package_proxy => false,
166
167
  :add_el_extras => false,
@@ -185,6 +186,7 @@ module Beaker
185
186
  :puppetdb_port_nonssl => 8080,
186
187
  :puppetserver_port => 8140,
187
188
  :nodeclassifier_port => 4433,
189
+ :cache_files_locally => true, # TODO change to false in next major version
188
190
  :aws_keyname_modifier => rand(10 ** 10).to_s.rjust(10,'0'), # 10 digit random number string
189
191
  :ssh => {
190
192
  :config => false,
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.30.1'
3
+ STRING = '2.31.0'
4
4
  end
5
5
  end
@@ -13,13 +13,19 @@ class ClassMixedWithDSLHelpers
13
13
  end
14
14
 
15
15
  describe ClassMixedWithDSLHelpers do
16
+ let( :logger ) { double("Beaker::Logger", :notify => nil , :debug => nil ) }
17
+ let( :url ) { "http://beaker.tool" }
18
+ let( :name ) { "name" }
19
+ let( :destdir ) { "destdir" }
16
20
 
17
21
  def fetch_allows
18
- allow(subject).to receive( :logger ) { logger }
22
+ allow( subject ).to receive( :logger ) { logger }
23
+ allow( subject ).to receive( :options ) { options }
19
24
  end
20
25
 
21
26
  describe "#fetch_http_file" do
22
- let( :logger) { double("Beaker::Logger", :notify => nil , :debug => nil ) }
27
+ let( :presets ) { Beaker::Options::Presets.new }
28
+ let( :options ) { presets.presets.merge(presets.env_vars) }
23
29
 
24
30
  before do
25
31
  fetch_allows
@@ -28,9 +34,21 @@ describe ClassMixedWithDSLHelpers do
28
34
  describe "given valid arguments" do
29
35
 
30
36
  it "returns its second and third arguments concatenated." do
31
- create_files(['destdir/name'])
32
- result = subject.fetch_http_file "http://beaker.tool", "name", "destdir"
33
- expect(result).to eq("destdir/name")
37
+ concat_path = "#{destdir}/#{name}"
38
+ create_files([concat_path])
39
+ expect( logger ).to receive( :notify ).with( /^Already\ fetched\ / )
40
+ result = subject.fetch_http_file url, name, destdir
41
+ expect(result).to eq(concat_path)
42
+ end
43
+
44
+ it 'doesn\'t cache if :cache_files_locally set false' do
45
+ options[:cache_files_locally] = false
46
+
47
+ expect( logger ).to receive( :notify ).with( /^Fetching/ ).ordered
48
+ expect( logger ).to receive( :notify ).with( /^\ \ and\ saving\ to\ / ).ordered
49
+ expect( subject ).to receive( :open )
50
+
51
+ subject.fetch_http_file( url, name, destdir )
34
52
  end
35
53
 
36
54
  end
@@ -38,8 +56,8 @@ describe ClassMixedWithDSLHelpers do
38
56
  describe 'given invalid arguments' do
39
57
 
40
58
  it 'chomps correctly when given a URL ending with a / character' do
41
- expect( subject ).to receive( :open ).with( 'http://beaker.tool/name', anything )
42
- subject.fetch_http_file( "http://beaker.tool/", "name", "destdir" )
59
+ expect( subject ).to receive( :open ).with( "#{url}/#{name}", anything )
60
+ subject.fetch_http_file( url, name, destdir )
43
61
  end
44
62
 
45
63
  end
@@ -59,8 +77,8 @@ describe ClassMixedWithDSLHelpers do
59
77
  it "returns basename of first argument concatenated to second." do
60
78
  expect(subject).to receive(:`).with(/^wget.*/).ordered { result }
61
79
  expect($?).to receive(:to_i).and_return(0)
62
- result = subject.fetch_http_dir "http://beaker.tool/beep", "destdir"
63
- expect(result).to eq("destdir/beep")
80
+ result = subject.fetch_http_dir "#{url}/beep", destdir
81
+ expect(result).to eq("#{destdir}/beep")
64
82
  end
65
83
 
66
84
  end
@@ -882,6 +882,21 @@ describe ClassMixedWithDSLInstallUtils do
882
882
  subject.install_puppet_agent_dev_repo_on( host, opts )
883
883
  end
884
884
 
885
+ it 'prepends f to the version in the URL and rpm' do
886
+ platform = Object.new()
887
+ allow(platform).to receive(:to_array) { ['fedora', '22', 'x4']}
888
+ host = basic_hosts.first
889
+ host['platform'] = platform
890
+ opts = { :version => '0.1.0' }
891
+ allow( subject ).to receive( :options ).and_return( {} )
892
+
893
+ expect(subject).to receive(:fetch_http_file).once.with(/\/fedora\/f22\//, /-agent-0.1.0-1.fedoraf22/, /fedora/)
894
+ expect(subject).to receive(:scp_to).once.with(host, /puppet-agent-0.1.0-1.fedoraf22.x4.rpm/, "/root")
895
+ expect(subject).to receive(:on).ordered.with(host, /rpm -ivh/)
896
+
897
+ subject.install_puppet_agent_dev_repo_on( host, opts )
898
+ end
899
+
885
900
  it 'runs the correct install for windows platforms' do
886
901
  platform = Object.new()
887
902
  allow(platform).to receive(:to_array) { ['windows', '5', 'x64']}
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ module Aix
4
+ describe Host do
5
+ let(:options) { @options ? @options : {} }
6
+ let(:platform) {
7
+ if @platform
8
+ { :platform => Beaker::Platform.new( @platform) }
9
+ else
10
+ { :platform => Beaker::Platform.new( 'aix-vers-arch-extra' ) }
11
+ end
12
+ }
13
+ let(:host) { make_host( 'name', options.merge(platform) ) }
14
+
15
+ describe '#ssh_service_restart' do
16
+ it 'invokes the correct commands on the host' do
17
+ expect( Beaker::Command ).to receive( :new ).with( 'stopsrc -g ssh' ).once.ordered
18
+ expect( Beaker::Command ).to receive( :new ).with( 'startsrc -g ssh' ).once.ordered
19
+ host.ssh_service_restart
20
+ end
21
+ end
22
+
23
+ describe '#ssh_permit_user_environment' do
24
+ it 'calls echo to set PermitUserEnvironment' do
25
+ expect( Beaker::Command ).to receive( :new ).with( /^echo\ / ).once.ordered
26
+ allow( host ).to receive( :ssh_service_restart )
27
+ host.ssh_permit_user_environment
28
+ end
29
+
30
+ it 'uses the correct ssh config file' do
31
+ expect( Beaker::Command ).to receive( :new ).with( /#{Regexp.escape(' >> /etc/ssh/sshd_config')}$/ ).once
32
+ allow( host ).to receive( :ssh_service_restart )
33
+ host.ssh_permit_user_environment
34
+ end
35
+ end
36
+
37
+ describe '#reboot' do
38
+ it 'invokes the correct command on the host' do
39
+ expect( Beaker::Command ).to receive( :new ).with( 'shutdown -Fr' ).once
40
+ host.reboot
41
+ end
42
+ end
43
+
44
+ describe '#get_ip' do
45
+ it 'invokes the correct command on the host' do
46
+ expect( host ).to receive( :execute ).with( /^ifconfig\ \-a\ inet\|\ / ).once.and_return( '' )
47
+ host.get_ip
48
+ end
49
+ end
50
+ end
51
+ end
@@ -86,6 +86,7 @@ EOS
86
86
  it 'returns group existence without running create command if it already exists' do
87
87
  result.stdout = puppet1
88
88
  expect( subject ).to receive( :execute ).once.and_yield(result)
89
+ expect( subject ).not_to receive( :gid_next )
89
90
  subject.group_present( 'puppet1' )
90
91
  end
91
92
 
@@ -100,6 +101,15 @@ EOS
100
101
  subject.group_present( name )
101
102
  end
102
103
 
104
+ it 'makes the correct call to dscacheutil' do
105
+ result.stdout = puppet1
106
+ expect( subject ).to receive( :execute ).with(
107
+ /^dscacheutil\ \-q\ group\ \-a\ name\ /
108
+ ).once.and_yield(result)
109
+ expect( subject ).not_to receive( :gid_next )
110
+ subject.group_present( 'puppet1' )
111
+ end
112
+
103
113
  end
104
114
 
105
115
  describe '#group_absent' do
@@ -49,5 +49,23 @@ module Beaker
49
49
  expect( instance.mv(origin, destination, false) ).to be === 0
50
50
  end
51
51
  end
52
+
53
+ describe '#ssh_permit_user_environment' do
54
+ it 'raises an error on unsupported platforms' do
55
+ opts['platform'] = 'notarealthing01-parts-arch'
56
+ expect {
57
+ instance.ssh_permit_user_environment
58
+ }.to raise_error( ArgumentError, /#{opts['platform']}/ )
59
+ end
60
+ end
61
+
62
+ describe '#ssh_service_restart' do
63
+ it 'raises an error on unsupported platforms' do
64
+ opts['platform'] = 'notarealthing02-parts-arch'
65
+ expect {
66
+ instance.ssh_service_restart
67
+ }.to raise_error( ArgumentError, /#{opts['platform']}/ )
68
+ end
69
+ end
52
70
  end
53
71
  end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe Windows::Pkg do
5
+ class WindowsPkgTest
6
+ include Windows::Pkg
7
+
8
+ def initialize(hash, logger)
9
+ @hash = hash
10
+ @logger = logger
11
+ end
12
+
13
+ def [](k)
14
+ @hash[k]
15
+ end
16
+
17
+ def to_s
18
+ "me"
19
+ end
20
+
21
+ def exec
22
+ #noop
23
+ end
24
+
25
+ end
26
+
27
+ let (:opts) { @opts || {} }
28
+ let (:logger) { double( 'logger' ).as_null_object }
29
+ let (:instance) { WindowsPkgTest.new(opts, logger) }
30
+
31
+ describe '#install_package' do
32
+ before :each do
33
+ allow( instance ).to receive( :identify_windows_architecture )
34
+ end
35
+
36
+ context 'cygwin does not exist' do
37
+ before :each do
38
+ allow( instance ).to receive( :check_for_command ).and_return( false )
39
+ end
40
+
41
+ it 'curls the SSL URL for cygwin\'s installer' do
42
+ expect( instance ).to receive( :execute ).with( /^curl.*https\:/ ).ordered
43
+ allow( instance ).to receive( :execute ).with( /^setup\-x86/ ).ordered
44
+ instance.install_package( 'curl' )
45
+ end
46
+
47
+ it 'falls back to the non-SSL URL if that one fails' do
48
+ allow( instance ).to receive( :execute ).with( /^curl.*https\:/ ).and_raise( Beaker::Host::CommandFailure ).ordered
49
+ expect( instance ).to receive( :execute ).with( /^curl.*http\:/ ).ordered
50
+ allow( instance ).to receive( :execute ).with( /^setup\-x86/ ).ordered
51
+ instance.install_package( 'curl' )
52
+ end
53
+ end
54
+ end
55
+
56
+ end
57
+ end
@@ -456,7 +456,7 @@ describe Beaker do
456
456
  host = make_host('name', {})
457
457
  etc_hosts = "127.0.0.1 localhost\n192.168.2.130 pe-ubuntu-lucid\n192.168.2.128 pe-centos6\n192.168.2.131 pe-debian6"
458
458
 
459
- expect( Beaker::Command ).to receive( :new ).with( "echo '#{etc_hosts}' > /etc/hosts" ).once
459
+ expect( Beaker::Command ).to receive( :new ).with( "echo '#{etc_hosts}' >> /etc/hosts" ).once
460
460
  expect( host ).to receive( :exec ).once
461
461
 
462
462
  subject.set_etc_hosts(host, etc_hosts)
@@ -89,6 +89,22 @@ module Beaker
89
89
  end
90
90
  end
91
91
 
92
+ context "if :disable_updates option set true" do
93
+ it "calls disable_updates" do
94
+ options[:disable_updates] = true
95
+ expect( hypervisor ).to receive( :disable_updates ).once
96
+ hypervisor.configure
97
+ end
98
+ end
99
+
100
+ context "if :disable_updates option set false" do
101
+ it "does not call disable_updates_puppetlabs_com" do
102
+ options[:disable_updates] = false
103
+ expect( hypervisor ).to receive( :disable_updates ).never
104
+ hypervisor.configure
105
+ end
106
+ end
107
+
92
108
  context 'if :configure option set false' do
93
109
  it 'does not make any configure calls' do
94
110
  options[:configure] = false
@@ -21,14 +21,23 @@ describe Beaker::VagrantLibvirt do
21
21
  vagrant.provision
22
22
  end
23
23
 
24
- it "can make a Vagranfile for a set of hosts" do
25
- FakeFS.activate!
26
- path = vagrant.instance_variable_get( :@vagrant_path )
27
- allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
24
+ context 'Correct vagrant configuration' do
25
+ before(:each) do
26
+ FakeFS.activate!
27
+ path = vagrant.instance_variable_get( :@vagrant_path )
28
+ allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
28
29
 
29
- vagrant.make_vfile( @hosts )
30
+ vagrant.make_vfile( @hosts )
31
+ @vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
32
+ end
30
33
 
31
- vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
32
- expect( vagrantfile ).to include( %Q{ v.vm.provider :libvirt})
34
+ it "can make a Vagranfile for a set of hosts" do
35
+ expect( @vagrantfile ).to include( %Q{ v.vm.provider :libvirt do |node|})
36
+ end
37
+
38
+ it "can specify the memory as an integer" do
39
+ expect( @vagrantfile.split("\n").map(&:strip) )
40
+ .to include('node.memory = 512')
41
+ end
33
42
  end
34
43
  end
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.30.1
4
+ version: 2.31.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-12-03 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -694,6 +694,7 @@ files:
694
694
  - spec/beaker/dsl/roles_spec.rb
695
695
  - spec/beaker/dsl/structure_spec.rb
696
696
  - spec/beaker/dsl/wrappers_spec.rb
697
+ - spec/beaker/host/aix_spec.rb
697
698
  - spec/beaker/host/eos_spec.rb
698
699
  - spec/beaker/host/freebsd/exec_spec.rb
699
700
  - spec/beaker/host/mac/group_spec.rb
@@ -702,6 +703,7 @@ files:
702
703
  - spec/beaker/host/unix/pkg_spec.rb
703
704
  - spec/beaker/host/windows/exec_spec.rb
704
705
  - spec/beaker/host/windows/group_spec.rb
706
+ - spec/beaker/host/windows/pkg_spec.rb
705
707
  - spec/beaker/host_prebuilt_steps_spec.rb
706
708
  - spec/beaker/host_spec.rb
707
709
  - spec/beaker/hypervisor/aixer_spec.rb