Skip to content

Commit

Permalink
Merge pull request #386 from alexjfisher/rubocop
Browse files Browse the repository at this point in the history
rubocop: fix RSpec/ImplicitExpect
  • Loading branch information
bastelfreak authored Oct 31, 2016
2 parents 8bd129f + bf4da3a commit 915bb72
Showing 1 changed file with 48 additions and 48 deletions.
96 changes: 48 additions & 48 deletions spec/classes/corosync_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@
end

it 'configures votequorum' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{nodelist}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node1\.test\.org\n\s*nodeid: 1}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node2\.test\.org\n\s*nodeid: 2}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end

it 'supports persistent node IDs' do
params[:quorum_members_ids] = [3, 11]
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{nodelist}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node1\.test\.org\n\s*nodeid: 3}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node2\.test\.org\n\s*nodeid: 11}
)
end
Expand All @@ -61,7 +61,7 @@
end

it 'does not configure two_nodes option' do
should_not contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.not_to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end
Expand All @@ -75,7 +75,7 @@
end

it 'configures two_node' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end
Expand All @@ -90,16 +90,16 @@
end

it 'configures nodelist' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{nodelist}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node1\.test\.org\n\s*nodeid: 1}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node2\.test\.org\n\s*nodeid: 2}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end
Expand All @@ -119,14 +119,14 @@

(1..4).each do |node_id|
it "configures rings for host #{node_id} correctly" do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr: 172.31.10.#{node_id}\n\s*ring1_addr: 172.31.11.#{node_id}\n\s*ring2_addr: 172.31.12.#{node_id}\n\s*nodeid: #{node_id}}
)
end
end

it 'does not configure two_nodes option' do
should_not contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.not_to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end
Expand All @@ -144,14 +144,14 @@

(1..2).each do |node_id|
it "configures rings for host #{node_id} correctly" do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr: 172.31.10.#{node_id}\n\s*ring1_addr: 172.31.11.#{node_id}\n\s*ring2_addr: 172.31.12.#{node_id}\n\s*nodeid: #{node_id}}
)
end
end

it 'configures two_node' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end
Expand All @@ -175,29 +175,29 @@
end

it 'configures votequorum' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{nodelist}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node1\.test\.org\n\s*nodeid: 1}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node2\.test\.org\n\s*nodeid: 2}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{two_node: 1\n}
)
end

it 'supports persistent node IDs' do
params[:quorum_members_ids] = [3, 11]
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{nodelist}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node1\.test\.org\n\s*nodeid: 3}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{ring0_addr\: node2\.test\.org\n\s*nodeid: 11}
)
end
Expand All @@ -213,7 +213,7 @@
it { is_expected.to compile.with_all_deps }

it 'configures secauth correctly' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{secauth:\s+off}
)
end
Expand All @@ -228,7 +228,7 @@
end

it 'configures the ring properly' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{interface.*memberaddr: 10\.0\.0\.1.*memberaddr: 10\.0\.0\.2.*ringnumber:\s+0.*bindnetaddr: 10\.0\.0\.1}m
)
end
Expand All @@ -251,7 +251,7 @@
end

it 'configures the rings properly' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{interface.*memberaddr: 10\.0\.0\.1.*memberaddr: 10\.0\.0\.2.*ringnumber:\s+0.*bindnetaddr: 10\.0\.0\.1.*interface.*memberaddr: 10\.0\.1\.1.*memberaddr: 10\.0\.1\.2.*ringnumber:\s+1.*bindnetaddr: 10\.0\.1\.1}m
)
end
Expand All @@ -260,7 +260,7 @@

context 'when cluster_name is not set' do
it do
should contain_file('/etc/corosync/corosync.conf').without_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').without_content(
%r{cluster_name\:}
)
end
Expand All @@ -274,7 +274,7 @@
end

it 'configures cluster_name' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{cluster_name\:\s*hacell$}
)
end
Expand All @@ -288,7 +288,7 @@
end

it 'raises error' do
should raise_error(
is_expected.to raise_error(
Puppet::Error,
%r{You must provide a value for multicast_address, unicast_address or cluster_name\.}
)
Expand All @@ -304,18 +304,18 @@
end

it 'does not configure multicast' do
should contain_file('/etc/corosync/corosync.conf').without_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').without_content(
%r{broadcast}
)
should contain_file('/etc/corosync/corosync.conf').without_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').without_content(
%r{mcastaddr}
)
end
end

context 'when log_file is not set' do
it 'does set to_logfile' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{to_logfile.*yes}
)
end
Expand All @@ -329,7 +329,7 @@
end

it 'does not set to_logfile' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{to_logfile.*no}
)
end
Expand All @@ -349,7 +349,7 @@
}.each do |optional_parameter, possible_value|
context "when #{optional_parameter} is not set" do
it 'is not in corosync.conf' do
should contain_file('/etc/corosync/corosync.conf').without_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').without_content(
%r{#{optional_parameter}}
)
end
Expand All @@ -363,7 +363,7 @@
end

it 'is set in corosync.conf' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{#{optional_parameter}:\s*#{possible_value}\n}
)
end
Expand All @@ -377,7 +377,7 @@
end

it "does install #{package}" do
should contain_package(package).with(
is_expected.to contain_package(package).with(
ensure: 'present'
)
end
Expand All @@ -392,7 +392,7 @@
end

it "does install #{package} with version 1.1.1" do
should contain_package(package).with(
is_expected.to contain_package(package).with(
ensure: '1.1.1'
)
end
Expand All @@ -404,7 +404,7 @@
end

it "does not install #{package}" do
should_not contain_package(package)
is_expected.not_to contain_package(package)
end
end
end
Expand All @@ -418,7 +418,7 @@
end

it 'raises error' do
should raise_error(
is_expected.to raise_error(
Puppet::Error,
%r{set_votequorum is true, but no quorum_members have been passed.}
)
Expand All @@ -427,13 +427,13 @@

context 'when configuring defaults for logging' do
it 'configures stderr, syslog priority, func names' do
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{to_stderr: yes}
)
should contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
%r{syslog_priority: info}
)
should_not contain_file('/etc/corosync/corosync.conf').with_content(
is_expected.not_to contain_file('/etc/corosync/corosync.conf').with_content(
%r{function_name: on}
)
end
Expand All @@ -452,7 +452,7 @@
end

it 'validates the corosync configuration' do
should contain_file('/etc/corosync/corosync.conf').with_validate_cmd(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_validate_cmd(
'/usr/bin/env COROSYNC_MAIN_CONFIG_FILE=% /usr/sbin/corosync -t'
)
end
Expand All @@ -475,11 +475,11 @@
it_configures 'corosync'

it 'does not manage the pacemaker service' do
should_not contain_service('pacemaker')
is_expected.not_to contain_service('pacemaker')
end

it 'does not validate the corosync configuration' do
should contain_file('/etc/corosync/corosync.conf').without_validate_cmd
is_expected.to contain_file('/etc/corosync/corosync.conf').without_validate_cmd
end
end

Expand All @@ -491,13 +491,13 @@
it_configures 'corosync'

it 'does manage the pacemaker service' do
should contain_service('pacemaker').with(
is_expected.to contain_service('pacemaker').with(
ensure: 'running'
)
end

it 'validates the corosync configuration' do
should contain_file('/etc/corosync/corosync.conf').with_validate_cmd(
is_expected.to contain_file('/etc/corosync/corosync.conf').with_validate_cmd(
'/usr/bin/env COROSYNC_MAIN_CONFIG_FILE=% /usr/sbin/corosync -t'
)
end
Expand Down

0 comments on commit 915bb72

Please sign in to comment.