Skip to content

Commit ae2a3da

Browse files
committed
support acceptance tests on ubuntu
1 parent ab1b10f commit ae2a3da

8 files changed

+41
-18
lines changed

spec/acceptance/lib/solaris_util.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
OPTS = { poolpath: '/ztstpool', pool: 'tstpool', fs: 'tstfs' }.freeze
22

3+
def os_mkfile_command(agent)
4+
agent['platform'].include?('solaris') ? 'mkfile' : 'truncate --size'
5+
end
6+
37
def zfs_clean(agent, o = {})
48
o = OPTS.merge(o)
59
on agent, "zfs destroy -f -r #{o[:pool]}/#{o[:fs]} ||:"
@@ -11,7 +15,7 @@ def zfs_setup(agent, o = {})
1115
o = OPTS.merge(o)
1216
on agent, "mkdir -p #{o[:poolpath]}/mnt"
1317
on agent, "mkdir -p #{o[:poolpath]}/mnt2"
14-
on agent, "mkfile 64m #{o[:poolpath]}/dsk"
18+
on agent, "#{os_mkfile_command(agent)} 64m #{o[:poolpath]}/dsk"
1519
on agent, "zpool create #{o[:pool]} #{o[:poolpath]}/dsk"
1620
end
1721

@@ -24,6 +28,6 @@ def zpool_clean(agent, o = {})
2428
def zpool_setup(agent, o = {})
2529
o = OPTS.merge(o)
2630
on agent, "mkdir -p #{o[:poolpath]}/mnt||:"
27-
on agent, "mkfile 100m #{o[:poolpath]}/dsk1 #{o[:poolpath]}/dsk2 #{o[:poolpath]}/dsk3 #{o[:poolpath]}/dsk5 ||:"
28-
on agent, "mkfile 50m #{o[:poolpath]}/dsk4 ||:"
31+
on agent, "#{os_mkfile_command} 100m #{o[:poolpath]}/dsk1 #{o[:poolpath]}/dsk2 #{o[:poolpath]}/dsk3 #{o[:poolpath]}/dsk5 ||:"
32+
on agent, "#{os_mkfile_command} 50m #{o[:poolpath]}/dsk4 ||:"
2933
end

spec/acceptance/nodesets/default.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ HOSTS:
1212
roles:
1313
- agent
1414
- default
15+
ubuntu22-64-1:
16+
pe_dir:
17+
pe_ver:
18+
pe_upgrade_dir:
19+
pe_upgrade_ver:
20+
hypervisor: vmpooler
21+
platform: ubuntu-22.04-amd64
22+
packaging_platform: ubuntu-22.04-amd64
23+
template: ubuntu-2204-x86_64
24+
roles:
25+
- agent
26+
- default
1527
CONFIG:
1628
type: agent
1729
nfs_server: none

spec/acceptance/tests/zpool/basic_tests_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
RSpec.context 'ZPool: Basic Tests' do
44
before(:all) do
55
# ZPool: setup
6-
solaris_agents.each do |agent|
6+
agents.each do |agent|
77
zpool_setup agent
88
end
99
end
1010

1111
after(:all) do
1212
# ZPool: cleanup
13-
solaris_agents.each do |agent|
13+
agents.each do |agent|
1414
zpool_clean agent
1515
end
1616
end
1717

18-
solaris_agents.each do |agent|
18+
agents.each do |agent|
1919
it 'can create an idempotent zpool resource' do
2020
# ZPool: create zpool disk
2121
apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do

spec/acceptance/tests/zpool/should_be_idempotent_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
RSpec.context 'ZPool: Should be Idempotent' do
44
before(:all) do
55
# ZPool: setup
6-
solaris_agents.each do |agent|
6+
agents.each do |agent|
77
zpool_setup agent
88
end
99
end
1010

1111
after(:all) do
1212
# ZPool: cleanup
13-
solaris_agents.each do |agent|
13+
agents.each do |agent|
1414
zpool_clean agent
1515
end
1616
end
1717

18-
solaris_agents.each do |agent|
18+
agents.each do |agent|
1919
it 'creates an idempotent resource' do
2020
# ZPool: ensure create
2121
apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do

spec/acceptance/tests/zpool/should_create_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
RSpec.context 'ZPool: Should Create' do
44
before(:all) do
55
# ZPool: setup
6-
solaris_agents.each do |agent|
6+
agents.each do |agent|
77
zpool_setup agent
88
end
99
end
1010

1111
after(:all) do
1212
# ZPool: cleanup
13-
solaris_agents.each do |agent|
13+
agents.each do |agent|
1414
zpool_clean agent
1515
end
1616
end
1717

18-
solaris_agents.each do |agent|
18+
agents.each do |agent|
1919
it 'creates a zpool resource' do
2020
# ZPool: ensure create
2121
apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do

spec/acceptance/tests/zpool/should_query_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
RSpec.context 'ZPool: Should Query' do
44
before(:all) do
55
# ZPool: setup
6-
solaris_agents.each do |agent|
6+
agents.each do |agent|
77
zpool_setup agent
88
end
99
end
1010

1111
after(:all) do
1212
# ZPool: cleanup
13-
solaris_agents.each do |agent|
13+
agents.each do |agent|
1414
zpool_clean agent
1515
end
1616
end
1717

18-
solaris_agents.each do |agent|
18+
agents.each do |agent|
1919
it 'queries both manages and unmanages zpool resources' do
2020
# ZPool: ensure create
2121
apply_manifest_on(agent, "zpool{ tstpool: ensure=>present, disk=>'/ztstpool/dsk1' }") do

spec/acceptance/tests/zpool/should_remove_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
RSpec.context 'ZPool: Should Remove' do
44
before(:all) do
55
# ZPool: setup
6-
solaris_agents.each do |agent|
6+
agents.each do |agent|
77
zpool_setup agent
88
end
99
end
1010

1111
after(:all) do
1212
# ZPool: cleanup
13-
solaris_agents.each do |agent|
13+
agents.each do |agent|
1414
zpool_clean agent
1515
end
1616
end
1717

18-
solaris_agents.each do |agent|
18+
agents.each do |agent|
1919
it 'removes a specified resource' do
2020
# ZPool: create
2121
on(agent, 'zpool create tstpool /ztstpool/dsk1')

spec/spec_helper_acceptance.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ def solaris_agents
1515
agents.select { |agent| agent['platform'].include?('solaris') }
1616
end
1717

18+
def linux_agents
19+
agents.select { |agent| agent['platform'].include?('ubuntu') }
20+
end
21+
1822
RSpec.configure do |c|
1923
c.before :suite do
2024
unless ENV['BEAKER_provision'] == 'no'
@@ -55,6 +59,9 @@ def solaris_agents
5559

5660
# Until solaris gets new image we need to add to the cert chain on solaris, call a beaker-puppet setup script to handle this
5761
hosts.each do |host|
62+
if hosts.platform.match? %r{ubuntu}
63+
on(host, 'apt -y install zfsutils-linux')
64+
end
5865
next unless host.platform.match? %r{solaris-11(\.2)?-(i386|sparc)}
5966
create_remote_file(host, 'DigiCertTrustedRootG4.crt.pem', DIGICERT)
6067
on(host, 'chmod a+r /root/DigiCertTrustedRootG4.crt.pem')

0 commit comments

Comments
 (0)