Skip to content

Commit

Permalink
Rubocop refactoring (voxpupuli#173).
Browse files Browse the repository at this point in the history
  • Loading branch information
dallinb committed Feb 21, 2016
1 parent b5e5e2a commit ec5f2d6
Showing 1 changed file with 61 additions and 56 deletions.
117 changes: 61 additions & 56 deletions spec/classes/cassandra_redhat_spec.rb
Original file line number Diff line number Diff line change
@@ -1,88 +1,93 @@
require 'spec_helper'
describe 'cassandra' do
let(:pre_condition) { [
'class apt () {}',
'class apt::update () {}',
'define apt::key ($id, $source) {}',
'define apt::source ($location, $comment, $release, $include) {}',
'define ini_setting($ensure = nil,
$path,
$section,
$key_val_separator = nil,
$setting,
$value = nil) {}',
] }
let(:pre_condition) do
[
'class apt () {}',
'class apt::update () {}',
'define apt::key ($id, $source) {}',
'define apt::source ($location, $comment, $release, $include) {}',
'define ini_setting($ensure = nil,
$path,
$section,
$key_val_separator = nil,
$setting,
$value = nil) {}'
]
end

context 'On a RedHat OS with defaults for all parameters' do
let :facts do
{
:osfamily => 'RedHat'
osfamily: 'RedHat'
}
end

it { should contain_class('cassandra') }
it { should contain_file('/etc/cassandra/default.conf/cassandra.yaml') }
it {
should contain_service('cassandra').with({
it do
should contain_service('cassandra').with(
'ensure' => 'running',
'enable' => 'true'
})
}
)
end
it { should contain_package('cassandra22') }
it { is_expected.not_to contain_yumrepo('datastax') }
it {
should contain_ini_setting('rackdc.properties.dc').with({
it do
should contain_ini_setting('rackdc.properties.dc').with(
'path' => '/etc/cassandra/default.conf/cassandra-rackdc.properties',
'section' => '',
'setting' => 'dc',
'value' => 'DC1'
})
}
it {
should contain_ini_setting('rackdc.properties.rack').with({
)
end
it do
should contain_ini_setting('rackdc.properties.rack').with(
'path' => '/etc/cassandra/default.conf/cassandra-rackdc.properties',
'section' => '',
'setting' => 'rack',
'value' => 'RAC1'
})
}
it {
should contain_file('/var/lib/cassandra/data').with({
)
end
it do
should contain_file('/var/lib/cassandra/data').with(
'ensure' => 'directory',
'owner' => 'cassandra',
'group' => 'cassandra',
'mode' => '0750',
})
}
it {
should contain_file('/var/lib/cassandra/commitlog').with({
'mode' => '0750'
)
end
it do
should contain_file('/var/lib/cassandra/commitlog').with(
'ensure' => 'directory',
'owner' => 'cassandra',
'group' => 'cassandra',
'mode' => '0750',
})
}
it {
should contain_file('/var/lib/cassandra/saved_caches').with({
'mode' => '0750'
)
end
it do
should contain_file('/var/lib/cassandra/saved_caches').with(
'ensure' => 'directory',
'owner' => 'cassandra',
'group' => 'cassandra',
'mode' => '0750',
})
}
it { is_expected.not_to contain_file('/usr/lib/systemd/system/cassandra.service') }
'mode' => '0750'
)
end
it do
is_expected
.not_to contain_file('/usr/lib/systemd/system/cassandra.service')
end
end

context 'On a RedHat OS with manage_dsc_repo set to true' do
let :facts do
{
:osfamily => 'RedHat'
osfamily: 'RedHat'
}
end

let :params do
{
:manage_dsc_repo => true,
manage_dsc_repo: true
}
end

Expand All @@ -92,39 +97,39 @@
context 'Install DSE on a Red Hat family OS.' do
let :facts do
{
:osfamily => 'RedHat'
osfamily: 'RedHat'
}
end

let :params do
{
:package_ensure => '4.7.0-1',
:package_name => 'dse-full',
:cluster_name => 'DSE Cluster',
:config_path => '/etc/dse/cassandra',
:service_name => 'dse',
:service_systemd => true
package_ensure: '4.7.0-1',
package_name: 'dse-full',
cluster_name: 'DSE Cluster',
config_path: '/etc/dse/cassandra',
service_name: 'dse',
service_systemd: true
}
end

it {
it do
is_expected.to contain_file('/etc/dse/cassandra/cassandra.yaml')
is_expected.to contain_file('/usr/lib/systemd/system/dse.service')
is_expected.to contain_package('dse-full').with_ensure('4.7.0-1')
is_expected.to contain_service('cassandra').with_name('dse')
}
end
end

context 'CASSANDRA-9822 activated on Red Hat' do
let :facts do
{
:osfamily => 'RedHat'
osfamily: 'RedHat'
}
end

let :params do
{
:cassandra_9822 => true
cassandra_9822: true
}
end

Expand All @@ -134,13 +139,13 @@
context 'Systemd file can be activated on Red Hat' do
let :facts do
{
:osfamily => 'RedHat'
osfamily: 'RedHat'
}
end

let :params do
{
:service_systemd => true
service_systemd: true
}
end

Expand Down

0 comments on commit ec5f2d6

Please sign in to comment.