-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:redBorder/redborder-serverspec-ma…
…nager into improvement/pmacctd_test
- Loading branch information
Showing
10 changed files
with
371 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,72 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'json' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
|
||
packages = %w[ | ||
redborder-druid cookbook-druid druid | ||
] | ||
service = 'druid-historical' | ||
port = 8083 | ||
|
||
describe 'Checking Druid Historical Service - Basic Checks' do | ||
packages.each do |package| | ||
describe package(package) do | ||
it { should be_installed } | ||
def service_registered_and_healthy?(service) | ||
api_endpoint = 'http://localhost:8500/v1' | ||
service_json = command("curl -s #{api_endpoint}/catalog/service/#{service} | jq -r '.[]'").stdout | ||
health = command("curl -s #{api_endpoint}/health/service/#{service} | jq -r '.[].Checks[0].Status'").stdout.strip | ||
JSON.parse(service_json).any? && health == 'passing' | ||
end | ||
|
||
service_status = command("systemctl is-enabled #{service}").stdout.strip | ||
|
||
if service_status == 'enabled' | ||
describe 'Druid Historical Service Checks for Enabled Service' do | ||
describe service(service) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
end | ||
|
||
describe service('druid-historical') do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
describe port(port) do | ||
it { should be_listening } | ||
end | ||
|
||
describe 'Configuration' do | ||
describe file('/usr/lib/druid/conf/druid/historical/jvm.config') do | ||
it { should exist } | ||
end | ||
|
||
describe file('/var/log/druid/historical.log') do | ||
its(:content) { should_not match(/ERROR/) } | ||
end | ||
|
||
it 'should be registered and healthy in Consul' do | ||
expect(service_registered_and_healthy?(service)).to be true | ||
end | ||
end | ||
end | ||
|
||
describe 'Checking Druid Historical Service - Advanced Checks' do | ||
describe 'System Dependencies' do | ||
describe package('java-1.8.0-openjdk') do | ||
it { should be_installed } | ||
if service_status == 'disabled' | ||
describe 'Druid Historical Service Checks for Disabled Service' do | ||
describe service(service) do | ||
it 'should not be enabled' do | ||
expect(subject).not_to be_enabled | ||
end | ||
|
||
it 'should not be running' do | ||
expect(subject).not_to be_running | ||
end | ||
end | ||
end | ||
|
||
describe 'Network and Connectivity' do | ||
describe port(8083) do | ||
it { should be_listening } | ||
describe port(port) do | ||
it 'should not be listening' do | ||
expect(subject).not_to be_listening | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe 'Druid Historical Logs' do | ||
describe file('/var/log/druid/historical.log') do | ||
its(:content) { should_not match(/ERROR/) } | ||
describe 'Checking Druid Historical Dependencies and Configuration' do | ||
%w[redborder-druid cookbook-druid druid java-1.8.0-openjdk].each do |pkg| | ||
describe package(pkg) do | ||
it "#{pkg} should be installed" do | ||
expect(subject).to be_installed | ||
end | ||
end | ||
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,54 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
|
||
packages = %w[ | ||
redborder-druid cookbook-druid druid | ||
] | ||
|
||
service = 'druid-middlemanager' | ||
port = 8091 | ||
|
||
describe "Checking packages for #{service}..." do | ||
packages.each do |package| | ||
describe package(package) do | ||
before do | ||
skip("#{package} is not installed, skipping...") unless package(package).installed? | ||
end | ||
|
||
it 'is expected to be installed' do | ||
expect(package(package).installed?).to be true | ||
end | ||
end | ||
end | ||
end | ||
|
||
service_status = command("systemctl is-enabled #{service}").stdout | ||
service_status = service_status.strip | ||
|
||
if service_status == 'enabled' | ||
describe "Checking #{service_status} service for #{service}..." do | ||
describe service(service) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
describe port(port) do | ||
it { should be_listening } | ||
end | ||
end | ||
end | ||
|
||
if service_status == 'disabled' | ||
describe "Checking #{service_status} service for #{service}..." do | ||
describe service(service) do | ||
it { should_not be_enabled } | ||
it { should_not be_running } | ||
end | ||
|
||
describe port(port) do | ||
it { should_not be_listening } | ||
end | ||
end | ||
end |
Oops, something went wrong.