Skip to content

Commit

Permalink
rubocop: safe autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Feb 25, 2022
1 parent bbacb6c commit c9bbbbc
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 28 deletions.
5 changes: 5 additions & 0 deletions spec/acceptance/keepalived_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class { 'keepalived':
it 'works with no error' do
apply_manifest(pp, catch_failures: true)
end

it 'works idempotently' do
pp2 = <<-EOS
class { 'keepalived':
Expand All @@ -23,6 +24,7 @@ class { 'keepalived':
EOS
apply_manifest(pp2, catch_changes: true)
end

it 'creates fact keepalived_version' do
service_fact = apply_manifest(pp, catch_failures: true)
expect(service_fact.output).to match %r{.*Keepalived version was: (\d.\d.\d).*}
Expand Down Expand Up @@ -58,6 +60,7 @@ class { 'keepalived':
it 'works with no error' do
apply_manifest(pp, catch_failures: true)
end

it 'works idempotently' do
apply_manifest(pp, catch_changes: true)
end
Expand Down Expand Up @@ -92,6 +95,7 @@ class { 'keepalived::global_defs':
it 'works with no error' do
apply_manifest(pp, catch_failures: true)
end

it 'works idempotently' do
apply_manifest(pp, catch_changes: true)
end
Expand Down Expand Up @@ -121,6 +125,7 @@ class { 'keepalived':
it 'works with no error' do
apply_manifest(pp, catch_failures: true)
end

it 'works idempotently' do
apply_manifest(pp, catch_changes: true)
end
Expand Down
19 changes: 10 additions & 9 deletions spec/classes/keepalived_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,29 @@

it {
is_expected.to contain_concat('/etc/keepalived/keepalived.conf').with(
'group' => 'root',
'mode' => '0644',
'owner' => 'root'
'group' => 'root',
'mode' => '0644',
'owner' => 'root'
)
}

case facts[:osfamily]
when 'Debian'
it {
is_expected.to contain_service('keepalived').with(
'ensure' => 'running',
'enable' => 'true',
'ensure' => 'running',
'enable' => 'true',
'hasrestart' => 'false',
'hasstatus' => 'false'
'hasstatus' => 'false'
)
}
else
it {
is_expected.to contain_service('keepalived').with(
'ensure' => 'running',
'enable' => 'true',
'ensure' => 'running',
'enable' => 'true',
'hasrestart' => 'true',
'hasstatus' => 'true'
'hasstatus' => 'true'
)
}
end
Expand Down
1 change: 0 additions & 1 deletion spec/defines/keepalived_lvs_real_server_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

require 'spec_helper'

describe 'keepalived::lvs::real_server', type: 'define' do
Expand Down
19 changes: 10 additions & 9 deletions spec/defines/keepalived_lvs_virtual_server_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

require 'spec_helper'

describe 'keepalived::lvs::virtual_server', type: 'define' do
Expand Down Expand Up @@ -86,11 +85,13 @@
%r{\s+delay_loop 60\s+lb_algo lc\s+lb_kind NAT\s+persistence_timeout 5\s+ha_suspend\s+virtualhost example.com}
)
}

it {
is_expected.to contain_concat__fragment('keepalived.conf_lvs_virtual_server__TITLE_').with_content(
%r{\s+alpha\s+omega\s+quorum 5\s+quorum_up "\/bin\/true"\s+quorum_down "\/bin\/true"}
%r{\s+alpha\s+omega\s+quorum 5\s+quorum_up "/bin/true"\s+quorum_down "/bin/true"}
)
}

it {
is_expected.to contain_concat__fragment('keepalived.conf_lvs_virtual_server__TITLE_').with_content(
%r{\s+hysteresis 9\s+protocol UDP\s+sorry_server 10.1.1.3 999\s+}
Expand Down Expand Up @@ -198,7 +199,7 @@
port: 8080,
lb_algo: 'lc',
real_servers: [{ 'ip_address' => '10.1.1.2',
'port' => 8081 }]
'port' => 8081 }]
}
end

Expand All @@ -217,7 +218,7 @@
lb_algo: 'lc',
tcp_check: { 'connect_timeout' => 5 },
real_servers: [{ 'ip_address' => '10.1.1.2',
'port' => 8081 }]
'port' => 8081 }]
}
end

Expand All @@ -236,7 +237,7 @@
lb_algo: 'lc',
tcp_check: { 'connect_timeout' => 5 },
real_servers: [{ 'ip_address' => '10.1.1.2',
'port' => 8081 }],
'port' => 8081 }],
real_server_options: {
'MISC_CHECK' => {
'misc_path' => 'somepath'
Expand All @@ -260,10 +261,10 @@
lb_algo: 'lc',
tcp_check: { 'connect_timeout' => 5 },
real_servers: [{ 'ip_address' => '10.1.1.2',
'port' => 8081 }],
'port' => 8081 }],
real_server_options: {
'TCP_CHECK' => {
'connect_port' => 42,
'connect_port' => 42,
'connect_timeout' => 10
}
}
Expand Down Expand Up @@ -302,9 +303,9 @@
port: 8080,
lb_algo: 'lc',
real_servers: [{ 'ip_address' => '10.1.1.2',
'port' => 8081 },
'port' => 8081 },
{ 'ip_address' => '10.1.1.3',
'port' => 8082 }]
'port' => 8082 }]
}
end

Expand Down
Loading

0 comments on commit c9bbbbc

Please sign in to comment.