beaker 2.49.0 → 2.50.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
- ZWI4OTU0ZmQ1MGYzNmMxMzkwOWNlM2RmZjQzY2ZhZGIyMDc3MDdiNA==
4
+ YzlmMWE0ZTZiMmI4MmE4YmNkMTk1MmIwMGRmNTFiYmI1YWZkNThiNg==
5
5
  data.tar.gz: !binary |-
6
- YWZiN2EwY2Y4NDMwNjRhODZiNjZjZmU4ZTU5YzVlMzBhZTk2ZmI1Nw==
6
+ OGIyMjM5NTA0MGY4OGU2NjU0Mjk2MWZmMTM2OWZhNjYyMTEyNDk0ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjI3YmQwZDJlMGI2OGI1OGJhMGE5YmUzMjZmNGM2ZjViODQ4MzBhYTYzMTNm
10
- Zjg3OGVkMThhZDdiMmMwNWMyNzM3ZTNiZTY3ZTBhOTRkYjk2MTVmMTZmMmQ2
11
- NjFmN2Y3MjkyY2VmYzQyZGJkZGI4ZmY5ZmNhNmY3OTA0MGI1YWE=
9
+ NmY1Y2M3YTMzMWY4NzM4ODY4NzFmMmI1ZjIwZWVkOTY4MTIyZGFkMWQ2MzY2
10
+ ZTE5OWFiZGYwY2I3MGQ5NmYwM2I4YzJlMzc1NDMwNWE2YjM1ODViOTc3ODMw
11
+ NDZlZTE0ZmQ0OWM5MjlkOTQ2MzBlYmQ2OThmNzBkNWI4OTBmN2Q=
12
12
  data.tar.gz: !binary |-
13
- YjU4YzYzMTZiMGVkNTk3ODQ0M2Q4Njk1OTQzNDJlMzkzNjNkYmE0ZTcxMWNh
14
- YmM0OTMxYjA4NjBhOGQ4MjU2YzM2YWYzZjZiZGQ2YzI4NWExZmMxZDRiZTYx
15
- NGFmODM4ZDJiNDA1N2NmNDJiZmUyM2NkMGY0NWYyYTM5ZTYyNTA=
13
+ ZjMxMDlhYzcxZTk1ZDE0ODQ0ZDZiNzdiMWU2YjA0NjZjZGM2NzE3ODFkNGJk
14
+ OGQ4M2YzNDQwNGYyNTk1NGJkYWYwNTNhOThmZDhhMDRjNDM5YzY5MDFjYTQ5
15
+ MzZhNjY4MDhiMzcwOGZjMmM1YmJjZGE4ZWRhNjEyMjEyMDg5ZWI=
data/HISTORY.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # default - History
2
2
  ## Tags
3
- * [LATEST - 11 Aug, 2016 (966f74b9)](#LATEST)
3
+ * [LATEST - 22 Aug, 2016 (9358f2eb)](#LATEST)
4
+ * [2.49.0 - 11 Aug, 2016 (53ba3f14)](#2.49.0)
4
5
  * [2.48.1 - 29 Jul, 2016 (e5a52ad4)](#2.48.1)
5
6
  * [2.48.0 - 27 Jul, 2016 (47d3aa18)](#2.48.0)
6
7
  * [2.47.1 - 15 Jul, 2016 (da89c35b)](#2.47.1)
@@ -127,7 +128,120 @@
127
128
  * [pe1.2 - 6 Sep, 2011 (ba3dadd2)](#pe1.2)
128
129
 
129
130
  ## Details
130
- ### <a name = "LATEST">LATEST - 11 Aug, 2016 (966f74b9)
131
+ ### <a name = "LATEST">LATEST - 22 Aug, 2016 (9358f2eb)
132
+
133
+ * (GEM) update beaker version to 2.50.0 (9358f2eb)
134
+
135
+ * Merge pull request #1226 from kevpl/maint_rbvmomi_pin (5ad18987)
136
+
137
+
138
+ ```
139
+ Merge pull request #1226 from kevpl/maint_rbvmomi_pin
140
+
141
+ (BKR-918) pin rbvmomi to 1.8.0
142
+ ```
143
+ * (BKR-918) pin rbvmomi to 1.8.0 (50270cf9)
144
+
145
+ * Merge pull request #1223 from highb/fix/master/pe-17093_solaris_fixes (b90bc186)
146
+
147
+
148
+ ```
149
+ Merge pull request #1223 from highb/fix/master/pe-17093_solaris_fixes
150
+
151
+ (PE-17093) Solaris 10/11 pkg/pkgutil fixes
152
+ ```
153
+ * Merge pull request #1221 from melissa/maint/master/test-foss-sles (fb02c924)
154
+
155
+
156
+ ```
157
+ Merge pull request #1221 from melissa/maint/master/test-foss-sles
158
+
159
+ (RE-7420) Add the ability to run FOSS tests on sles
160
+ ```
161
+ * (PE-17093) pkgutil should be in path post install (725f5baf)
162
+
163
+
164
+ ```
165
+ (PE-17093) pkgutil should be in path post install
166
+
167
+ Prior to this commit I thought that I would need to specify
168
+ the full path to pkgutil after installing it in order to use
169
+ it.
170
+ This commit removes the full path, because pkgutil should be
171
+ in the system path after installation.
172
+ ```
173
+ * (PE-17093) Solaris 10/11 pkg/pkgutil fixes (5fac81c9)
174
+
175
+
176
+ ```
177
+ (PE-17093) Solaris 10/11 pkg/pkgutil fixes
178
+
179
+ Prior to this commit Solaris 10 would blow up if pkgutil wasn't
180
+ installed. Solaris 11 was not verifying that curl/ntp were installed.
181
+
182
+ This commit adds logic to install pkgutil if it isn't found on
183
+ Solaris 11, as well as adding package checks for Solaris 11 so that
184
+ it actually verifies that ntp/curl are installed.
185
+ ```
186
+ * Merge pull request #1218 from kevpl/acceptance_gather_hosts_tests (f878d2f8)
187
+
188
+
189
+ ```
190
+ Merge pull request #1218 from kevpl/acceptance_gather_hosts_tests
191
+
192
+ (MAINT) host acceptance tests refactor
193
+ ```
194
+ * Merge pull request #1214 from petems/BKR-906-allow_mac_setting (3d21e843)
195
+
196
+
197
+ ```
198
+ Merge pull request #1214 from petems/BKR-906-allow_mac_setting
199
+
200
+ (BKR-906) Allow setting MAC address
201
+ ```
202
+ * Merge pull request #1219 from ferglor/BKR-896-2 (9c1a25ee)
203
+
204
+
205
+ ```
206
+ Merge pull request #1219 from ferglor/BKR-896-2
207
+
208
+ (BKR-896) Fix SELinux context on root's SSH keys
209
+ ```
210
+ * (BKR-860) Adding support for vagrant to quick start tasks. (#1199) (ff99eae3)
211
+
212
+
213
+ ```
214
+ (BKR-860) Adding support for vagrant to quick start tasks. (#1199)
215
+
216
+ * (BKR-860) - Adding support for vagrant to quick start tasks.
217
+
218
+ * Adding tutorial doc.
219
+ ```
220
+ * (RE-7420) Add the ability to run FOSS tests on sles (60893e2e)
221
+
222
+ * (MAINT) host acceptance tests refactor (73176763)
223
+
224
+
225
+ ```
226
+ (MAINT) host acceptance tests refactor
227
+
228
+ - moved hosts-specific testing to a hosts folder rather than cluttering top-level dir
229
+ - pulled reboot test into its own file, to make failures there more clear in reporting
230
+ ```
231
+ * (BKR-896) Fix SELinux context on root's SSH keys (108d21d9)
232
+
233
+ * (BKR-906) Allow setting MAC address (ae755e75)
234
+
235
+
236
+ ```
237
+ (BKR-906) Allow setting MAC address
238
+
239
+ * Everything else is configurable, makes sense to make mac configurable too!
240
+ * Prevents issues with using vagrant-libvirt (https://github.com/vagrant-libvirt/vagrant-libvirt/issues/638)
241
+ ```
242
+ ### <a name = "2.49.0">2.49.0 - 11 Aug, 2016 (53ba3f14)
243
+
244
+ * (HISTORY) update beaker history for gem release 2.49.0 (53ba3f14)
131
245
 
132
246
  * (GEM) update beaker version to 2.49.0 (966f74b9)
133
247
 
@@ -92,7 +92,7 @@ end
92
92
 
93
93
  step "#do_scp_to : can copy a directory to the host with no ignores"
94
94
  current_dir = File.dirname(__FILE__)
95
- module_fixture = File.join(current_dir, "../../fixtures/module")
95
+ module_fixture = File.join(current_dir, "../../../fixtures/module")
96
96
  hosts.each do |host|
97
97
  logger.debug("can recursively copy a module over")
98
98
  #make sure that we are clean on the test host
@@ -117,7 +117,7 @@ end
117
117
 
118
118
  step "#do_scp_to with :ignore : can copy a dir to the host, excluding ignored patterns that DO NOT appear in the source absolute path"
119
119
  current_dir = File.dirname(__FILE__)
120
- module_fixture = File.expand_path(File.join(current_dir, "../../fixtures/module"))
120
+ module_fixture = File.expand_path(File.join(current_dir, "../../../fixtures/module"))
121
121
  hosts.each do |host|
122
122
  logger.debug("can recursively copy a module over, ignoring some files/dirs")
123
123
  #make sure that we are clean on the test host
@@ -147,7 +147,7 @@ end
147
147
 
148
148
  step "#do_scp_to with :ignore : can copy a dir to the host, excluding ignored patterns that DO appear in the source absolute path"
149
149
  current_dir = File.dirname(__FILE__)
150
- module_fixture = File.expand_path(File.join(current_dir, "../../fixtures/module"))
150
+ module_fixture = File.expand_path(File.join(current_dir, "../../../fixtures/module"))
151
151
  hosts.each do |host|
152
152
  logger.debug("can recursively copy a module over, ignoring some sub-files/sub-dirs that also appear in the absolute path")
153
153
  #make sure that we are clean on the test host
@@ -173,10 +173,4 @@ hosts.each do |host|
173
173
  end
174
174
  assert_equal(0, host_paths.length, "there are extra paths on #{host} (#{host_paths})")
175
175
  end
176
- end
177
-
178
- step "#reboot: can reboot the host"
179
- hosts.each do |host|
180
- host.reboot
181
- on host, "echo #{host} rebooted!"
182
- end
176
+ end
@@ -2,7 +2,7 @@ test_name 'confirm unix-specific package methods work'
2
2
  confine :except, :platform => %w(windows solaris osx)
3
3
 
4
4
  current_dir = File.dirname(__FILE__)
5
- pkg_fixtures = File.expand_path(File.join(current_dir, '../../fixtures/package'))
5
+ pkg_fixtures = File.expand_path(File.join(current_dir, '../../../fixtures/package'))
6
6
  pkg_name = 'puppetserver'
7
7
 
8
8
  def clean_file(host, file)
@@ -0,0 +1,8 @@
1
+ test_name 'Reboot Test' do
2
+ step "#reboot: can reboot the host" do
3
+ hosts.each do |host|
4
+ host.reboot
5
+ on host, "echo #{host} rebooted!"
6
+ end
7
+ end
8
+ end
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
47
47
  s.add_runtime_dependency 'beaker-hostgenerator'
48
48
 
49
49
  # Optional provisioner specific support
50
- s.add_runtime_dependency 'rbvmomi', '~> 1.8'
50
+ s.add_runtime_dependency 'rbvmomi', ['~> 1.8', '< 1.9.0']
51
51
  s.add_runtime_dependency 'fission', '~> 0.4'
52
52
  s.add_runtime_dependency 'google-api-client', ['~> 0.8', '< 0.9.5'] # dropped ruby 1.9 rupport in 0.9.5
53
53
  s.add_runtime_dependency 'aws-sdk-v1', '~> 1.57'
@@ -0,0 +1,211 @@
1
+ #Beaker Quick Start Tasks
2
+
3
+ We have developed some rake tasks to help new Beaker users get up and running quickly with writing and running tests.
4
+
5
+
6
+ ## Pre-requisites
7
+
8
+ * You will need to have already completed the Beaker installation tutorial - [Beaker Installation](installation.md)
9
+
10
+ * Hypervisors are services that provision SUTs for Beaker. We have made two available in this quick start guide to allow you to get up
11
+ and running. See the docs on how to setup [Vmpooler](../how_to/hypervisors/vsphere.md) and [Vagrant](../how_to/hypervisors/vagrant.md).
12
+
13
+
14
+ ## How to use them
15
+
16
+ To use the tasks, you need to put the following line at the top of your project's rake file:
17
+
18
+ require 'beaker/tasks/quick_start'
19
+
20
+ To check that you have access to the quickstart tasks from your project, run:
21
+
22
+ rake --tasks
23
+
24
+ You should see them listed along with any rake tasks you have defined in your local project rakefile:
25
+
26
+ rake beaker_quickstart:gen_hosts[hypervisor] # Generate Default Beaker Host Config File, valid options are: vmpooler or vagrant
27
+ rake beaker_quickstart:gen_pre_suite # Generate Default Pre-Suite
28
+ rake beaker_quickstart:gen_smoke_test # Generate Default Smoke Test
29
+ rake beaker_quickstart:run_test[hypervisor] # Run Default Smoke Test, after generating default host config and test files, valid
30
+ options are: vmpooler or vagrant
31
+
32
+
33
+ ## Tasks
34
+
35
+ ### Hypervisor Argument
36
+
37
+ Some of the tasks below take a 'hypervisor' argument that you can pass either 'vmpooler' or 'vagrant' to. If you leave it empty, the
38
+ task will default to using 'vagrant'.
39
+
40
+ Example:
41
+
42
+ rake beaker_quickstart:gen_hosts[vmpooler]
43
+
44
+ If you have the zsh shell then you will need to escape the square brackets:
45
+
46
+ rake beaker_quickstart:gen_hosts\[vmpooler\]
47
+
48
+
49
+ ### Generate tasks
50
+
51
+ These tasks are standalone and can be run independently from each other to generate the desired files.
52
+
53
+ * beaker_quickstart:gen_hosts (generates default host config)
54
+ * beaker_quickstart:gen_pre_suite (generates default pre-suite)
55
+ * beaker_quickstart:gen_smoke_test (generates default smoke test)
56
+
57
+ #### gen_hosts
58
+
59
+ To run:
60
+
61
+ rake beaker_quickstart:gen_hosts[hypervisor]
62
+
63
+ The gen_hosts task will create a file 'default_hypervisor_hosts.yaml' in acceptance/config.
64
+
65
+ If the file already exists, it will not be overwritten. This will allow you to play around with the config yourself, either by manually
66
+ editing the file or by using beaker-hostgenerator to generate a new hosts config.
67
+
68
+
69
+ Vmpooler file (redhat 7 master and agent):
70
+
71
+ ---
72
+ HOSTS:
73
+ redhat7-64-1:
74
+ pe_dir:
75
+ pe_ver:
76
+ pe_upgrade_dir:
77
+ pe_upgrade_ver:
78
+ hypervisor: vmpooler
79
+ platform: el-7-x86_64
80
+ template: redhat-7-x86_64
81
+ roles:
82
+ - agent
83
+ - master
84
+ - database
85
+ - dashboard
86
+ - classifier
87
+ - default
88
+ redhat7-64-2:
89
+ pe_dir:
90
+ pe_ver:
91
+ pe_upgrade_dir:
92
+ pe_upgrade_ver:
93
+ hypervisor: vmpooler
94
+ platform: el-7-x86_64
95
+ template: redhat-7-x86_64
96
+ roles:
97
+ - agent
98
+ - frictionless
99
+ CONFIG:
100
+ nfs_server: none
101
+ consoleport: 443
102
+ pooling_api: http://vmpooler.delivery.puppetlabs.net/
103
+
104
+
105
+
106
+ Vagrant file (ubuntu 14 master and agent):
107
+
108
+ ---
109
+ HOSTS:
110
+ ubuntu1404-64-1:
111
+ pe_dir:
112
+ pe_ver:
113
+ pe_upgrade_dir:
114
+ pe_upgrade_ver:
115
+ platform: ubuntu-14.04-amd64
116
+ hypervisor: vagrant
117
+ roles:
118
+ - agent
119
+ - master
120
+ - database
121
+ - dashboard
122
+ - classifier
123
+ - default
124
+ ubuntu1404-64-2:
125
+ pe_dir:
126
+ pe_ver:
127
+ pe_upgrade_dir:
128
+ pe_upgrade_ver:
129
+ platform: ubuntu-14.04-amd64
130
+ hypervisor: vagrant
131
+ roles:
132
+ - agent
133
+ - frictionless
134
+ CONFIG:
135
+ nfs_server: none
136
+ consoleport: 443
137
+ box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm
138
+ box: puppetlabs/ubuntu-14.04-64-nocm
139
+
140
+
141
+ For more info on host generation and what these configs represent see - [Creating A Test Environment](creating_a_test_environment.md)
142
+
143
+
144
+ ### gen_pre_suite
145
+
146
+ To run:
147
+
148
+ rake beaker_quickstart:gen_pre_suite
149
+
150
+ This task will generate a default Beaker pre-suite file.
151
+
152
+ The gen_pre-suite task will create a file 'default_pre_suite.rb' in acceptance/setup.
153
+
154
+ If the file already exists, it will not be overwritten. This will allow you to edit the pre_suite file yourself if required.
155
+
156
+ pre_suite file:
157
+
158
+ install_puppet
159
+
160
+ See the [Test Suites doc](test_suites.md) in this directory for more information on pre-suites.
161
+
162
+
163
+ ### gen_smoke_test
164
+
165
+ To run:
166
+
167
+ rake beaker_quickstart:gen_smoke_test
168
+
169
+ This task will generate a default Beaker smoke test file.
170
+
171
+ The gen_smoke_test task will create a file 'default_smoke_test.rb' in acceptance/tests.
172
+
173
+ If the file already exists, it will not be overwritten. This will allow you to edit the test file yourself if required.
174
+
175
+ smoke test file:
176
+
177
+ test_name 'puppet install smoketest' do
178
+ step 'puppet install smoketest: verify \'puppet help\' can be successfully called on
179
+ all hosts' do
180
+ hosts.each do |host|
181
+ on host, puppet('help')
182
+ end
183
+ end
184
+ end
185
+
186
+ This smoke test will check that Puppet has been successfully installed on the hosts.
187
+
188
+ For more information on the Beaker dsl methods available to you in your tests see - [Beaker dsl](../how_to/the_beaker_dsl.md)
189
+
190
+
191
+ ### Run task
192
+
193
+ The beaker_quickstart:run_test task will run all the above tasks in sequential order, to generate a hosts file, pre-suite file, smoke
194
+ test and then use these files to perform a Beaker test run. If the files already exist (see below for further info on file names and
195
+ location) then they will not be overwritten.
196
+
197
+
198
+ #### run_test
199
+
200
+ To run:
201
+
202
+ rake beaker_quickstart:run_test[hypervisor]
203
+
204
+ This task will run the above 3 tasks in sequential order and then execute a Beaker test run using all 3 files.
205
+
206
+ beaker --hosts acceptance/config/default_vmpooler_hosts.yaml --pre-suite acceptance/setup/default_pre_suite.rb --tests
207
+ acceptance/tests/default_smoke_test.rb
208
+
209
+ You will end up with provisioned hosts with puppet installed and a test check executed to verify that puppet was installed.
210
+
211
+ For more information on running Beaker tests see - [Test run](test_run.md)
@@ -979,7 +979,7 @@ module Beaker
979
979
  repo_configs_dir = nil,
980
980
  opts = options )
981
981
  variant, version, arch, codename = host['platform'].to_array
982
- if variant !~ /^(fedora|el|centos|debian|ubuntu|cumulus|huaweios|cisco_nexus|cisco_ios_xr)$/
982
+ if variant !~ /^(fedora|el|centos|debian|ubuntu|cumulus|huaweios|cisco_nexus|cisco_ios_xr|sles)$/
983
983
  raise "No repository installation step for #{variant} yet..."
984
984
  end
985
985
  repo_configs_dir ||= 'tmp/repo_configs'
@@ -27,4 +27,12 @@ module Mac::Exec
27
27
  ssh_service_restart()
28
28
  end
29
29
 
30
+ # Checks if selinux is enabled
31
+ # selinux is not availble on OS X
32
+ #
33
+ # @return [Boolean] false
34
+ def selinux_enabled?()
35
+ false
36
+ end
37
+
30
38
  end
@@ -294,4 +294,11 @@ module Unix::Exec
294
294
  end
295
295
  end
296
296
 
297
+ # Checks if selinux is enabled
298
+ #
299
+ # @return [Boolean] true if selinux is enabled, false otherwise
300
+ def selinux_enabled?()
301
+ exec(Beaker::Command.new("sudo selinuxenabled"), :accept_all_exit_codes => true).exit_code == 0
302
+ end
303
+
297
304
  end
@@ -41,6 +41,8 @@ module Unix::File
41
41
  case self['platform']
42
42
  when /fedora|el-|centos/
43
43
  '/etc/yum.repos.d/'
44
+ when /sles/
45
+ '/etc/zypp/repos.d/'
44
46
  when /debian|ubuntu|cumulus|huaweios/
45
47
  '/etc/apt/sources.list.d'
46
48
  else
@@ -62,7 +64,7 @@ module Unix::File
62
64
  repo_filename = "pl-%s-%s-" % [ package_name, build_version ]
63
65
 
64
66
  case variant
65
- when /fedora|el|centos|cisco_nexus|cisco_ios_xr/
67
+ when /fedora|el|centos|cisco_nexus|cisco_ios_xr|sles/
66
68
  variant = 'el' if variant == 'centos'
67
69
  if variant == 'cisco_nexus'
68
70
  variant = 'cisco-wrlinux'
@@ -101,7 +103,7 @@ module Unix::File
101
103
  # @return [String] Type of repo (rpm|deb)
102
104
  def repo_type
103
105
  case self['platform']
104
- when /fedora|el-|centos/
106
+ when /fedora|el-|centos|sles/
105
107
  'rpm'
106
108
  when /debian|ubuntu|cumulus|huaweios/
107
109
  'deb'
@@ -92,6 +92,14 @@ module Unix::Pkg
92
92
  end
93
93
  execute("pkg #{cmdline_args} install #{name}", opts)
94
94
  when /solaris-10/
95
+ if ! check_for_command('pkgutil')
96
+ # https://www.opencsw.org/package/pkgutil/
97
+ noask_text = self.noask_file_text
98
+ create_remote_file self, File.join(noask_directory, 'noask'), noask_text
99
+ execute('pkgadd -d http://get.opencsw.org/now -a noask -n all', opts)
100
+ execute('/opt/csw/bin/pkgutil -U', opts)
101
+ execute('/opt/csw/bin/pkgutil -y -i pkgutil', opts)
102
+ end
95
103
  execute("pkgutil -i -y #{cmdline_args} #{name}", opts)
96
104
  when /openbsd/
97
105
  begin
@@ -131,7 +139,7 @@ module Unix::Pkg
131
139
  # @param [String] cmdline_args Additional command line arguments for
132
140
  # the package manager.
133
141
  # @option opts [String] :package_proxy A proxy of form http://host:port
134
- #
142
+ #
135
143
  # @return nil
136
144
  # @api public
137
145
  def install_package_with_rpm(name, cmdline_args = '', opts = {})
@@ -284,7 +292,7 @@ module Unix::Pkg
284
292
  # @param [String] url A URL of form http://host:port
285
293
  # @return [String] httpproxy and httport options for rpm
286
294
  #
287
- # @raise [StandardError] When encountering a string that
295
+ # @raise [StandardError] When encountering a string that
288
296
  # cannot be parsed
289
297
  # @api private
290
298
  def extract_rpm_proxy_options(url)
@@ -89,4 +89,13 @@ module Windows::Exec
89
89
  spacing = (user_pc && !cygwin_prefix.empty?) ? ' ' : ''
90
90
  "#{cygwin_prefix}#{spacing}#{user_pc}"
91
91
  end
92
+
93
+ # Checks if selinux is enabled
94
+ # selinux is not available on Windows
95
+ #
96
+ # @return [Boolean] false
97
+ def selinux_enabled?()
98
+ false
99
+ end
100
+
92
101
  end
@@ -22,6 +22,7 @@ module Beaker
22
22
  DEBIAN_PACKAGES = ['curl', 'ntpdate', 'lsb-release']
23
23
  CUMULUS_PACKAGES = ['curl', 'ntpdate']
24
24
  SOLARIS10_PACKAGES = ['CSWcurl', 'CSWntp']
25
+ SOLARIS11_PACKAGES = ['curl', 'ntp']
25
26
  ETC_HOSTS_PATH = "/etc/hosts"
26
27
  ETC_HOSTS_PATH_SOLARIS = "/etc/inet/hosts"
27
28
  ROOT_KEYS_SCRIPT = "https://raw.githubusercontent.com/puppetlabs/puppetlabs-sshkeys/master/templates/scripts/manage_root_authorized_keys"
@@ -111,6 +112,8 @@ module Beaker
111
112
  check_and_install_packages_if_needed(host, OPENBSD_PACKAGES)
112
113
  when host['platform'] =~ /solaris-10/
113
114
  check_and_install_packages_if_needed(host, SOLARIS10_PACKAGES)
115
+ when host['platform'] =~ /solaris-1[1-9]/
116
+ check_and_install_packages_if_needed(host, SOLARIS11_PACKAGES)
114
117
  when host['platform'] !~ /debian|aix|solaris|windows|sles-|osx-|cumulus|f5-|netscaler|cisco_/
115
118
  check_and_install_packages_if_needed(host, UNIX_PACKAGES)
116
119
  end
@@ -368,6 +371,10 @@ module Beaker
368
371
  else
369
372
  host.exec(Command.new('sudo su -c "cp -r .ssh /root/."'), {:pty => true})
370
373
  end
374
+
375
+ if host.selinux_enabled?
376
+ host.exec(Command.new('sudo fixfiles restore /root'))
377
+ end
371
378
  end
372
379
  end
373
380
 
@@ -18,6 +18,18 @@ module Beaker
18
18
  "10.255.#{rand_chunk}.#{rand_chunk}"
19
19
  end
20
20
 
21
+ def private_network_generator(host)
22
+ private_network_string = " v.vm.network :private_network, ip: \"#{host['ip'].to_s}\", :netmask => \"#{host['netmask'] ||= "255.255.0.0"}\""
23
+ case host['network_mac']
24
+ when 'false'
25
+ private_network_string << "\n"
26
+ when nil
27
+ private_network_string << ", :mac => \"#{randmac}\"\n"
28
+ else
29
+ private_network_string << ", :mac => \"#{host['network_mac']}\"\n"
30
+ end
31
+ end
32
+
21
33
  def make_vfile hosts, options = {}
22
34
  #HACK HACK HACK - add checks here to ensure that we have box + box_url
23
35
  #generate the VagrantFile
@@ -33,9 +45,9 @@ module Beaker
33
45
  v_file << " v.vm.box_version = '#{host['box_version']}'\n" unless host['box_version'].nil?
34
46
  v_file << " v.vm.box_check_update = '#{host['box_check_update'] ||= 'true'}'\n"
35
47
  v_file << " v.vm.synced_folder '.', '/vagrant', disabled: true\n" if host['synced_folder'] == 'disabled'
36
- v_file << " v.vm.network :private_network, ip: \"#{host['ip'].to_s}\", :netmask => \"#{host['netmask'] ||= "255.255.0.0"}\", :mac => \"#{randmac}\"\n"
48
+ v_file << private_network_generator(host)
37
49
 
38
- unless host['mount_folders'].nil?
50
+ unless host['mount_folders'].nil?
39
51
  host['mount_folders'].each do |name, folder|
40
52
  v_file << " v.vm.synced_folder '#{folder[:from]}', '#{folder[:to]}', create: true\n"
41
53
  end
@@ -56,7 +68,7 @@ module Beaker
56
68
  end
57
69
 
58
70
  if /windows/i.match(host['platform'])
59
- #due to a regression bug in versions of vagrant 1.6.2, 1.6.3, 1.6.4, >= 1.7.3 ssh fails to forward
71
+ #due to a regression bug in versions of vagrant 1.6.2, 1.6.3, 1.6.4, >= 1.7.3 ssh fails to forward
60
72
  #automatically (note <=1.6.1, 1.6.5, 1.7.0 - 1.7.2 are uneffected)
61
73
  #Explicitly setting SSH port forwarding due to this bug
62
74
  v_file << " v.vm.network :forwarded_port, guest: 22, host: 2222, id: 'ssh', auto_correct: true\n"
@@ -1,49 +1,93 @@
1
1
  require 'beaker-hostgenerator'
2
2
 
3
+ VAGRANT = ['ubuntu1404-64default.mdcal-ubuntu1404-64af', '--hypervisor=vagrant',
4
+ '--global-config={box_url=https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm,box=puppetlabs/ubuntu-14.04-64-nocm}']
5
+
6
+ VMPOOLER = ['redhat7-64default.mdcal-redhat7-64af']
7
+
3
8
  namespace :beaker_quickstart do
4
9
 
5
- desc 'Generate Default Beaker Host Config File'
6
- task :gen_hosts do
7
- cli = BeakerHostGenerator::CLI.new(['redhat7-64default.mdcal-redhat7-64af'])
10
+ desc 'Generate Default Beaker Host Config File, valid options are: vmpooler or vagrant.'
11
+ task :gen_hosts, [:hypervisor] do |t, args|
12
+ hosts_file = "acceptance/config/default_#{args[:hypervisor]}_hosts.yaml"
13
+ if args[:hypervisor] == 'vagrant'
14
+ cli = VAGRANT
15
+ elsif args[:hypervisor] == 'vmpooler'
16
+ cli = VMPOOLER
17
+ else
18
+ puts "No hypervisor provided, defaulting to vagrant."
19
+ hosts_file = "acceptance/config/default_vagrant_hosts.yaml"
20
+ cli = VAGRANT
21
+ end
8
22
  FileUtils.mkdir_p('acceptance/config') # -p ignores when dir already exists
9
- File.open("acceptance/config/default_hosts.yaml", 'w') do |fh|
10
- fh.print(cli.execute)
23
+ puts "About to run - beaker-hostgenerator #{cli.to_s.delete!('[]"')}"
24
+ if !File.exist?(hosts_file) then
25
+ puts "Writing default host config to file - #{hosts_file}"
26
+ File.open(hosts_file, 'w') do |fh|
27
+ fh.print(BeakerHostGenerator::CLI.new(cli).execute)
28
+ end
29
+ else
30
+ puts "Not overwriting Host Config File: #{hosts_file} - it already exists."
11
31
  end
12
32
  end
13
33
 
34
+
14
35
  desc 'Generate Default Pre-Suite'
15
36
  task :gen_pre_suite do
37
+ pre_suite_file = "acceptance/setup/default_pre_suite.rb"
16
38
  FileUtils.mkdir_p('acceptance/setup') # -p ignores when dir already exists
17
- File.open("acceptance/setup/default_pre_suite.rb", 'w') do |fh|
18
- fh.print('install_puppet')
39
+ if !File.exist?(pre_suite_file) then
40
+ puts "Writing default pre_suite to file - #{pre_suite_file}"
41
+ File.open(pre_suite_file, 'w') do |fh|
42
+ fh.print('install_puppet')
43
+ end
44
+ else
45
+ puts "Not overwriting Pre Suite File: #{pre_suite_file} - it already exists."
19
46
  end
20
47
  end
21
48
 
22
49
  desc 'Generate Default Smoke Test'
23
50
  task :gen_smoke_test do
51
+ smoke_test_file = "acceptance/setup/default_smoke_test.rb"
24
52
  FileUtils.mkdir_p('acceptance/tests') # -p ignores when dir already exists
25
- File.open("acceptance/tests/default_smoke_test.rb", 'w') do |fh|
26
- fh.print("test_name 'puppet install smoketest'
27
- step 'puppet install smoketest: verify \\'puppet help\\' can be successfully called on
28
- all hosts'
53
+ if !File.exist?(smoke_test_file) then
54
+ puts "Writing default smoke test to file - #{smoke_test_file}"
55
+ File.open("acceptance/tests/default_smoke_test.rb", 'w') do |fh|
56
+ fh.print("test_name 'puppet install smoketest' do
57
+ step 'puppet install smoketest: verify \\'puppet help\\' can be successfully called on
58
+ all hosts' do
29
59
  hosts.each do |host|
30
60
  on host, puppet('help')
31
- end")
61
+ end
62
+ end
63
+ end")
64
+ end
65
+ else
66
+ puts "Not overwriting Smoke Test File: #{smoke_test_file} - it already exists."
32
67
  end
33
68
  end
34
69
 
35
- desc 'Run Default Smoke Test'
36
- task :run => ['beaker_quickstart:gen_hosts', 'beaker_quickstart:gen_pre_suite', 'beaker_quickstart:gen_smoke_test'] do
37
- system(beaker_command)
70
+ desc 'Run Default Smoke Test, after generating default host config and test files, valid options are: vmpooler or vagrant.'
71
+ task :run_test, [:hypervisor] => ["beaker_quickstart:gen_hosts", 'beaker_quickstart:gen_pre_suite',
72
+ 'beaker_quickstart:gen_smoke_test'] do
73
+ |t, args|
74
+ hypervisor = args[:hypervisor] ||='vagrant'
75
+ system_args = Hash.new
76
+ system_args[:hosts] = "acceptance/config/default_#{hypervisor}_hosts.yaml"
77
+ system_args[:pre_suite] = 'acceptance/setup/default_pre_suite.rb'
78
+ system_args[:tests] = 'acceptance/tests/default_smoke_test.rb'
79
+ puts "About to run - #{beaker_command(system_args)}"
80
+ system(beaker_command(system_args))
38
81
  end
39
82
 
40
83
  end
41
84
 
42
- def beaker_command
85
+
86
+ def beaker_command(system_args)
43
87
  cmd_parts = []
44
88
  cmd_parts << "beaker"
45
- cmd_parts << "--hosts acceptance/config/default_hosts.yaml"
46
- cmd_parts << "--pre-suite acceptance/setup/default_pre_suite.rb"
47
- cmd_parts << "--tests acceptance/tests/default_smoke_test.rb"
89
+ cmd_parts << "--hosts #{system_args[:hosts]}"
90
+ cmd_parts << "--pre-suite #{system_args[:pre_suite]}"
91
+ cmd_parts << "--tests #{system_args[:tests]}"
48
92
  cmd_parts.flatten.join(" ")
49
93
  end
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '2.49.0'
3
+ STRING = '2.50.0'
4
4
  end
5
5
  end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe Mac::Exec do
5
+ class MacExecTest
6
+ include Mac::Exec
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
+ end
22
+
23
+ let (:opts) { @opts || {} }
24
+ let (:logger) { double( 'logger' ).as_null_object }
25
+ let (:instance) { MacExecTest.new(opts, logger) }
26
+
27
+ describe '#selinux_enabled?' do
28
+ it 'does not call selinuxenabled' do
29
+ expect(Beaker::Command).not_to receive(:new).with("sudo selinuxenabled")
30
+ expect(instance).not_to receive(:exec).with(0, :accept_all_exit_codes => true)
31
+ expect(instance.selinux_enabled?).to be === false
32
+ end
33
+ end
34
+ end
35
+ end
@@ -136,14 +136,26 @@ module Beaker
136
136
  end
137
137
 
138
138
  describe '#prepend_commands' do
139
-
140
139
  it 'returns the pc parameter unchanged for non-cisco platforms' do
141
140
  allow( instance ).to receive( :[] ).with( :platform ).and_return( 'notcisco' )
142
141
  answer_prepend_commands = 'pc_param_unchanged_13579'
143
142
  answer_test = instance.prepend_commands( 'fake_cmd', answer_prepend_commands )
144
143
  expect( answer_test ).to be === answer_prepend_commands
145
144
  end
145
+ end
146
146
 
147
+ describe '#selinux_enabled?' do
148
+ it 'calls selinuxenabled and selinux is enabled' do
149
+ expect(Beaker::Command).to receive(:new).with("sudo selinuxenabled").and_return(0)
150
+ expect(instance).to receive(:exec).with(0, :accept_all_exit_codes => true).and_return(generate_result("test", {:exit_code => 0}))
151
+ expect(instance.selinux_enabled?).to be === true
152
+ end
153
+
154
+ it 'calls selinuxenabled and selinux is not enabled' do
155
+ expect(Beaker::Command).to receive(:new).with("sudo selinuxenabled").and_return(1)
156
+ expect(instance).to receive(:exec).with(1, :accept_all_exit_codes => true).and_return(generate_result("test", {:exit_code => 1}))
157
+ expect(instance.selinux_enabled?).to be === false
158
+ end
147
159
  end
148
160
  end
149
161
  end
@@ -67,6 +67,11 @@ module Beaker
67
67
  expect( instance.package_config_dir ).to be === '/etc/apt/sources.list.d'
68
68
  end
69
69
 
70
+ it 'returns correctly for sles-based platforms' do
71
+ @platform = 'sles-12-x86_64'
72
+ expect( instance.package_config_dir ).to be === '/etc/zypp/repos.d/'
73
+ end
74
+
70
75
  it 'errors for all other platform types' do
71
76
  @platform = 'eos-4-x86_64'
72
77
  expect {
@@ -84,6 +89,13 @@ module Beaker
84
89
  expect( filename ).to match( /sion7\-el\-/ )
85
90
  end
86
91
 
92
+ it 'sets the sles portion correctly for sles platforms' do
93
+ @platform = 'sles-11-x86_64'
94
+ allow( instance ).to receive( :is_pe? ) { false }
95
+ filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
96
+ expect( filename ).to match( /sion7\-sles\-/ )
97
+ end
98
+
87
99
  it 'builds the filename correctly for el-based platforms' do
88
100
  @platform = 'el-21-x86_64'
89
101
  allow( instance ).to receive( :is_pe? ) { false }
@@ -43,5 +43,13 @@ module Beaker
43
43
  expect( command_str ).not_to match( /cmd\.exe/ )
44
44
  end
45
45
  end
46
+
47
+ describe '#selinux_enabled?' do
48
+ it 'does not call selinuxenabled' do
49
+ expect(Beaker::Command).not_to receive(:new).with("sudo selinuxenabled")
50
+ expect(instance).not_to receive(:exec).with(0, :accept_all_exit_codes => true)
51
+ expect(instance.selinux_enabled?).to be === false
52
+ end
53
+ end
46
54
  end
47
55
  end
@@ -117,6 +117,36 @@ EOF
117
117
  expect( vagrantfile ).to match(/v.vm.synced_folder .* disabled: true/)
118
118
  end
119
119
 
120
+ it "can make a Vagrantfile with network mac autogenerated" do
121
+ path = vagrant.instance_variable_get( :@vagrant_path )
122
+
123
+ hosts = make_hosts({},1)
124
+ vagrant.make_vfile( hosts, options )
125
+
126
+ vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
127
+ expect( vagrantfile ).to match(/v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0", :mac => ".+/)
128
+ end
129
+
130
+ it "can make a Vagrantfile with network mac specified" do
131
+ path = vagrant.instance_variable_get( :@vagrant_path )
132
+
133
+ hosts = make_hosts({:network_mac => 'b6:33:ae:19:48:f9'},1)
134
+ vagrant.make_vfile( hosts, options )
135
+
136
+ vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
137
+ expect( vagrantfile ).to match(/v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0", :mac => "b6:33:ae:19:48:f9/)
138
+ end
139
+
140
+ it "can make a Vagrantfile with network mac disabled" do
141
+ path = vagrant.instance_variable_get( :@vagrant_path )
142
+
143
+ hosts = make_hosts({:network_mac => 'false'},1)
144
+ vagrant.make_vfile( hosts, options )
145
+
146
+ vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
147
+ expect( vagrantfile ).to match(/v.vm.network :private_network, ip: "ip.address.for.vm1", :netmask => "255.255.0.0"/)
148
+ end
149
+
120
150
  it "generates a valid windows config" do
121
151
  path = vagrant.instance_variable_get( :@vagrant_path )
122
152
  allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
@@ -151,19 +181,19 @@ EOF
151
181
  expect( match ).to_not be nil
152
182
 
153
183
  end
154
-
184
+
155
185
  it "uses the cpus defined per vagrant host" do
156
186
  path = vagrant.instance_variable_get( :@vagrant_path )
157
187
  allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )
158
-
188
+
159
189
  vagrant.make_vfile( @hosts, {'vagrant_cpus' => 'goodbye!'} )
160
-
190
+
161
191
  generated_file = File.read( File.expand_path( File.join( path, "Vagrantfile") ) )
162
-
192
+
163
193
  match = generated_file.match(/vb.customize \['modifyvm', :id, '--memory', '1024', '--cpus', 'goodbye!'\]/)
164
-
194
+
165
195
  expect( match ).to_not be nil
166
-
196
+
167
197
  end
168
198
 
169
199
  context "port forwarding rules" do
@@ -269,6 +299,8 @@ EOF
269
299
  host[:platform] = 'unix'
270
300
 
271
301
  expect( Command ).to receive( :new ).with("sudo su -c \"cp -r .ssh /root/.\"").once
302
+ expect( Command ).to receive( :new ).with("sudo fixfiles restore /root").once
303
+ expect( Command ).to receive( :new ).with("sudo selinuxenabled").once
272
304
 
273
305
  vagrant.copy_ssh_to_root( host, options )
274
306
 
@@ -279,9 +311,17 @@ EOF
279
311
  host[:platform] = 'windows'
280
312
  expect( host ).to receive( :is_cygwin? ).and_return(true)
281
313
 
314
+ expect( Command ).to_not receive( :new ).with("sudo fixfiles restore /root")
282
315
  expect( Command ).to receive( :new ).with("cp -r .ssh /cygdrive/c/Users/Administrator/.").once
283
316
  expect( Command ).to receive( :new ).with("chown -R Administrator /cygdrive/c/Users/Administrator/.ssh").once
284
317
 
318
+ # This is checked on all platforms since Linux isn't called out specifically in the code
319
+ # If this fails, nothing further is activated
320
+ result = Beaker::Result.new(host, '')
321
+ result.exit_code = 1
322
+ expect( Command ).to receive( :new ).with("sudo selinuxenabled")
323
+ allow( host ).to receive(:exec).and_return(result)
324
+
285
325
  vagrant.copy_ssh_to_root( host, options )
286
326
 
287
327
  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.49.0
4
+ version: 2.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppetlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -311,6 +311,9 @@ dependencies:
311
311
  - - ~>
312
312
  - !ruby/object:Gem::Version
313
313
  version: '1.8'
314
+ - - <
315
+ - !ruby/object:Gem::Version
316
+ version: 1.9.0
314
317
  type: :runtime
315
318
  prerelease: false
316
319
  version_requirements: !ruby/object:Gem::Requirement
@@ -318,6 +321,9 @@ dependencies:
318
321
  - - ~>
319
322
  - !ruby/object:Gem::Version
320
323
  version: '1.8'
324
+ - - <
325
+ - !ruby/object:Gem::Version
326
+ version: 1.9.0
321
327
  - !ruby/object:Gem::Dependency
322
328
  name: fission
323
329
  requirement: !ruby/object:Gem::Requirement
@@ -552,10 +558,11 @@ files:
552
558
  - acceptance/tests/base/dsl/platform_tag_confiner_test.rb
553
559
  - acceptance/tests/base/dsl/structure_test.rb
554
560
  - acceptance/tests/base/external_resources_test.rb
561
+ - acceptance/tests/base/host/host_test.rb
562
+ - acceptance/tests/base/host/packages.rb
563
+ - acceptance/tests/base/host/packages_unix.rb
564
+ - acceptance/tests/base/host/reboot_test.rb
555
565
  - acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb
556
- - acceptance/tests/base/host_test.rb
557
- - acceptance/tests/base/packages.rb
558
- - acceptance/tests/base/packages_unix.rb
559
566
  - acceptance/tests/base/test_suite/export.rb
560
567
  - acceptance/tests/hypervisor/communication_test.rb
561
568
  - acceptance/tests/install/from_file.rb
@@ -609,6 +616,7 @@ files:
609
616
  - docs/tutorials/how_to_beaker.md
610
617
  - docs/tutorials/installation.md
611
618
  - docs/tutorials/lets_write_a_test.md
619
+ - docs/tutorials/quick_start_rake_tasks.md
612
620
  - docs/tutorials/test_run.md
613
621
  - docs/tutorials/test_suites.md
614
622
  - docs/tutorials/the_command_line.md
@@ -749,6 +757,7 @@ files:
749
757
  - spec/beaker/host/eos_spec.rb
750
758
  - spec/beaker/host/freebsd/exec_spec.rb
751
759
  - spec/beaker/host/freebsd/pkg_spec.rb
760
+ - spec/beaker/host/mac/exec_spec.rb
752
761
  - spec/beaker/host/mac/group_spec.rb
753
762
  - spec/beaker/host/mac/user_spec.rb
754
763
  - spec/beaker/host/mac_spec.rb