Skip to content

Commit

Permalink
drop system-v leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed May 10, 2024
1 parent 8832094 commit 9a8a474
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 46 deletions.
3 changes: 1 addition & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,10 @@ RSpec/ReceiveMessages:
- 'spec/beaker/test_suite_spec.rb'
- 'spec/helpers.rb'

# Offense count: 7
# Offense count: 4
RSpec/RepeatedDescription:
Exclude:
- 'spec/beaker/cli_spec.rb'
- 'spec/beaker/host/unix/exec_spec.rb'
- 'spec/beaker/host/unix/pkg_spec.rb'

# Offense count: 4
Expand Down
29 changes: 1 addition & 28 deletions spec/beaker/host/unix/exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def to_s
let(:ssh_command) { "echo 'PermitUserEnvironment yes' | cat - /etc/ssh/sshd_config > #{directory}/sshd_config.permit" }
let(:ssh_move) { "mv #{directory}/sshd_config.permit /etc/ssh/sshd_config" }

platforms = PlatformHelpers::SYSTEMDPLATFORMS + PlatformHelpers::DEBIANPLATFORMS + PlatformHelpers::SYSTEMVPLATFORMS

platforms.each do |platform|
PlatformHelpers::SYSTEMDPLATFORMS.each do |platform|
it "calls the correct commands for #{platform}" do
opts['platform'] = platform
expect(instance).to receive(:exec).twice
Expand Down Expand Up @@ -114,31 +112,6 @@ def to_s
expect { instance.ssh_service_restart }.not_to raise_error
end
end

PlatformHelpers::DEBIANPLATFORMS.each do |platform|
it "calls the correct command for #{platform}" do
opts['platform'] = platform
expect(instance).to receive(:exec)
expect(Beaker::Command).to receive(:new).with("service ssh restart")
expect { instance.ssh_service_restart }.not_to raise_error
end
end

PlatformHelpers::SYSTEMVPLATFORMS.each do |platform|
it "calls the correct command for #{platform}" do
opts['platform'] = "#{platform}-arch"
expect(instance).to receive(:exec)
expect(Beaker::Command).to receive(:new).with("/sbin/service sshd restart")
expect { instance.ssh_service_restart }.not_to raise_error
end
end

it 'raises an error on unsupported platforms' do
opts['platform'] = 'notarealthing02-parts-arch'
expect do
instance.ssh_service_restart
end.to raise_error(ArgumentError, /#{opts['platform']}/)
end
end

describe '#prepend_commands' do
Expand Down
21 changes: 5 additions & 16 deletions spec/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,9 @@ module PlatformHelpers
DEBIANPLATFORMS = %w[debian ubuntu]

SYSTEMDPLATFORMS = %w[amazon-2023
fedora
el-7
centos-7
redhat-7
oracle-7
scientific-7
el-8
centos-8
redhat-8
oracle-8]

SYSTEMVPLATFORMS = ['el-',
'centos',
'redhat',
'oracle',
'scientific',]
el-
centos
redhat
oracle
scientific].concat(DEBIANPLATFORMS)
end

0 comments on commit 9a8a474

Please sign in to comment.