beaker 5.8.1 → 6.1.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 +4 -4
- data/.rspec +0 -1
- data/.rubocop.yml +4 -4
- data/.rubocop_todo.yml +15 -17
- data/CHANGELOG.md +31 -1
- data/Rakefile +2 -10
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +6 -6
- data/acceptance/tests/base/host/packages.rb +0 -2
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -1
- data/beaker.gemspec +1 -1
- data/docs/concepts/argument_processing_and_precedence.md +1 -1
- data/lib/beaker/command.rb +1 -5
- data/lib/beaker/host/unix/exec.rb +8 -10
- data/lib/beaker/host/unix/file.rb +4 -13
- data/lib/beaker/host/unix/pkg.rb +12 -21
- data/lib/beaker/host/unix.rb +0 -12
- data/lib/beaker/host.rb +0 -6
- data/lib/beaker/host_prebuilt_steps.rb +13 -23
- data/lib/beaker/network_manager.rb +0 -1
- data/lib/beaker/options/command_line_parser.rb +1 -1
- data/lib/beaker/options/parser.rb +2 -2
- data/lib/beaker/perf.rb +3 -3
- data/lib/beaker/platform.rb +3 -31
- data/lib/beaker/version.rb +1 -1
- data/spec/beaker/host/unix/exec_spec.rb +6 -22
- data/spec/beaker/host/unix/file_spec.rb +3 -31
- data/spec/beaker/host/unix/pkg_spec.rb +26 -41
- data/spec/beaker/host/unix_spec.rb +0 -8
- data/spec/beaker/host_prebuilt_steps_spec.rb +11 -71
- data/spec/beaker/options/parser_spec.rb +0 -1
- data/spec/beaker/platform_spec.rb +20 -50
- data/spec/helpers.rb +13 -28
- metadata +4 -20
- data/acceptance/fixtures/module/spec/acceptance/nodesets/fedora-18-x64.yml +0 -10
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-20-i386.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-20-x86_64.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-21-i386.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-21-x86_64.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-22-i386.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-22-x86_64.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-i386.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-x86_64.repo +0 -6
- data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-24-x86_64.repo +0 -6
- data/docs/how_to/hosts/cisco.md +0 -40
- data/docs/how_to/hosts/eos.md +0 -11
- data/lib/beaker/host/cisco.rb +0 -159
- data/lib/beaker/host/eos.rb +0 -33
- data/spec/beaker/host/cisco_spec.rb +0 -332
- data/spec/beaker/host/eos_spec.rb +0 -44
@@ -61,7 +61,6 @@ module Beaker
|
|
61
61
|
@machines[hypervisor] = [] unless @machines[hypervisor]
|
62
62
|
hostless_options[:timesync] = host_hash[:timesync] if host_hash[:timesync] != nil
|
63
63
|
host_itself = Beaker::Host.create(name, host_hash, hostless_options)
|
64
|
-
host_itself.validate_setup
|
65
64
|
@machines[hypervisor] << host_itself
|
66
65
|
end
|
67
66
|
|
@@ -204,7 +204,7 @@ module Beaker
|
|
204
204
|
end
|
205
205
|
|
206
206
|
opts.on '--repo-proxy',
|
207
|
-
'Proxy packaging repositories on ubuntu, debian
|
207
|
+
'Proxy packaging repositories on ubuntu, debian and solaris-11',
|
208
208
|
'(default: false)' do
|
209
209
|
@cmd_options[:repo_proxy] = true
|
210
210
|
end
|
@@ -364,10 +364,10 @@ module Beaker
|
|
364
364
|
|
365
365
|
@validator.validate_master_count(master)
|
366
366
|
|
367
|
-
# check that windows
|
367
|
+
# check that windows boxes are only agents (solaris can be a master in foss cases)
|
368
368
|
@options[:HOSTS].each_key do |name|
|
369
369
|
host = @options[:HOSTS][name]
|
370
|
-
test_host_roles(name, host) if
|
370
|
+
test_host_roles(name, host) if host[:platform].include?('windows')
|
371
371
|
|
372
372
|
# check to see if a custom user account has been provided, if so use it
|
373
373
|
host[:user] = host[:ssh][:user] if host[:ssh] && host[:ssh][:user]
|
data/lib/beaker/perf.rb
CHANGED
@@ -3,8 +3,8 @@ module Beaker
|
|
3
3
|
class Perf
|
4
4
|
PERF_PACKAGES = ['sysstat']
|
5
5
|
# SLES does not treat sysstat as a service that can be started
|
6
|
-
PERF_SUPPORTED_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|
|
7
|
-
PERF_START_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el
|
6
|
+
PERF_SUPPORTED_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el|opensuse|sles/
|
7
|
+
PERF_START_PLATFORMS = /amazon|debian|ubuntu|redhat|centos|oracle|scientific|fedora|el/
|
8
8
|
|
9
9
|
# Create the Perf instance and runs setup_perf_on_host on all hosts if --collect-perf-data
|
10
10
|
# was used as an option on the Baker command line invocation. Instances of this class do not
|
@@ -36,7 +36,7 @@ module Beaker
|
|
36
36
|
@logger.perf_output("Perf (sysstat) not supported on host: " + host)
|
37
37
|
end
|
38
38
|
|
39
|
-
if /debian|ubuntu
|
39
|
+
if /debian|ubuntu/.match?(host['platform'])
|
40
40
|
@logger.perf_output("Modify /etc/default/sysstat on Debian and Ubuntu platforms")
|
41
41
|
host.exec(Command.new('sed -i s/ENABLED=\"false\"/ENABLED=\"true\"/ /etc/default/sysstat'))
|
42
42
|
elsif /opensuse|sles/.match?(host['platform'])
|
data/lib/beaker/platform.rb
CHANGED
@@ -3,40 +3,18 @@ module Beaker
|
|
3
3
|
# all String methods while adding several platform-specific use cases.
|
4
4
|
class Platform < String
|
5
5
|
# Supported platforms
|
6
|
-
|
7
|
-
PLATFORMS = /^(alpine|amazon|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)\-.+\-.+$/
|
8
|
-
# rubocop:enable Layout/LineLength
|
6
|
+
PLATFORMS = /^(alpine|amazon|(free|open)bsd|osx|centos|fedora|debian|oracle|redhat|redhatfips|scientific|opensuse|sles|ubuntu|windows|solaris|aix|archlinux|el)\-.+\-.+$/
|
9
7
|
# Platform version numbers vs. codenames conversion hash
|
10
8
|
PLATFORM_VERSION_CODES =
|
11
9
|
{ :debian => { "forky" => "14",
|
12
10
|
"trixie" => "13",
|
13
11
|
"bookworm" => "12",
|
14
12
|
"bullseye" => "11",
|
15
|
-
"buster" => "10",
|
16
|
-
"stretch" => "9",
|
17
|
-
"jessie" => "8",
|
18
|
-
"wheezy" => "7",
|
19
|
-
"squeeze" => "6", },
|
13
|
+
"buster" => "10", },
|
20
14
|
:ubuntu => { "noble" => "2404",
|
21
15
|
"jammy" => "2204",
|
22
16
|
"focal" => "2004",
|
23
|
-
"
|
24
|
-
"disco" => "1904",
|
25
|
-
"cosmic" => "1810",
|
26
|
-
"bionic" => "1804",
|
27
|
-
"artful" => "1710",
|
28
|
-
"zesty" => "1704",
|
29
|
-
"yakkety" => "1610",
|
30
|
-
"xenial" => "1604",
|
31
|
-
"wily" => "1510",
|
32
|
-
"vivid" => "1504",
|
33
|
-
"utopic" => "1410",
|
34
|
-
"trusty" => "1404",
|
35
|
-
"saucy" => "1310",
|
36
|
-
"raring" => "1304",
|
37
|
-
"quantal" => "1210",
|
38
|
-
"precise" => "1204",
|
39
|
-
"lucid" => "1004", },
|
17
|
+
"bionic" => "1804", },
|
40
18
|
:osx => { "highsierra" => "1013",
|
41
19
|
"sierra" => "1012",
|
42
20
|
"elcapitan" => "1011",
|
@@ -60,9 +38,6 @@ module Beaker
|
|
60
38
|
# provided meets the platform formatting rules. Platforms name must be of
|
61
39
|
# the format /^OSFAMILY-VERSION-ARCH.*$/ where OSFAMILY is one of:
|
62
40
|
# * amazon
|
63
|
-
# * huaweios
|
64
|
-
# * cisco_nexus
|
65
|
-
# * cisco_ios_xr
|
66
41
|
# * freebsd
|
67
42
|
# * openbsd
|
68
43
|
# * osx
|
@@ -80,9 +55,6 @@ module Beaker
|
|
80
55
|
# * solaris
|
81
56
|
# * aix
|
82
57
|
# * el
|
83
|
-
# * cumulus
|
84
|
-
# * f5
|
85
|
-
# * netscaler
|
86
58
|
# * archlinux
|
87
59
|
def initialize(name)
|
88
60
|
raise ArgumentError, "Unsupported platform name #{name}" if !PLATFORMS.match?(name)
|
data/lib/beaker/version.rb
CHANGED
@@ -82,7 +82,7 @@ module Beaker
|
|
82
82
|
let(:ssh_command) { "echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit" }
|
83
83
|
let(:ssh_move) { "mv #{directory}/sshd_config.permit /etc/ssh/sshd_config" }
|
84
84
|
|
85
|
-
platforms = PlatformHelpers::
|
85
|
+
platforms = PlatformHelpers::REDHATPLATFORMS + PlatformHelpers::DEBIANPLATFORMS
|
86
86
|
|
87
87
|
platforms.each do |platform|
|
88
88
|
it "calls the correct commands for #{platform}" do
|
@@ -106,7 +106,7 @@ module Beaker
|
|
106
106
|
end
|
107
107
|
|
108
108
|
describe '#ssh_service_restart' do
|
109
|
-
PlatformHelpers::
|
109
|
+
PlatformHelpers::REDHATPLATFORMS.each do |platform|
|
110
110
|
it "calls the correct command for #{platform}" do
|
111
111
|
opts['platform'] = platform
|
112
112
|
expect(instance).to receive(:exec)
|
@@ -116,34 +116,18 @@ module Beaker
|
|
116
116
|
end
|
117
117
|
|
118
118
|
PlatformHelpers::DEBIANPLATFORMS.each do |platform|
|
119
|
-
it "calls the
|
119
|
+
it "calls the ssh service restart command for #{platform}" do
|
120
120
|
opts['platform'] = platform
|
121
121
|
expect(instance).to receive(:exec)
|
122
|
-
expect(Beaker::Command).to receive(:new).with("
|
123
|
-
expect { instance.ssh_service_restart }.not_to raise_error
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
PlatformHelpers::SYSTEMVPLATFORMS.each do |platform|
|
128
|
-
it "calls the correct command for #{platform}" do
|
129
|
-
opts['platform'] = "#{platform}-arch"
|
130
|
-
expect(instance).to receive(:exec)
|
131
|
-
expect(Beaker::Command).to receive(:new).with("/sbin/service sshd restart")
|
122
|
+
expect(Beaker::Command).to receive(:new).with("systemctl restart ssh")
|
132
123
|
expect { instance.ssh_service_restart }.not_to raise_error
|
133
124
|
end
|
134
125
|
end
|
135
|
-
|
136
|
-
it 'raises an error on unsupported platforms' do
|
137
|
-
opts['platform'] = 'notarealthing02-parts-arch'
|
138
|
-
expect do
|
139
|
-
instance.ssh_service_restart
|
140
|
-
end.to raise_error(ArgumentError, /#{opts['platform']}/)
|
141
|
-
end
|
142
126
|
end
|
143
127
|
|
144
128
|
describe '#prepend_commands' do
|
145
|
-
it 'returns the pc parameter unchanged for
|
146
|
-
allow(instance).to receive(:[]).with(:platform).and_return('
|
129
|
+
it 'returns the pc parameter unchanged for all platforms' do
|
130
|
+
allow(instance).to receive(:[]).with(:platform).and_return('unix')
|
147
131
|
answer_prepend_commands = 'pc_param_unchanged_13579'
|
148
132
|
answer_test = instance.prepend_commands('fake_cmd', answer_prepend_commands)
|
149
133
|
expect(answer_test).to be === answer_prepend_commands
|
@@ -44,13 +44,6 @@ module Beaker
|
|
44
44
|
@platform = 'debian-6-x86_64'
|
45
45
|
expect(instance.repo_type).to be === 'deb'
|
46
46
|
end
|
47
|
-
|
48
|
-
it 'errors for all other platform types' do
|
49
|
-
@platform = 'eos-4-x86_64'
|
50
|
-
expect do
|
51
|
-
instance.repo_type
|
52
|
-
end.to raise_error(ArgumentError, /repo\ type\ not\ known/)
|
53
|
-
end
|
54
47
|
end
|
55
48
|
|
56
49
|
describe '#package_config_dir' do
|
@@ -75,13 +68,6 @@ module Beaker
|
|
75
68
|
@platform = 'opensuse-15-x86_64'
|
76
69
|
expect(instance.package_config_dir).to be === '/etc/zypp/repos.d/'
|
77
70
|
end
|
78
|
-
|
79
|
-
it 'errors for all other platform types' do
|
80
|
-
@platform = 'eos-4-x86_64'
|
81
|
-
expect do
|
82
|
-
instance.package_config_dir
|
83
|
-
end.to raise_error(ArgumentError, /package\ config\ dir\ unknown/)
|
84
|
-
end
|
85
71
|
end
|
86
72
|
|
87
73
|
describe '#repo_filename' do
|
@@ -142,26 +128,12 @@ module Beaker
|
|
142
128
|
end
|
143
129
|
|
144
130
|
it 'builds the filename correctly for debian-based platforms' do
|
145
|
-
@platform = 'debian-
|
131
|
+
@platform = 'debian-12-x86_64'
|
146
132
|
filename = instance.repo_filename('pkg_name', 'pkg_version10')
|
147
|
-
correct = 'pl-pkg_name-pkg_version10-
|
133
|
+
correct = 'pl-pkg_name-pkg_version10-bookworm.list'
|
148
134
|
expect(filename).to be === correct
|
149
135
|
end
|
150
136
|
|
151
|
-
it 'uses the variant for the codename on the cumulus platform' do
|
152
|
-
@platform = 'cumulus-2.5-x86_64'
|
153
|
-
filename = instance.repo_filename('pkg_name', 'pkg_version11')
|
154
|
-
correct = 'pl-pkg_name-pkg_version11-cumulus.list'
|
155
|
-
expect(filename).to be === correct
|
156
|
-
end
|
157
|
-
|
158
|
-
it 'adds wrlinux to variant on cisco platforms' do
|
159
|
-
@platform = 'cisco_nexus-7-x86_64'
|
160
|
-
allow(instance).to receive(:is_pe?).and_return(false)
|
161
|
-
filename = instance.repo_filename('pkg_name', 'pkg_version12')
|
162
|
-
expect(filename).to match(/sion12\-cisco\-wrlinux\-/)
|
163
|
-
end
|
164
|
-
|
165
137
|
it 'errors for non-el or debian-based platforms' do
|
166
138
|
@platform = 'freebsd-22-x86_64'
|
167
139
|
expect do
|
@@ -172,7 +144,7 @@ module Beaker
|
|
172
144
|
|
173
145
|
describe '#noask_file_text' do
|
174
146
|
it 'errors on non-solaris platforms' do
|
175
|
-
@platform = '
|
147
|
+
@platform = 'debian-12-x86_64'
|
176
148
|
expect do
|
177
149
|
instance.noask_file_text
|
178
150
|
end.to raise_error(ArgumentError, /^noask\ file\ text\ unknown/)
|
@@ -68,14 +68,6 @@ module Beaker
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
it "checks correctly on EOS" do
|
72
|
-
@opts = { 'platform' => 'eos-is-me' }
|
73
|
-
pkg = 'eos-package'
|
74
|
-
expect(Beaker::Command).to receive(:new).with("rpm -q #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
75
|
-
expect(instance).to receive(:exec).with('', { :accept_all_exit_codes => true }).and_return(generate_result("hello", { :exit_code => 0 }))
|
76
|
-
expect(instance.check_for_package(pkg)).to be === true
|
77
|
-
end
|
78
|
-
|
79
71
|
it "checks correctly on el-" do
|
80
72
|
@opts = { 'platform' => 'el-is-me' }
|
81
73
|
pkg = 'el_package'
|
@@ -84,14 +76,6 @@ module Beaker
|
|
84
76
|
expect(instance.check_for_package(pkg)).to be === true
|
85
77
|
end
|
86
78
|
|
87
|
-
it "checks correctly on huaweios" do
|
88
|
-
@opts = { 'platform' => 'huaweios-is-me' }
|
89
|
-
pkg = 'debian_package'
|
90
|
-
expect(Beaker::Command).to receive(:new).with("dpkg -s #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
91
|
-
expect(instance).to receive(:exec).with('', { :accept_all_exit_codes => true }).and_return(generate_result("hello", { :exit_code => 0 }))
|
92
|
-
expect(instance.check_for_package(pkg)).to be === true
|
93
|
-
end
|
94
|
-
|
95
79
|
it "checks correctly on debian" do
|
96
80
|
@opts = { 'platform' => 'debian-is-me' }
|
97
81
|
pkg = 'debian_package'
|
@@ -108,14 +92,6 @@ module Beaker
|
|
108
92
|
expect(instance.check_for_package(pkg)).to be === true
|
109
93
|
end
|
110
94
|
|
111
|
-
it "checks correctly on cumulus" do
|
112
|
-
@opts = { 'platform' => 'cumulus-is-me' }
|
113
|
-
pkg = 'cumulus_package'
|
114
|
-
expect(Beaker::Command).to receive(:new).with("dpkg -s #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
115
|
-
expect(instance).to receive(:exec).with('', { :accept_all_exit_codes => true }).and_return(generate_result("hello", { :exit_code => 0 }))
|
116
|
-
expect(instance.check_for_package(pkg)).to be === true
|
117
|
-
end
|
118
|
-
|
119
95
|
it "checks correctly on solaris-11" do
|
120
96
|
@opts = { 'platform' => 'solaris-11-is-me' }
|
121
97
|
pkg = 'solaris-11_package'
|
@@ -140,12 +116,6 @@ module Beaker
|
|
140
116
|
expect(instance.check_for_package(pkg)).to be === true
|
141
117
|
end
|
142
118
|
|
143
|
-
it "returns false for el-4" do
|
144
|
-
@opts = { 'platform' => 'el-4-is-me' }
|
145
|
-
pkg = 'el-4_package'
|
146
|
-
expect(instance.check_for_package(pkg)).to be === false
|
147
|
-
end
|
148
|
-
|
149
119
|
it "raises on unknown platform" do
|
150
120
|
@opts = { 'platform' => 'nope-is-me' }
|
151
121
|
pkg = 'nope_package'
|
@@ -191,6 +161,22 @@ module Beaker
|
|
191
161
|
expect(instance.install_package(pkg)).to eq "hello"
|
192
162
|
end
|
193
163
|
|
164
|
+
it "uses yum on misnamed amazon linux 7" do
|
165
|
+
@opts = { 'platform' => "amazon-7-is-me" }
|
166
|
+
pkg = 'amazon_package'
|
167
|
+
expect(Beaker::Command).to receive(:new).with("yum -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
168
|
+
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
169
|
+
expect(instance.install_package(pkg)).to eq "hello"
|
170
|
+
end
|
171
|
+
|
172
|
+
it "uses yum on amazon linux 2" do
|
173
|
+
@opts = { 'platform' => "amazon-2-is-me" }
|
174
|
+
pkg = 'amazon_package'
|
175
|
+
expect(Beaker::Command).to receive(:new).with("yum -y install #{pkg}", [], { :prepend_cmds => nil, :cmdexe => false }).and_return('')
|
176
|
+
expect(instance).to receive(:exec).with('', {}).and_return(generate_result("hello", { :exit_code => 0 }))
|
177
|
+
expect(instance.install_package(pkg)).to eq "hello"
|
178
|
+
end
|
179
|
+
|
194
180
|
it "uses pacman on archlinux" do
|
195
181
|
@opts = { 'platform' => 'archlinux-is-me' }
|
196
182
|
pkg = 'archlinux_package'
|
@@ -301,6 +287,14 @@ module Beaker
|
|
301
287
|
end
|
302
288
|
end
|
303
289
|
|
290
|
+
it 'Amazon Linux 2 uses yum' do
|
291
|
+
@platform = platform
|
292
|
+
@version = '2'
|
293
|
+
package_file = 'test_123.yay'
|
294
|
+
expect(instance).to receive(:execute).with(/^yum.*#{package_file}$/)
|
295
|
+
instance.install_local_package(package_file)
|
296
|
+
end
|
297
|
+
|
304
298
|
it 'Centos & EL: uses yum' do
|
305
299
|
package_file = 'testing_789.yay'
|
306
300
|
%w[centos redhat].each do |platform|
|
@@ -310,9 +304,9 @@ module Beaker
|
|
310
304
|
end
|
311
305
|
end
|
312
306
|
|
313
|
-
it 'Debian, Ubuntu
|
307
|
+
it 'Debian, Ubuntu: uses dpkg' do
|
314
308
|
package_file = 'testing_012.yay'
|
315
|
-
%w[debian ubuntu
|
309
|
+
%w[debian ubuntu].each do |platform|
|
316
310
|
@platform = platform
|
317
311
|
expect(instance).to receive(:execute).with(/^dpkg.*#{package_file}$/)
|
318
312
|
expect(instance).to receive(:execute).with('apt-get update')
|
@@ -346,15 +340,6 @@ module Beaker
|
|
346
340
|
allow(instance).to receive(:[]).with('platform') { Beaker::Platform.new("#{platform}-#{version}-x86_64") }
|
347
341
|
end
|
348
342
|
|
349
|
-
it 'rejects unsupported platforms' do
|
350
|
-
@platform = 'cisco_nexus'
|
351
|
-
expect do
|
352
|
-
instance.uncompress_local_tarball(tar_file, base_dir, download_file)
|
353
|
-
end.to raise_error(
|
354
|
-
/^Platform #{platform} .* not supported .* uncompress_local_tarball$/,
|
355
|
-
)
|
356
|
-
end
|
357
|
-
|
358
343
|
it 'untars the file given' do
|
359
344
|
@platform = 'sles'
|
360
345
|
expect(instance).to receive(:execute).with(
|
@@ -37,13 +37,5 @@ module Unix
|
|
37
37
|
expect(host.determine_ssh_server).to be === :openssh
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
41
|
-
describe '#validate_setup' do
|
42
|
-
it 'does nothing for non cisco_nexus-7 platforms' do
|
43
|
-
@platform = 'el-7-x86_64'
|
44
|
-
validate_test = host.validate_setup
|
45
|
-
expect(validate_test).to be_nil
|
46
|
-
end
|
47
|
-
end
|
48
40
|
end
|
49
41
|
end
|
@@ -40,7 +40,6 @@ describe Beaker do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
it_behaves_like 'enables_root_login', 'f5', []
|
44
43
|
# Non-cygwin Windows
|
45
44
|
it_behaves_like 'enables_root_login', 'pswindows', [], false
|
46
45
|
|
@@ -91,20 +90,25 @@ describe Beaker do
|
|
91
90
|
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
92
91
|
]
|
93
92
|
|
94
|
-
%w[debian ubuntu
|
93
|
+
%w[debian ubuntu].each do |deb_like|
|
95
94
|
it_behaves_like 'enables_root_login', deb_like, [
|
96
95
|
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
97
96
|
"sudo su -c \"service ssh restart\"",
|
98
97
|
]
|
99
98
|
end
|
100
99
|
|
101
|
-
['centos', 'el-', 'redhat'
|
100
|
+
['centos', 'el-', 'redhat'].each do |redhat_like|
|
102
101
|
it_behaves_like 'enables_root_login', redhat_like, [
|
103
102
|
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
104
103
|
"sudo -E /sbin/service sshd reload",
|
105
104
|
]
|
106
105
|
end
|
107
106
|
|
107
|
+
it_behaves_like 'enables_root_login', 'fedora', [
|
108
|
+
"sudo su -c \"sed -ri 's/^#?PermitRootLogin no|^#?PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config\"",
|
109
|
+
"sudo -E systemctl restart sshd.service",
|
110
|
+
]
|
111
|
+
|
108
112
|
context 'timesync' do
|
109
113
|
subject { dummy_class.new }
|
110
114
|
|
@@ -236,15 +240,7 @@ describe Beaker do
|
|
236
240
|
subject.apt_get_update(host)
|
237
241
|
end
|
238
242
|
|
239
|
-
it "
|
240
|
-
host = make_host('testhost', { :platform => 'cumulus' })
|
241
|
-
|
242
|
-
expect(Beaker::Command).to receive(:new).with("apt-get update").once
|
243
|
-
|
244
|
-
subject.apt_get_update(host)
|
245
|
-
end
|
246
|
-
|
247
|
-
it "does nothing on non debian/ubuntu/cumulus hosts" do
|
243
|
+
it "does nothing on non debian/ubuntu hosts" do
|
248
244
|
host = make_host('testhost', { :platform => 'windows' })
|
249
245
|
|
250
246
|
expect(Beaker::Command).not_to receive(:new)
|
@@ -277,7 +273,7 @@ describe Beaker do
|
|
277
273
|
context "sync_root_keys" do
|
278
274
|
subject { dummy_class.new }
|
279
275
|
|
280
|
-
it "can sync keys on a solaris
|
276
|
+
it "can sync keys on a solaris host" do
|
281
277
|
@platform = 'solaris'
|
282
278
|
|
283
279
|
expect(Beaker::Command).to receive(:new).with(sync_cmd % "bash").exactly(3).times
|
@@ -385,12 +381,6 @@ describe Beaker do
|
|
385
381
|
|
386
382
|
subject.validate_host(hosts, options)
|
387
383
|
end
|
388
|
-
|
389
|
-
it 'skips validation on cisco hosts' do
|
390
|
-
host = make_host('cisco-7', { stdout: stdout, platform: 'cisco_nexus-7-x86_64' })
|
391
|
-
expect(subject).to receive(:check_and_install_packages_if_needed).with(host, []).once
|
392
|
-
subject.validate_host(host, options)
|
393
|
-
end
|
394
384
|
end
|
395
385
|
|
396
386
|
context 'get_domain_name' do
|
@@ -502,8 +492,8 @@ describe Beaker do
|
|
502
492
|
|
503
493
|
proxyurl = "http://192.168.2.100:3128"
|
504
494
|
|
505
|
-
it "can set proxy config on a debian/ubuntu
|
506
|
-
host = make_host('name', { :platform => '
|
495
|
+
it "can set proxy config on a debian/ubuntu host" do
|
496
|
+
host = make_host('name', { :platform => 'debian' })
|
507
497
|
|
508
498
|
expect(Beaker::Command).to receive(:new).with("echo 'Acquire::http::Proxy \"#{proxyurl}/\";' >> /etc/apt/apt.conf.d/10proxy").once
|
509
499
|
expect(host).to receive(:exec).once
|
@@ -546,10 +536,6 @@ describe Beaker do
|
|
546
536
|
test_host_ssh_calls('ubuntu')
|
547
537
|
end
|
548
538
|
|
549
|
-
it "sets user ssh environment on an sshd-based linux host" do
|
550
|
-
test_host_ssh_calls('eos')
|
551
|
-
end
|
552
|
-
|
553
539
|
it "sets user ssh environment on an sles host" do
|
554
540
|
test_host_ssh_calls('sles')
|
555
541
|
end
|
@@ -570,52 +556,6 @@ describe Beaker do
|
|
570
556
|
test_host_ssh_calls('windows')
|
571
557
|
end
|
572
558
|
|
573
|
-
it "skips an f5 host correctly" do
|
574
|
-
host = make_host('name', {
|
575
|
-
:platform => 'f5-stuff',
|
576
|
-
:ssh_env_file => 'ssh_env_file',
|
577
|
-
:is_cygwin => true,
|
578
|
-
})
|
579
|
-
opts = {
|
580
|
-
:env1_key => :env1_value,
|
581
|
-
:env2_key => :env2_value,
|
582
|
-
}
|
583
|
-
allow(host).to receive(:skip_set_env?).and_return('f5 say NO')
|
584
|
-
|
585
|
-
expect(subject).to receive(:construct_env).exactly(0).times
|
586
|
-
expect(Beaker::Command).to receive(:new).exactly(0).times
|
587
|
-
expect(host).to receive(:add_env_var).exactly(0).times
|
588
|
-
opts.each_pair do |key, value|
|
589
|
-
expect(host).to receive(:add_env_var).with(key, value).exactly(0).times
|
590
|
-
end
|
591
|
-
expect(host).to receive(:exec).exactly(0).times
|
592
|
-
|
593
|
-
subject.set_env(host, options.merge(opts))
|
594
|
-
end
|
595
|
-
|
596
|
-
it 'skips a cisco host correctly' do
|
597
|
-
host = make_host('name', {
|
598
|
-
:platform => 'cisco_nexus-7-x86_64',
|
599
|
-
:ssh_env_file => 'ssh_env_file',
|
600
|
-
:is_cygwin => true,
|
601
|
-
})
|
602
|
-
opts = {
|
603
|
-
:env1_key => :env1_value,
|
604
|
-
:env2_key => :env2_value,
|
605
|
-
}
|
606
|
-
allow(host).to receive(:skip_set_env?).and_return('cisco say NO')
|
607
|
-
|
608
|
-
expect(subject).to receive(:construct_env).exactly(0).times
|
609
|
-
expect(Beaker::Command).to receive(:new).exactly(0).times
|
610
|
-
expect(host).to receive(:add_env_var).exactly(0).times
|
611
|
-
opts.each_pair do |key, value|
|
612
|
-
expect(host).to receive(:add_env_var).with(key, value).exactly(0).times
|
613
|
-
end
|
614
|
-
expect(host).to receive(:exec).exactly(0).times
|
615
|
-
|
616
|
-
subject.set_env(host, options.merge(opts))
|
617
|
-
end
|
618
|
-
|
619
559
|
def test_host_ssh_calls(platform_name)
|
620
560
|
host = make_host('name', {
|
621
561
|
:platform => platform_name,
|
@@ -37,23 +37,23 @@ module Beaker
|
|
37
37
|
|
38
38
|
describe "platforms with version and codename" do
|
39
39
|
it "intializes both version and codename if given version" do
|
40
|
-
@name = "debian-
|
41
|
-
expect(platform.version).to eq('
|
42
|
-
expect(platform.codename).to eq('
|
40
|
+
@name = "debian-12-x86_64"
|
41
|
+
expect(platform.version).to eq('12')
|
42
|
+
expect(platform.codename).to eq('bookworm')
|
43
43
|
end
|
44
44
|
|
45
45
|
it "intializes both version and codename if given codename" do
|
46
|
-
@name = "debian-
|
47
|
-
expect(platform.version).to eq('
|
48
|
-
expect(platform.codename).to eq('
|
46
|
+
@name = "debian-bookworm-x86_64"
|
47
|
+
expect(platform.version).to eq('12')
|
48
|
+
expect(platform.codename).to eq('bookworm')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
context 'to_array' do
|
54
54
|
it "converts Beaker::Platform object to array of its attribues" do
|
55
|
-
@name = 'debian-
|
56
|
-
expect(platform.to_array).to be === %w[debian
|
55
|
+
@name = 'debian-12-somethingsomething'
|
56
|
+
expect(platform.to_array).to be === %w[debian 12 somethingsomething bookworm]
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -78,16 +78,6 @@ module Beaker
|
|
78
78
|
expect(platform.with_version_codename).to be === 'debian-bullseye-xxx'
|
79
79
|
end
|
80
80
|
|
81
|
-
it "can convert debian-7-xxx to debian-wheezy-xxx" do
|
82
|
-
@name = 'debian-7-xxx'
|
83
|
-
expect(platform.with_version_codename).to be === 'debian-wheezy-xxx'
|
84
|
-
end
|
85
|
-
|
86
|
-
it "can convert debian-6-xxx to debian-squeeze-xxx" do
|
87
|
-
@name = 'debian-6-xxx'
|
88
|
-
expect(platform.with_version_codename).to be === 'debian-squeeze-xxx'
|
89
|
-
end
|
90
|
-
|
91
81
|
it "can convert ubuntu-2404-xxx to ubuntu-noble-xxx" do
|
92
82
|
@name = 'ubuntu-2404-xxx'
|
93
83
|
expect(platform.with_version_codename).to be === 'ubuntu-noble-xxx'
|
@@ -103,26 +93,6 @@ module Beaker
|
|
103
93
|
expect(platform.with_version_codename).to be === 'ubuntu-focal-xxx'
|
104
94
|
end
|
105
95
|
|
106
|
-
it "can convert ubuntu-1604-xxx to ubuntu-xenial-xxx" do
|
107
|
-
@name = 'ubuntu-1604-xxx'
|
108
|
-
expect(platform.with_version_codename).to be === 'ubuntu-xenial-xxx'
|
109
|
-
end
|
110
|
-
|
111
|
-
it "can convert ubuntu-1310-xxx to ubuntu-saucy-xxx" do
|
112
|
-
@name = 'ubuntu-1310-xxx'
|
113
|
-
expect(platform.with_version_codename).to be === 'ubuntu-saucy-xxx'
|
114
|
-
end
|
115
|
-
|
116
|
-
it "can convert ubuntu-12.10-xxx to ubuntu-quantal-xxx" do
|
117
|
-
@name = 'ubuntu-12.10-xxx'
|
118
|
-
expect(platform.with_version_codename).to be === 'ubuntu-quantal-xxx'
|
119
|
-
end
|
120
|
-
|
121
|
-
it "can convert ubuntu-10.04-xxx to ubuntu-lucid-xxx" do
|
122
|
-
@name = 'ubuntu-10.04-xxx'
|
123
|
-
expect(platform.with_version_codename).to be === 'ubuntu-lucid-xxx'
|
124
|
-
end
|
125
|
-
|
126
96
|
%w[centos redhat].each do |p|
|
127
97
|
it "leaves #{p}-7-xxx alone" do
|
128
98
|
@name = "#{p}-7-xxx"
|
@@ -132,24 +102,24 @@ module Beaker
|
|
132
102
|
end
|
133
103
|
|
134
104
|
context 'with_version_number' do
|
135
|
-
it "can convert debian-
|
136
|
-
@name = 'debian-
|
137
|
-
expect(platform.with_version_number).to be === 'debian-
|
105
|
+
it "can convert debian-bookworm-xxx to debian-12-xxx" do
|
106
|
+
@name = 'debian-bookworm-xxx'
|
107
|
+
expect(platform.with_version_number).to be === 'debian-12-xxx'
|
138
108
|
end
|
139
109
|
|
140
|
-
it "can convert debian-
|
141
|
-
@name = 'debian-
|
142
|
-
expect(platform.with_version_number).to be === 'debian-
|
110
|
+
it "can convert debian-bullseye-xxx to debian-11-xxx" do
|
111
|
+
@name = 'debian-bullseye-xxx'
|
112
|
+
expect(platform.with_version_number).to be === 'debian-11-xxx'
|
143
113
|
end
|
144
114
|
|
145
|
-
it "can convert ubuntu-
|
146
|
-
@name = 'ubuntu-
|
147
|
-
expect(platform.with_version_number).to be === 'ubuntu-
|
115
|
+
it "can convert ubuntu-focal-xxx to ubuntu-2004-xxx" do
|
116
|
+
@name = 'ubuntu-focal-xxx'
|
117
|
+
expect(platform.with_version_number).to be === 'ubuntu-2004-xxx'
|
148
118
|
end
|
149
119
|
|
150
|
-
it "can convert ubuntu-
|
151
|
-
@name = 'ubuntu-
|
152
|
-
expect(platform.with_version_number).to be === 'ubuntu-
|
120
|
+
it "can convert ubuntu-jammy-xxx to ubuntu-2204-xxx" do
|
121
|
+
@name = 'ubuntu-jammy-xxx'
|
122
|
+
expect(platform.with_version_number).to be === 'ubuntu-2204-xxx'
|
153
123
|
end
|
154
124
|
|
155
125
|
%w[centos redhat].each do |p|
|