Skip to content

Commit

Permalink
Flesh out the test for nexus::service
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Grimberg <[email protected]>
  • Loading branch information
tykeal committed Oct 1, 2015
1 parent ce33563 commit 5c704d3
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion spec/classes/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,45 @@
end
end

it { should contain_service('nexus') }
context 'with test values' do
it { should contain_class('nexus::service') }

it { should contain_file_line('nexus_NEXUS_HOME').with(
'path' => '/srv/nexus/bin/nexus',
'match' => '^#?NEXUS_HOME=',
'line' => 'NEXUS_HOME=/srv/nexus',
) }

it { should contain_file_line('nexus_RUN_AS_USER').with(
'path' => '/srv/nexus/bin/nexus',
'match' => '^#?RUN_AS_USER=',
'line' => 'RUN_AS_USER=${run_as_user:-nexus}',
) }

it { should contain_file('/etc/init.d/nexus').with(
'ensure' => 'present',
'owner' => 'root',
'group' => 'root',
'mode' => '0755',
'source' => 'file:///srv/nexus/bin/nexus',
'require' => ['File_line[nexus_NEXUS_HOME]', 'File_line[nexus_RUN_AS_USER]'],
'notify' => 'Service[nexus]',
) }

it { should contain_service('nexus').with(
'ensure' => 'running',
'enable' => true,
'status' => 'env run_as_user=root /etc/init.d/nexus status',
) }

it 'should have the correct status line when version >= 2.8.0' do
params.merge!({'version' => '2.8.0'})

should contain_service('nexus').with(
'status' => 'env run_as_user=nexus /etc/init.d/nexus status',
)
end
end
end

# vim: sw=2 ts=2 sts=2 et :

0 comments on commit 5c704d3

Please sign in to comment.