This repository has been archived by the owner on Jan 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ISSUE-43] - Removed version lock on java cookbook
- Loading branch information
Showing
12 changed files
with
254 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
test/integration/activemq-legacy/controls/activemq_legacy_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
activemq_version = attribute('activemq_version', | ||
default: '5.14.5', | ||
description: 'Which version of ActiveMQ is to be installed' | ||
) | ||
activemq_install_dir = attribute('activemq_install_directory', | ||
default: "/opt/apache-activemq-#{activemq_version}", | ||
description: 'Get the path where ActiveMQ should be installed' | ||
) | ||
activemq_service_enabled = attribute('activemq_service_enabled', | ||
default: true, | ||
description: 'Enable and start ActiveMQ servers when true' | ||
) | ||
|
||
arch = os[:arch] == 'x86_64' ? 'x86-64' : 'x86-32' | ||
|
||
control 'check-tar-installation' do | ||
impact 1.0 | ||
title 'Verify that the tar package is installed' | ||
desc 'Verify tar is installed so ActiveMQ can be installed' | ||
|
||
describe package('tar') do | ||
it { should be_installed } | ||
end | ||
end | ||
|
||
control 'check-activemq-binary-perms' do | ||
impact 1.0 | ||
title 'Verify that the ActiveMQ binary permissions are correct' | ||
desc 'Verify ActiveMQ binary has the correct permissions' | ||
|
||
describe file("#{activemq_install_dir}/bin/activemq") do | ||
it { should exist } | ||
it { should be_file } | ||
its('mode') { should cmp 0o755 } | ||
its('group') { should eq 'root' } | ||
its('owner') { should eq 'root' } | ||
end | ||
end | ||
|
||
control 'check-init.d-link' do | ||
impact 1.0 | ||
title 'Verify the run level start/stop link got installed' | ||
desc 'Verify that start-stop link got installed in /etc/init.d' | ||
|
||
describe file('/etc/init.d/activemq') do | ||
it { should exist } | ||
it { should be_symlink } | ||
its('link_path') { should eq "#{activemq_install_dir}/bin/linux-#{arch}/activemq" } | ||
end | ||
end | ||
|
||
control 'activemq-service-status' do | ||
impact 1.0 | ||
title 'Verify the ActiveMQ service is set when flag is true' | ||
desc 'Verify the ActiveMQ service is running and enabled when true' | ||
|
||
if activemq_service_enabled | ||
describe service('activemq') do | ||
it { should be_installed } | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
else | ||
describe service('activemq') do | ||
it { should_not be_installed } | ||
it { should_not be_enabled } | ||
it { should_not be_running } | ||
end | ||
end | ||
end | ||
|
||
control 'check-wrapper-conf-link' do | ||
impact 1.0 | ||
title 'Verify link from bin/linux to bin/linux-arch' | ||
desc 'Verify link to bin/lunx to bin/linux-arch exists for wrapper.conf' | ||
|
||
describe file("#{activemq_install_dir}/bin/linux") do | ||
it { should exist } | ||
it { should be_symlink } | ||
its('link_path') { should eq "#{activemq_install_dir}/bin/linux-#{arch}" } | ||
end | ||
end | ||
|
||
control 'check-pid-file-link' do | ||
impact 1.0 | ||
title 'Verify link from pid file to /var/run/activemq.pid' | ||
desc 'Verify link from pid file to /var/run/activemq.pid exists' | ||
|
||
describe file('/var/run/activemq.pid') do | ||
it { should exist } | ||
it { should be_symlink } | ||
its('link_path') { should eq "#{activemq_install_dir}/bin/linux-#{arch}/ActiveMQ.pid" } | ||
end | ||
end | ||
|
||
control 'check-for-running-activemq' do | ||
impact 1.0 | ||
title 'Verify that the ActiveMQ process is running' | ||
desc 'Verify that there is a running process for ActiveMQ' | ||
|
||
describe command('ps ax | grep activem[q]') do | ||
its('exit_status') { should eq 0 } | ||
end | ||
end | ||
|
||
control 'check-for-producer-messages' do | ||
impact 1.0 | ||
title 'Verify that the ActiveMQ producer messages is 1000' | ||
desc 'Verify that ActiveMQ produces messages' | ||
|
||
describe command("/opt/apache-activemq-#{activemq_version}/bin/activemq producer") do | ||
its('stdout') { should match(/Produced: 1000 messages/) } | ||
end | ||
end | ||
|
||
control 'check-for-consumer-messages' do | ||
impact 1.0 | ||
title 'Verify that the ActiveMQ consumer messages is 1000' | ||
desc 'Verify that ActiveMQ produces messages' | ||
|
||
describe command("/opt/apache-activemq-#{activemq_version}/bin/activemq consumer") do | ||
its('stdout') { should match(/Consumed: 1000 messages/) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: activemq-legacy | ||
title: ActiveMQ Inspec installation tests using activemq::default | ||
license: Public Domain | ||
copyright: none | ||
summary: Verify ActiveMQ is installed via legacy recipe | ||
version: 0.0.1 | ||
|
||
supports: | ||
- os-family: linux |
77 changes: 77 additions & 0 deletions
77
test/integration/activemq-resource/controls/activemq_resource_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
activemq_version = attribute('activemq_version', | ||
default: '5.14.5', | ||
description: 'Which version of ActiveMQ is to be installed' | ||
) | ||
activemq_instance_name = attribute('activemq_instance_name', | ||
default: 'main_queue', | ||
description: 'Instance being created, which is also the user/group names' | ||
) | ||
activemq_group_name = attribute('activemq_group_name', | ||
default: "activemq_#{activemq_instance_name}", | ||
description: 'Get the group name to use for permissions of the instance' | ||
) | ||
activemq_user_name = attribute('activemq_user_name', | ||
default: "activemq_#{activemq_instance_name}", | ||
description: 'Get the name name to use for permissions of the instance' | ||
) | ||
activemq_install_dir = attribute('activemq_install_directory', | ||
default: "/opt/activemq_#{activemq_instance_name}_#{activemq_version.tr('.', '_')}", | ||
description: 'Get the path where ActiveAQ should be installed' | ||
) | ||
|
||
control 'check-tar-installation' do | ||
impact 1.0 | ||
title 'Verify that the tar package is installed' | ||
desc 'Verify tar is installed so ActiveAQ can be installed' | ||
|
||
describe package('tar') do | ||
it { should be_installed } | ||
end | ||
end | ||
|
||
control 'check-group-name' do | ||
impact 1.0 | ||
title 'Verify that the group is created' | ||
desc 'Verify that /etc/group contains an entry for the instance name' | ||
|
||
describe group(activemq_group_name) do | ||
it { should exist } | ||
end | ||
end | ||
|
||
control 'check-user-name' do | ||
impact 1.0 | ||
title 'Verify that the user is created' | ||
desc 'Verify that /etc/passwd contains an entry for the instance name' | ||
|
||
describe group(activemq_user_name) do | ||
it { should exist } | ||
end | ||
end | ||
|
||
control 'check-install-directory' do | ||
impact 1.0 | ||
title 'Verify the install directory has been created' | ||
desc 'Verify the existence of the ActiveAQ installation directory' | ||
|
||
describe directory(activemq_install_dir) do | ||
it { should exist } | ||
it { should be_directory } | ||
its('path') { should eq activemq_install_dir } | ||
its('mode') { should cmp 0o750 } | ||
its('group') { should eq activemq_group_name } | ||
its('owner') { should eq activemq_user_name } | ||
end | ||
end | ||
|
||
control 'check-install-link' do | ||
impact 1.0 | ||
title 'Verify the link to the install directory has been created' | ||
desc 'Verify the existence of the link to the installation directory' | ||
|
||
describe file("/opt/activemq_#{activemq_instance_name}") do | ||
it { should exist } | ||
it { should be_symlink } | ||
its('link_path') { should eq activemq_install_dir } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: activemq-resource | ||
title: ActiveMQ Inspec tests for the activemq_install resource | ||
license: Public Domain | ||
copyright: none | ||
summary: Verify ActiveMQ is installed via resource | ||
version: 0.0.1 | ||
|
||
supports: | ||
- os-family: linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
activemq_version: 5.14.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters