-
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' into motd_integration_test
- Loading branch information
Showing
37 changed files
with
737 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Layout/BlockLength: | ||
Exclude: | ||
- '**/*' |
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
|
||
is_package_installed = package('redborder-ale').installed? | ||
|
||
if is_package_installed | ||
describe 'Check ale config' do | ||
describe file('/etc/redborder-ale/schema.pb.rb') do | ||
it { should exist } | ||
it { should be_file } | ||
end | ||
|
||
describe file('/etc/redborder-ale/config.yml') do | ||
it { should exist } | ||
it { should be_file } | ||
it { should_not be_empty } | ||
end | ||
|
||
describe file('/etc/redborder-ale/rb_ale_aps.conf') do | ||
it { should exist } | ||
it { should be_file } | ||
end | ||
|
||
# Additional dependencies | ||
describe file('/usr/lib64/libzmq.so') do | ||
it { should exist } | ||
it { should be_file } | ||
end | ||
|
||
describe package('zeromq-devel') do | ||
it { should be_installed } | ||
end | ||
end | ||
|
||
describe file('/var/rb-ale/bin/rb_ale.rb') do | ||
it { should exist } | ||
it { should be_file } | ||
it { should be_executable.by(:owner) } | ||
it { should be_executable.by(:group) } | ||
its(:content) { should match(%r{^(\s*#.*|)#!/usr/bin/env\s+ruby.*$}) } | ||
end | ||
|
||
describe file('/usr/bin/rb_scan_ale.rb') do | ||
it { should exist } | ||
it { should be_file } | ||
end | ||
|
||
describe file('/var/rb-ale/bin/rb_ale.rb') do | ||
it { should exist } | ||
it { should be_file } | ||
it { should be_executable.by(:owner) } | ||
it { should be_executable.by(:group) } | ||
its(:content) { should match(%r{^(\s*#.*|)#!/usr/bin/env\s+ruby.*$}) } | ||
end | ||
|
||
describe file('/usr/bin/rb_scan_ale.rb') do | ||
it { should exist } | ||
it { should be_file } | ||
it { should be_executable.by(:owner) } | ||
it { should be_executable.by(:group) } | ||
end | ||
|
||
describe 'Redborder-Ale user config' do | ||
describe command('sudo -u redborder-ale bash -lc "ruby -v"') do | ||
its(:stdout) { should match(/ruby 2.7.5/) } | ||
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
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,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
|
||
describe file('/usr/lib/redborder/bin/rb_wakeup_chef.sh'), :rb_wakeup_chef do | ||
it { should exist } | ||
it { should be_file } | ||
it { should be_executable.by_user('webui') } | ||
end | ||
|
||
describe 'Checking WakeUpClusterJob' do | ||
query_psql = "echo \"SELECT * FROM stored_delayed_jobs WHERE job='RbWakeupChefClusterJob';\" | rb_psql redborder" | ||
describe command(query_psql) do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should_not match(/Errno::EACCES: Permission denied/) } | ||
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,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
packages = %w[ | ||
GeoIP GeoIP-GeoLite-data GeoIP-GeoLite-data-extra geoipupdate | ||
] | ||
|
||
describe 'Checking geoip packages family' do | ||
packages.each do |package| | ||
describe package(package) do | ||
it 'is expected to be installed' do | ||
expect(package(package).installed?).to be true | ||
end | ||
end | ||
end | ||
end | ||
|
||
describe 'Check geoip config' do | ||
describe file('/etc/GeoIP.conf') do | ||
it { should exist } | ||
it { should be_file } | ||
its(:content) { should match(/GeoLite2-ASN/) } | ||
its(:content) { should match(/GeoLite2-City/) } | ||
its(:content) { should match(/GeoLite2-Country/) } | ||
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,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'json' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
|
||
describe 'Memcached config in webui' do | ||
describe file('/var/www/rb-rails/config/memcached_config.yml') do | ||
it { should exist } | ||
it { should be_file } | ||
it { should_not contain 'localhost' } | ||
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
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,69 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
require 'set' | ||
require 'json' | ||
set :os, family: 'redhat', release: '9', arch: 'x86_64' | ||
|
||
service = serv_consul = pkg = 'redborder-ale' | ||
# port = 7779 | ||
API_ENDPOINT = 'http://localhost:8500/v1' | ||
|
||
describe "Checking packages for #{service}..." do | ||
describe package(pkg) do | ||
before do | ||
skip("#{pkg} is not installed, skipping...") unless package(pkg).installed? | ||
end | ||
|
||
it 'is expected to be installed' do | ||
expect(package(pkg).installed?).to be true | ||
end | ||
end | ||
end | ||
|
||
service_status = command("systemctl is-enabled #{service}").stdout.strip | ||
describe "Checking #{service_status} service for #{service}..." do | ||
if service_status == 'enabled' | ||
describe service(service) do | ||
it { should be_enabled } | ||
it { should be_running } | ||
end | ||
|
||
# describe port(port) do | ||
# it { should be_listening } | ||
# end | ||
|
||
describe 'Registered in consul' do | ||
service_json_cluster = command("curl -s #{API_ENDPOINT}/catalog/service/#{serv_consul} | jq -c 'group_by(.ID)[]'") | ||
service_json_cluster = service_json_cluster.stdout.chomp.split("\n") | ||
health_cluster = command("curl -s #{API_ENDPOINT}/health/service/#{serv_consul} | jq -r '.[].Checks[0].Status'") | ||
health_cluster = health_cluster.stdout.chomp.split("\n") | ||
it 'Should be at least in one node' do | ||
# expect(service_json_cluster.size).to be > 0 # redundant check | ||
expect(health_cluster.size).to be > 0 | ||
end | ||
service_and_health = service_json_cluster.zip(health_cluster) | ||
service_and_health.each do |service, health| | ||
registered = JSON.parse(service)[0].key?('Address') && health == 'passing' # ? true : false | ||
it 'Should be registered and enabled' do | ||
expect(registered).to be true | ||
end | ||
end | ||
end | ||
|
||
elsif service_status == 'disabled' | ||
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 | ||
|
||
it 'Should be registered and enabled' do | ||
registered = JSON.parse(service)[0].key?('Address') && health == 'passing' # ? true : false | ||
expect(registered).to be true | ||
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
Oops, something went wrong.