Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ platforms:
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-22.04
driver:
image: dokken/ubuntu-22.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
2 changes: 2 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ platforms:
- name: oracle-7
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: ubuntu-20.04
- name: ubuntu-22.04

suites:
- name: default
Expand Down
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# what is necessary for running runit as pid 1, which we don't care about.
pv = node['platform_version']
pkg_name = if (platform?('debian') && pv.to_i >= 9) || \
(platform?('ubuntu') && Gem::Version.new(pv) >= Gem::Version.new('17.10'))
(platform?('ubuntu') && Gem::Version.new(pv) >= Gem::Version.new('17.10') && Gem::Version.new(pv) < Gem::Version.new('22.04'))
'runit-systemd'
else
'runit'
Expand Down
26 changes: 26 additions & 0 deletions spec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,32 @@
end
end

context 'on Ubuntu 20.04' do
platform 'ubuntu', '20.04'

it 'installs the runit package' do
is_expected.to install_package('runit-systemd')
end

it 'starts and enabled the correct runit service' do
is_expected.to enable_service('runit')
is_expected.to start_service('runit')
end
end

context 'on Ubuntu 22.04' do
platform 'ubuntu', '22.04'

it 'installs the runit package' do
is_expected.to install_package('runit')
end

it 'starts and enabled the correct runit service' do
is_expected.to enable_service('runit')
is_expected.to start_service('runit')
end
end

context 'on Debian 9' do
platform 'Debian', '9'

Expand Down
1 change: 1 addition & 0 deletions test/cookbooks/runit_test/recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
apt_update 'update'

include_recipe 'runit::default'

Expand Down
2 changes: 1 addition & 1 deletion test/integration/default/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (os[:name] == 'debian' && os[:release].to_i >= 9) || \
(os[:name] == 'ubuntu' && Gem::Version.new(os[:release]) >= Gem::Version.new('17.10'))
(os[:name] == 'ubuntu' && Gem::Version.new(os[:release]) >= Gem::Version.new('17.10') && Gem::Version.new(os[:release]) < Gem::Version.new('22.04'))
describe package('runit-systemd') do
it { should be_installed }
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration/service/all_distros_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
end

describe command('file /var/log/default-svlog/*.s') do
its(:stdout) { should contain('gzip compressed data') }
its(:stdout) { should match(/gzip compressed data/) }
end
end

Expand Down