beaker 4.28.1 → 4.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +13 -4
- data/.github/workflows/test.yml +12 -8
- data/CHANGELOG.md +27 -16
- data/Gemfile +11 -2
- data/HISTORY.md +492 -0
- data/README.md +26 -9
- data/Rakefile +16 -0
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +2 -2
- data/acceptance/tests/base/host/packages.rb +2 -2
- data/beaker.gemspec +1 -7
- data/docs/tutorials/creating_a_test_environment.md +1 -0
- data/lib/beaker/dsl/helpers/web_helpers.rb +3 -4
- data/lib/beaker/host/unix/exec.rb +7 -5
- data/lib/beaker/host/unix/file.rb +3 -3
- data/lib/beaker/host/unix/pkg.rb +13 -10
- data/lib/beaker/host_prebuilt_steps.rb +7 -4
- data/lib/beaker/local_connection.rb +3 -0
- data/lib/beaker/perf.rb +2 -2
- data/lib/beaker/platform.rb +8 -6
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +2 -2
- data/spec/beaker/host/unix/file_spec.rb +12 -0
- data/spec/beaker/host/unix/pkg_spec.rb +27 -14
- data/spec/beaker/host/unix_spec.rb +9 -1
- data/spec/beaker/host_prebuilt_steps_spec.rb +38 -0
- data/spec/beaker/perf_spec.rb +2 -1
- data/spec/beaker/platform_spec.rb +5 -0
- data/spec/spec_helper.rb +24 -1
- metadata +18 -59
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Beaker
|
2
2
|
|
3
|
+
[![License](https://img.shields.io/github/license/voxpupuli/beaker.svg)](https://github.com/voxpupuli/beaker/blob/master/LICENSE)
|
4
|
+
[![Test](https://github.com/voxpupuli/beaker/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/beaker/actions/workflows/test.yml)
|
5
|
+
[![codecov](https://codecov.io/gh/voxpupuli/beaker/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/beaker)
|
6
|
+
[![Release](https://github.com/voxpupuli/beaker/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/beaker/actions/workflows/release.yml)
|
7
|
+
[![RubyGem Version](https://img.shields.io/gem/v/beaker.svg)](https://rubygems.org/gems/beaker)
|
8
|
+
[![RubyGem Downloads](https://img.shields.io/gem/dt/beaker.svg)](https://rubygems.org/gems/beaker)
|
9
|
+
[![Donated by Puppet Inc](https://img.shields.io/badge/donated%20by-Puppet%20Inc-fb7047.svg)](#transfer-notice)
|
10
|
+
|
3
11
|
Beaker is a test harness focused on acceptance testing via interactions between multiple (virtual) machines. It provides platform abstraction between different Systems Under Test (SUTs), and it can also be used as a virtual machine provisioner - setting up machines, running any commands on those machines, and then exiting.
|
4
12
|
|
5
13
|
Beaker runs tests written in Ruby, and provides additional Domain-Specific Language (DSL) methods. This gives you access to all standard Ruby along with acceptance testing specific commands.
|
@@ -24,10 +32,6 @@ Documentation for Beaker can be found in this repository in
|
|
24
32
|
|
25
33
|
Beaker functionality has been extended through the use of libraries available as gems. See the [complete list](docs/concepts/beaker_libraries.md) for available gems. See the [beaker-template documentation](https://github.com/puppetlabs/beaker-template/blob/master/README.md) for documentation on creating beaker-libraries.
|
26
34
|
|
27
|
-
# License
|
28
|
-
|
29
|
-
See [LICENSE](LICENSE) file.
|
30
|
-
|
31
35
|
# Support & Issues
|
32
36
|
|
33
37
|
Please log tickets and issues at our [Beaker Issue Tracker](https://tickets.puppetlabs.com/issues/?jql=project%20%3D%20BKR). In addition there is an active #puppet-dev channel on Freenode.
|
@@ -42,11 +46,24 @@ If you'd like to contribute improvements to Beaker, please see [CONTRIBUTING](CO
|
|
42
46
|
|
43
47
|
For information on project maintainers, please check out our [CODEOWNERS doc](CODEOWNERS).
|
44
48
|
|
45
|
-
|
49
|
+
## Transfer Notice
|
50
|
+
|
51
|
+
This plugin was originally authored by [Puppet Inc](http://puppet.com).
|
52
|
+
The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
|
53
|
+
Existing pull requests and issues were transferred over, please fork and continue to contribute here.
|
54
|
+
|
55
|
+
Previously: https://github.com/puppetlabs/beaker
|
56
|
+
|
57
|
+
## License
|
46
58
|
|
47
|
-
|
48
|
-
Historically, the process has been described in [Confluence: Beaker Release Process](https://confluence.puppetlabs.com/display/SRE/Beaker+Release+Process) (apologies, most links in this section are Puppet-internal).
|
59
|
+
This gem is licensed under the Apache-2 license.
|
49
60
|
|
50
|
-
|
61
|
+
## Release information
|
51
62
|
|
52
|
-
To
|
63
|
+
To make a new release, please do:
|
64
|
+
* update the version in the gemspec file
|
65
|
+
* Install gems with `bundle install --with release --path .vendor`
|
66
|
+
* generate the changelog with `bundle exec rake changelog`
|
67
|
+
* Check if the new version matches the closed issues/PRs in the changelog
|
68
|
+
* Create a PR with it
|
69
|
+
* After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
|
data/Rakefile
CHANGED
@@ -328,3 +328,19 @@ namespace :docs do
|
|
328
328
|
end
|
329
329
|
end
|
330
330
|
end
|
331
|
+
|
332
|
+
begin
|
333
|
+
require 'rubygems'
|
334
|
+
require 'github_changelog_generator/task'
|
335
|
+
|
336
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
337
|
+
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog}
|
338
|
+
config.user = 'voxpupuli'
|
339
|
+
config.project = 'beaker'
|
340
|
+
config.max_issues = 50
|
341
|
+
config.since_tag = "4.30.0"
|
342
|
+
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
|
343
|
+
config.future_release = gem_version
|
344
|
+
end
|
345
|
+
rescue LoadError
|
346
|
+
end
|
@@ -97,7 +97,7 @@ test_name "dsl::helpers::host_helpers #deploy_package_repo" do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
confine_block :to, :platform => /sles/i do
|
100
|
+
confine_block :to, :platform => /opensuse|sles/i do
|
101
101
|
|
102
102
|
step "#deploy_package_repo updates zypper repository list on the remote host" do
|
103
103
|
Dir.mktmpdir do |local_dir|
|
@@ -119,7 +119,7 @@ test_name "dsl::helpers::host_helpers #deploy_package_repo" do
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
-
confine_block :except, :platform => /el-\d|fedora|centos|eos|ubuntu|debian|cumulus|sles/i do
|
122
|
+
confine_block :except, :platform => /el-\d|fedora|centos|eos|ubuntu|debian|cumulus|opensuse|sles/i do
|
123
123
|
|
124
124
|
# OS X, windows (cygwin, powershell), solaris, etc.
|
125
125
|
|
@@ -5,7 +5,7 @@ def get_host_pkg(host)
|
|
5
5
|
case
|
6
6
|
when host['platform'] =~ /sles-10/
|
7
7
|
Beaker::HostPrebuiltSteps::SLES10_PACKAGES
|
8
|
-
when host['platform'] =~ /sles-/
|
8
|
+
when host['platform'] =~ /opensuse|sles-/
|
9
9
|
Beaker::HostPrebuiltSteps::SLES_PACKAGES
|
10
10
|
when host['platform'] =~ /debian/
|
11
11
|
Beaker::HostPrebuiltSteps::DEBIAN_PACKAGES
|
@@ -53,7 +53,7 @@ hosts.each do |host|
|
|
53
53
|
next if host['platform'] =~ /windows/
|
54
54
|
package = 'zsh'
|
55
55
|
package = 'CSWzsh' if host['platform'] =~ /solaris-10/
|
56
|
-
package = 'git' if host['platform'] =~ /sles/
|
56
|
+
package = 'git' if host['platform'] =~ /opensuse|sles/
|
57
57
|
|
58
58
|
if host['platform'] =~ /solaris-11/
|
59
59
|
logger.debug("#{package} should be uninstalled on #{host}")
|
data/beaker.gemspec
CHANGED
@@ -24,15 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'rspec', '~> 3.0'
|
25
25
|
s.add_development_dependency 'rspec-its'
|
26
26
|
s.add_development_dependency 'fakefs', '~> 1.0'
|
27
|
-
s.add_development_dependency 'simplecov'
|
28
27
|
s.add_development_dependency 'rake', '~> 13.0'
|
29
28
|
|
30
|
-
# Provisioner dependencies - needed for acceptance tests
|
31
|
-
# TODO: figure out how to remove these
|
32
|
-
s.add_development_dependency 'beaker-aws', '~> 0.1'
|
33
|
-
s.add_development_dependency 'beaker-abs', '~> 0.4'
|
34
|
-
s.add_development_dependency 'beaker-vmpooler', '~> 1.0'
|
35
|
-
|
36
29
|
# Documentation dependencies
|
37
30
|
s.add_development_dependency 'yard', '~> 0.9.11'
|
38
31
|
|
@@ -42,6 +35,7 @@ Gem::Specification.new do |s|
|
|
42
35
|
s.add_runtime_dependency 'pry-byebug', '~> 3.9'
|
43
36
|
# pry-byebug can have issues with native readline libs so add rb-readline
|
44
37
|
s.add_runtime_dependency 'rb-readline', '~> 0.5.3'
|
38
|
+
s.add_runtime_dependency 'rexml'
|
45
39
|
|
46
40
|
s.add_runtime_dependency 'hocon', '~> 1.0'
|
47
41
|
s.add_runtime_dependency 'net-ssh', '>= 5.0'
|
@@ -107,12 +107,11 @@ module Beaker
|
|
107
107
|
logger.notify " and saving to #{dst}"
|
108
108
|
logger.notify " using command: #{wget_command}"
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
result.each_line do |line|
|
110
|
+
stdout_and_stderr_str, status = Open3.capture2e(wget_command)
|
111
|
+
stdout_and_stderr_str.each_line do |line|
|
113
112
|
logger.debug(line)
|
114
113
|
end
|
115
|
-
|
114
|
+
unless status.success?
|
116
115
|
raise "Failed to fetch_remote_dir '#{url}' (exit code #{$?})"
|
117
116
|
end
|
118
117
|
dst
|
@@ -138,7 +138,9 @@ module Unix::Exec
|
|
138
138
|
if self['platform'].include?('solaris') || self['platform'].include?('osx')
|
139
139
|
execute("ifconfig -a inet| awk '/broadcast/ {print $2}' | cut -d/ -f1 | head -1").strip
|
140
140
|
else
|
141
|
-
|
141
|
+
|
142
|
+
pipe_cmd = "#{self['hypervisor']}".include?('vagrant') ? 'tail' : 'head'
|
143
|
+
execute("ip a | awk '/global/{print$2}' | cut -d/ -f1 | #{pipe_cmd} -1").strip
|
142
144
|
end
|
143
145
|
end
|
144
146
|
|
@@ -186,8 +188,8 @@ module Unix::Exec
|
|
186
188
|
# This is for sles based hosts.
|
187
189
|
# @param [String] env_file The ssh environment file to read from
|
188
190
|
def mirror_env_to_profile_d env_file
|
189
|
-
if self[:platform] =~ /sles-/
|
190
|
-
@logger.debug("mirroring environment to /etc/profile.d on sles platform host")
|
191
|
+
if self[:platform] =~ /opensuse|sles-/
|
192
|
+
@logger.debug("mirroring environment to /etc/profile.d on opensuse/sles platform host")
|
191
193
|
cur_env = exec(Beaker::Command.new("cat #{env_file}")).stdout
|
192
194
|
shell_env = ''
|
193
195
|
cur_env.each_line do |env_line|
|
@@ -282,7 +284,7 @@ module Unix::Exec
|
|
282
284
|
exec(Beaker::Command.new("systemctl restart sshd.service"))
|
283
285
|
when /el-|centos|fedora|redhat|oracle|scientific|eos/
|
284
286
|
exec(Beaker::Command.new("/sbin/service sshd restart"))
|
285
|
-
when /sles/
|
287
|
+
when /opensuse|sles/
|
286
288
|
exec(Beaker::Command.new("/usr/sbin/rcsshd restart"))
|
287
289
|
when /solaris/
|
288
290
|
exec(Beaker::Command.new("svcadm restart svc:/network/ssh:default"))
|
@@ -313,7 +315,7 @@ module Unix::Exec
|
|
313
315
|
directory = tmpdir()
|
314
316
|
exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
|
315
317
|
exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
|
316
|
-
when /sles/
|
318
|
+
when /opensuse|sles/
|
317
319
|
directory = tmpdir()
|
318
320
|
exec(Beaker::Command.new("echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit"))
|
319
321
|
exec(Beaker::Command.new("mv #{directory}/sshd_config.permit /etc/ssh/sshd_config"))
|
@@ -90,7 +90,7 @@ module Unix::File
|
|
90
90
|
case self['platform']
|
91
91
|
when /fedora|el-|redhat|centos/
|
92
92
|
'/etc/yum.repos.d/'
|
93
|
-
when /sles/
|
93
|
+
when /opensuse|sles/
|
94
94
|
'/etc/zypp/repos.d/'
|
95
95
|
when /debian|ubuntu|cumulus|huaweios/
|
96
96
|
'/etc/apt/sources.list.d'
|
@@ -113,7 +113,7 @@ module Unix::File
|
|
113
113
|
repo_filename = "pl-%s-%s-" % [ package_name, build_version ]
|
114
114
|
|
115
115
|
case variant
|
116
|
-
when /fedora|el|redhat|centos|cisco_nexus|cisco_ios_xr|sles/
|
116
|
+
when /fedora|el|redhat|centos|cisco_nexus|cisco_ios_xr|opensuse|sles/
|
117
117
|
variant = 'el' if ['centos', 'redhat'].include?(variant)
|
118
118
|
|
119
119
|
variant = 'redhatfips' if self['packaging_platform'] =~ /redhatfips/
|
@@ -154,7 +154,7 @@ module Unix::File
|
|
154
154
|
# @return [String] Type of repo (rpm|deb)
|
155
155
|
def repo_type
|
156
156
|
case self['platform']
|
157
|
-
when /fedora|el-|redhat|centos|sles/
|
157
|
+
when /fedora|el-|redhat|centos|opensuse|sles/
|
158
158
|
'rpm'
|
159
159
|
when /debian|ubuntu|cumulus|huaweios/
|
160
160
|
'deb'
|
data/lib/beaker/host/unix/pkg.rb
CHANGED
@@ -28,7 +28,7 @@ module Unix::Pkg
|
|
28
28
|
when /sles-10/
|
29
29
|
result = execute("zypper se -i --match-exact #{name}", opts) { |result| result }
|
30
30
|
result.stdout =~ /No packages found/ ? (return false) : (return result.exit_code == 0)
|
31
|
-
when /sles-/
|
31
|
+
when /opensuse|sles-/
|
32
32
|
if !self[:sles_rpmkeys_nightly_pl_imported]
|
33
33
|
# The `:sles_rpmkeys_nightly_pl_imported` key is only read here at this
|
34
34
|
# time. It's just to make sure that we only do the key import once, &
|
@@ -85,7 +85,7 @@ module Unix::Pkg
|
|
85
85
|
|
86
86
|
def install_package(name, cmdline_args = '', version = nil, opts = {})
|
87
87
|
case self['platform']
|
88
|
-
when /sles-/
|
88
|
+
when /opensuse|sles-/
|
89
89
|
execute("zypper --non-interactive --gpg-auto-import-keys in #{name}", opts)
|
90
90
|
when /el-4/
|
91
91
|
@logger.debug("Package installation not supported on rhel4")
|
@@ -177,7 +177,7 @@ module Unix::Pkg
|
|
177
177
|
|
178
178
|
def uninstall_package(name, cmdline_args = '', opts = {})
|
179
179
|
case self['platform']
|
180
|
-
when /sles-/
|
180
|
+
when /opensuse|sles-/
|
181
181
|
execute("zypper --non-interactive rm #{name}", opts)
|
182
182
|
when /el-4/
|
183
183
|
@logger.debug("Package uninstallation not supported on rhel4")
|
@@ -207,7 +207,7 @@ module Unix::Pkg
|
|
207
207
|
# the package manager
|
208
208
|
def upgrade_package(name, cmdline_args = '', opts = {})
|
209
209
|
case self['platform']
|
210
|
-
when /sles-/
|
210
|
+
when /opensuse|sles-/
|
211
211
|
execute("zypper --non-interactive --no-gpg-checks up #{name}", opts)
|
212
212
|
when /el-4/
|
213
213
|
@logger.debug("Package upgrade is not supported on rhel4")
|
@@ -302,7 +302,7 @@ module Unix::Pkg
|
|
302
302
|
deploy_yum_repo(path, name, version)
|
303
303
|
when /ubuntu|debian|cumulus|huaweios/
|
304
304
|
deploy_apt_repo(path, name, version)
|
305
|
-
when /sles/
|
305
|
+
when /opensuse|sles/
|
306
306
|
deploy_zyp_repo(path, name, version)
|
307
307
|
else
|
308
308
|
# solaris, windows
|
@@ -424,12 +424,15 @@ module Unix::Pkg
|
|
424
424
|
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
|
425
425
|
|
426
426
|
variant, version, arch, codename = self['platform'].to_array
|
427
|
+
|
427
428
|
case variant
|
428
429
|
when /^(solaris)$/
|
429
430
|
release_path_end, release_file = solaris_puppet_agent_dev_package_info(
|
430
431
|
puppet_collection, puppet_agent_version, opts )
|
431
|
-
when /^(sles|aix|el|centos|oracle|redhat|scientific)$/
|
432
|
+
when /^(opensuse|sles|aix|el|centos|oracle|redhat|scientific)$/
|
432
433
|
variant = 'el' if variant.match(/(?:el|centos|oracle|redhat|scientific)/)
|
434
|
+
variant = 'sles' if variant == 'opensuse'
|
435
|
+
|
433
436
|
if variant == 'aix'
|
434
437
|
arch = 'ppc' if arch == 'power'
|
435
438
|
version_x, version_y = /^(\d+)\.(\d+)/.match(puppet_agent_version).captures.map(&:to_i)
|
@@ -464,7 +467,7 @@ module Unix::Pkg
|
|
464
467
|
|
465
468
|
variant, version, arch, codename = self['platform'].to_array
|
466
469
|
case variant
|
467
|
-
when /^(fedora|el|centos|redhat|sles)$/
|
470
|
+
when /^(fedora|el|centos|redhat|opensuse|sles)$/
|
468
471
|
variant = ((['centos', 'redhat'].include?(variant)) ? 'el' : variant)
|
469
472
|
release_file = "/repos/#{variant}/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*.rpm"
|
470
473
|
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
@@ -524,9 +527,9 @@ module Unix::Pkg
|
|
524
527
|
case variant
|
525
528
|
when /^(fedora|el|redhat|centos)$/
|
526
529
|
command_name = 'yum'
|
527
|
-
command_name = 'dnf' if variant == 'fedora' && version > 21
|
530
|
+
command_name = 'dnf' if variant == 'fedora' && version.to_i > 21
|
528
531
|
execute("#{command_name} --nogpgcheck localinstall -y #{onhost_package_file}")
|
529
|
-
when /^(sles)$/
|
532
|
+
when /^(opensuse|sles)$/
|
530
533
|
execute("zypper --non-interactive --no-gpg-checks in #{onhost_package_file}")
|
531
534
|
when /^(debian|ubuntu|cumulus)$/
|
532
535
|
execute("dpkg -i --force-all #{onhost_package_file}")
|
@@ -552,7 +555,7 @@ module Unix::Pkg
|
|
552
555
|
def uncompress_local_tarball(onhost_tar_file, onhost_base_dir, download_file)
|
553
556
|
variant, version, arch, codename = self['platform'].to_array
|
554
557
|
case variant
|
555
|
-
when /^(fedora|el|centos|redhat|sles|debian|ubuntu|cumulus)$/
|
558
|
+
when /^(fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/
|
556
559
|
execute("tar -zxvf #{onhost_tar_file} -C #{onhost_base_dir}")
|
557
560
|
when /^solaris$/
|
558
561
|
# uncompress PE puppet-agent tarball
|
@@ -13,6 +13,7 @@ module Beaker
|
|
13
13
|
SLEEPWAIT = 5
|
14
14
|
TRIES = 5
|
15
15
|
RHEL8_PACKAGES = ['curl', 'chrony']
|
16
|
+
FEDORA_PACKAGES = ['curl', 'chrony']
|
16
17
|
UNIX_PACKAGES = ['curl', 'ntpdate']
|
17
18
|
FREEBSD_PACKAGES = ['curl', 'perl5|perl']
|
18
19
|
OPENBSD_PACKAGES = ['curl']
|
@@ -52,9 +53,9 @@ module Beaker
|
|
52
53
|
logger.notify "NTP date succeeded on #{host}"
|
53
54
|
else
|
54
55
|
case
|
55
|
-
when host['platform'] =~ /el-8/
|
56
|
+
when host['platform'] =~ /el-8|fedora/
|
56
57
|
ntp_command = "chronyc add server #{ntp_server} prefer trust;chronyc makestep;chronyc burst 1/2"
|
57
|
-
when host['platform'] =~ /sles-/
|
58
|
+
when host['platform'] =~ /opensuse-|sles-/
|
58
59
|
ntp_command = "sntp #{ntp_server}"
|
59
60
|
when host['platform'] =~ /cisco_nexus/
|
60
61
|
ntp_server = host.exec(Command.new("getent hosts #{NTPSERVER} | head -n1 |cut -d \" \" -f1"), :acceptable_exit_codes => [0]).stdout
|
@@ -105,7 +106,7 @@ module Beaker
|
|
105
106
|
check_and_install_packages_if_needed(host, RHEL8_PACKAGES)
|
106
107
|
when host['platform'] =~ /sles-10/
|
107
108
|
check_and_install_packages_if_needed(host, SLES10_PACKAGES)
|
108
|
-
when host['platform'] =~ /sles-/
|
109
|
+
when host['platform'] =~ /opensuse|sles-/
|
109
110
|
check_and_install_packages_if_needed(host, SLES_PACKAGES)
|
110
111
|
when host['platform'] =~ /debian/
|
111
112
|
check_and_install_packages_if_needed(host, DEBIAN_PACKAGES)
|
@@ -126,7 +127,9 @@ module Beaker
|
|
126
127
|
check_and_install_packages_if_needed(host, SOLARIS11_PACKAGES)
|
127
128
|
when host['platform'] =~ /archlinux/
|
128
129
|
check_and_install_packages_if_needed(host, ARCHLINUX_PACKAGES)
|
129
|
-
when host['platform']
|
130
|
+
when host['platform'] =~ /fedora/
|
131
|
+
check_and_install_packages_if_needed(host, FEDORA_PACKAGES)
|
132
|
+
when host['platform'] !~ /debian|aix|solaris|windows|opensuse-|sles-|osx-|cumulus|f5-|netscaler|cisco_/
|
130
133
|
check_and_install_packages_if_needed(host, UNIX_PACKAGES)
|
131
134
|
end
|
132
135
|
end
|
@@ -53,9 +53,12 @@ module Beaker
|
|
53
53
|
result.stdout << std_out
|
54
54
|
result.stderr << std_err
|
55
55
|
result.exit_code = status.exitstatus
|
56
|
+
@logger.info(result.stdout) unless result.stdout.empty?
|
57
|
+
@logger.info(result.stderr) unless result.stderr.empty?
|
56
58
|
end
|
57
59
|
rescue => e
|
58
60
|
result.stderr << e.inspect
|
61
|
+
@logger.info(result.stderr)
|
59
62
|
result.exit_code = 1
|
60
63
|
end
|
61
64
|
|
data/lib/beaker/perf.rb
CHANGED
@@ -4,7 +4,7 @@ module Beaker
|
|
4
4
|
|
5
5
|
PERF_PACKAGES = ['sysstat']
|
6
6
|
# SLES does not treat sysstat as a service that can be started
|
7
|
-
PERF_SUPPORTED_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|sles/
|
7
|
+
PERF_SUPPORTED_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus|opensuse|sles/
|
8
8
|
PERF_START_PLATFORMS = /debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|eos|cumulus/
|
9
9
|
|
10
10
|
# Create the Perf instance and runs setup_perf_on_host on all hosts if --collect-perf-data
|
@@ -42,7 +42,7 @@ module Beaker
|
|
42
42
|
if host['platform'] =~ /debian|ubuntu|cumulus/
|
43
43
|
@logger.perf_output("Modify /etc/default/sysstat on Debian and Ubuntu platforms")
|
44
44
|
host.exec(Command.new('sed -i s/ENABLED=\"false\"/ENABLED=\"true\"/ /etc/default/sysstat'))
|
45
|
-
elsif host['platform'] =~ /sles/
|
45
|
+
elsif host['platform'] =~ /opensuse|sles/
|
46
46
|
@logger.perf_output("Creating symlink from /etc/sysstat/sysstat.cron to /etc/cron.d")
|
47
47
|
host.exec(Command.new('ln -s /etc/sysstat/sysstat.cron /etc/cron.d'),:acceptable_exit_codes => [0,1])
|
48
48
|
end
|
data/lib/beaker/platform.rb
CHANGED
@@ -3,14 +3,15 @@ module Beaker
|
|
3
3
|
# all String methods while adding several platform-specific use cases.
|
4
4
|
class Platform < String
|
5
5
|
# Supported platforms
|
6
|
-
PLATFORMS = /^(alpine|huaweios|cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|sles|ubuntu|windows|solaris|aix|archlinux|el|eos|cumulus|f5|netscaler)\-.+\-.+$/
|
6
|
+
PLATFORMS = /^(alpine|huaweios|cisco_nexus|cisco_ios_xr|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|opensuse|sles|ubuntu|windows|solaris|aix|archlinux|el|eos|cumulus|f5|netscaler)\-.+\-.+$/
|
7
7
|
# Platform version numbers vs. codenames conversion hash
|
8
8
|
PLATFORM_VERSION_CODES =
|
9
|
-
{ :debian => { "
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
9
|
+
{ :debian => { "bullseye" => "11",
|
10
|
+
"buster" => "10",
|
11
|
+
"stretch" => "9",
|
12
|
+
"jessie" => "8",
|
13
|
+
"wheezy" => "7",
|
14
|
+
"squeeze" => "6",
|
14
15
|
},
|
15
16
|
:ubuntu => { "focal" => "2004",
|
16
17
|
"eoan" => "1910",
|
@@ -68,6 +69,7 @@ module Beaker
|
|
68
69
|
# * redhat
|
69
70
|
# * redhatfips
|
70
71
|
# * scientific
|
72
|
+
# * opensuse
|
71
73
|
# * sles
|
72
74
|
# * ubuntu
|
73
75
|
# * windows
|
data/lib/beaker/version.rb
CHANGED
@@ -89,6 +89,7 @@ describe ClassMixedWithDSLHelpers do
|
|
89
89
|
describe "#fetch_http_dir" do
|
90
90
|
let( :logger) { double("Beaker::Logger", :notify => nil , :debug => nil ) }
|
91
91
|
let( :result) { double(:each_line => []) }
|
92
|
+
let( :status) { double('Process::Status', success?: true) }
|
92
93
|
|
93
94
|
before do
|
94
95
|
fetch_allows
|
@@ -97,8 +98,7 @@ describe ClassMixedWithDSLHelpers do
|
|
97
98
|
describe "given valid arguments" do
|
98
99
|
|
99
100
|
it "returns basename of first argument concatenated to second." do
|
100
|
-
expect(
|
101
|
-
expect($?).to receive(:to_i).and_return(0)
|
101
|
+
expect(Open3).to receive(:capture2e).with(/^wget.*/).ordered { result }.and_return(['', status])
|
102
102
|
result = subject.fetch_http_dir "#{url}/beep", destdir
|
103
103
|
expect(result).to eq("#{destdir}/beep")
|
104
104
|
end
|
@@ -76,6 +76,11 @@ module Beaker
|
|
76
76
|
expect( instance.package_config_dir ).to be === '/etc/zypp/repos.d/'
|
77
77
|
end
|
78
78
|
|
79
|
+
it 'returns correctly for opensuse-based platforms' do
|
80
|
+
@platform = 'opensuse-15-x86_64'
|
81
|
+
expect( instance.package_config_dir ).to be === '/etc/zypp/repos.d/'
|
82
|
+
end
|
83
|
+
|
79
84
|
it 'errors for all other platform types' do
|
80
85
|
@platform = 'eos-4-x86_64'
|
81
86
|
expect {
|
@@ -102,6 +107,13 @@ module Beaker
|
|
102
107
|
expect( filename ).to match( /sion7\-sles\-/ )
|
103
108
|
end
|
104
109
|
|
110
|
+
it 'sets the opensuse portion correctly for opensuse platforms' do
|
111
|
+
@platform = 'opensuse-15-x86_64'
|
112
|
+
allow( instance ).to receive( :is_pe? ) { false }
|
113
|
+
filename = instance.repo_filename( 'pkg_name', 'pkg_version7' )
|
114
|
+
expect( filename ).to match( /sion7\-opensuse\-/ )
|
115
|
+
end
|
116
|
+
|
105
117
|
it 'builds the filename correctly for el-based platforms' do
|
106
118
|
@platform = 'el-21-x86_64'
|
107
119
|
allow( instance ).to receive( :is_pe? ) { false }
|
@@ -73,6 +73,13 @@ module Beaker
|
|
73
73
|
instance.deploy_package_repo(path,name,version)
|
74
74
|
end
|
75
75
|
|
76
|
+
it 'calls #deploy_zyp_repo for opensuse systems' do
|
77
|
+
@opts = {'platform' => 'opensuse-is-me'}
|
78
|
+
expect(instance).to receive(:deploy_zyp_repo)
|
79
|
+
allow(File).to receive(:exists?).with(path).and_return(true)
|
80
|
+
instance.deploy_package_repo(path,name,version)
|
81
|
+
end
|
82
|
+
|
76
83
|
it 'raises an error for unsupported systems' do
|
77
84
|
@opts = {'platform' => 'windows-is-me'}
|
78
85
|
allow(File).to receive(:exists?).with(path).and_return(true)
|
@@ -102,6 +109,14 @@ module Beaker
|
|
102
109
|
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
|
103
110
|
expect( instance.check_for_package(pkg) ).to be === true
|
104
111
|
end
|
112
|
+
it "checks correctly on opensuse" do
|
113
|
+
@opts = {'platform' => 'opensuse-is-me'}
|
114
|
+
pkg = 'sles_package'
|
115
|
+
expect( Beaker::Command ).to receive( :new ).with( /^rpmkeys.*nightlies.puppetlabs.com.*/, anything, anything ).and_return('').ordered.once
|
116
|
+
expect( Beaker::Command ).to receive(:new).with("zypper --gpg-auto-import-keys se -i --match-exact #{pkg}", [], {:prepend_cmds=>nil, :cmdexe=>false}).and_return('').ordered.once
|
117
|
+
expect( instance ).to receive(:exec).with('', :accept_all_exit_codes => true).and_return(generate_result("hello", {:exit_code => 0})).exactly(2).times
|
118
|
+
expect( instance.check_for_package(pkg) ).to be === true
|
119
|
+
end
|
105
120
|
|
106
121
|
it "checks correctly on fedora" do
|
107
122
|
@opts = {'platform' => 'fedora-is-me'}
|
@@ -297,6 +312,7 @@ module Beaker
|
|
297
312
|
platforms = { 'solaris-10-x86_64' => ["solaris/10/#{puppet_collection}", "puppet-agent-#{puppet_agent_version}-1.i386.pkg.gz"],
|
298
313
|
'solaris-11-x86_64' => ["solaris/11/#{puppet_collection}", "puppet-agent@#{puppet_agent_version},5.11-1.i386.p5p"],
|
299
314
|
'sles-11-x86_64' => ["sles/11/#{puppet_collection}/x86_64", "puppet-agent-#{puppet_agent_version}-1.sles11.x86_64.rpm"],
|
315
|
+
'opensuse-15-x86_64' => ["sles/15/#{puppet_collection}/x86_64", "puppet-agent-#{puppet_agent_version}-1.sles15.x86_64.rpm"],
|
300
316
|
'aix-6.1-power' => ["aix/6.1/#{puppet_collection}/ppc", "puppet-agent-#{puppet_agent_version}-1.aix6.1.ppc.rpm"],
|
301
317
|
'el-7-x86_64' => ["el/7/#{puppet_collection}/x86_64", "puppet-agent-#{puppet_agent_version}-1.el7.x86_64.rpm"],
|
302
318
|
'centos-7-x86_64' => ["el/7/#{puppet_collection}/x86_64", "puppet-agent-#{puppet_agent_version}-1.el7.x86_64.rpm"],
|
@@ -509,14 +525,9 @@ module Beaker
|
|
509
525
|
describe '#install_local_package' do
|
510
526
|
let( :platform ) { @platform || 'fedora' }
|
511
527
|
let( :version ) { @version || 6 }
|
512
|
-
let( :platform_mock ) {
|
513
|
-
mock = Object.new
|
514
|
-
allow( mock ).to receive( :to_array ) { [platform, version, '', ''] }
|
515
|
-
mock
|
516
|
-
}
|
517
528
|
|
518
529
|
before :each do
|
519
|
-
allow( instance ).to receive( :[] ).with( 'platform' ) {
|
530
|
+
allow( instance ).to receive( :[] ).with( 'platform' ) { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
|
520
531
|
end
|
521
532
|
|
522
533
|
it 'Fedora 22-39: uses dnf' do
|
@@ -530,7 +541,6 @@ module Beaker
|
|
530
541
|
|
531
542
|
it 'Fedora 21 uses yum' do
|
532
543
|
package_file = 'testing_456.yay'
|
533
|
-
platform_mock = Object.new
|
534
544
|
[21].each do |version|
|
535
545
|
@version = version
|
536
546
|
expect( instance ).to receive( :execute ).with( /^yum.*#{package_file}$/ )
|
@@ -578,18 +588,13 @@ module Beaker
|
|
578
588
|
let( :tar_file ) { 'test.tar.gz' }
|
579
589
|
let( :base_dir ) { '/base/dir/fake' }
|
580
590
|
let( :download_file ) { 'download_file.txt' }
|
581
|
-
let( :platform_mock ) {
|
582
|
-
mock = Object.new
|
583
|
-
allow( mock ).to receive( :to_array ) { [platform, version, '', ''] }
|
584
|
-
mock
|
585
|
-
}
|
586
591
|
|
587
592
|
before :each do
|
588
|
-
allow( instance ).to receive( :[] ).with( 'platform' ) {
|
593
|
+
allow( instance ).to receive( :[] ).with( 'platform' ) { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
|
589
594
|
end
|
590
595
|
|
591
596
|
it 'rejects unsupported platforms' do
|
592
|
-
@platform = '
|
597
|
+
@platform = 'cisco_nexus'
|
593
598
|
expect {
|
594
599
|
instance.uncompress_local_tarball( tar_file, base_dir, download_file )
|
595
600
|
}.to raise_error(
|
@@ -605,6 +610,14 @@ module Beaker
|
|
605
610
|
instance.uncompress_local_tarball( tar_file, base_dir, download_file )
|
606
611
|
end
|
607
612
|
|
613
|
+
it 'untars the file given' do
|
614
|
+
@platform = 'opensuse'
|
615
|
+
expect( instance ).to receive( :execute ).with(
|
616
|
+
/^tar .* #{tar_file} .* #{base_dir}$/
|
617
|
+
)
|
618
|
+
instance.uncompress_local_tarball( tar_file, base_dir, download_file )
|
619
|
+
end
|
620
|
+
|
608
621
|
context 'on solaris' do
|
609
622
|
|
610
623
|
before :each do
|
@@ -170,6 +170,14 @@ module Unix
|
|
170
170
|
expect( release_file ).to be === "puppet-agent-pa_version1-1.sles12.arch.rpm"
|
171
171
|
end
|
172
172
|
|
173
|
+
it 'sets up opensuse platforms correctly' do
|
174
|
+
@platform = 'opensuse-15-x86_64'
|
175
|
+
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
176
|
+
'pa_collection', 'pa_version1' )
|
177
|
+
expect( release_path_end ).to be === "sles/15/pa_collection/x86_64"
|
178
|
+
expect( release_file ).to be === "puppet-agent-pa_version1-1.sles15.x86_64.rpm"
|
179
|
+
end
|
180
|
+
|
173
181
|
it 'sets the arch correctly on aix-power platforms' do
|
174
182
|
@platform = 'aix-6.1-power'
|
175
183
|
release_path_end, release_file = host.puppet_agent_dev_package_info(
|
@@ -234,4 +242,4 @@ module Unix
|
|
234
242
|
end
|
235
243
|
end
|
236
244
|
end
|
237
|
-
end
|
245
|
+
end
|