-
Notifications
You must be signed in to change notification settings - Fork 5
/
check-dcos-component-health-shared_spec.rb
32 lines (25 loc) · 1.26 KB
/
check-dcos-component-health-shared_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true
require 'spec_helper'
require 'shared_spec'
gem_path = '/usr/local/bin'
check_name = 'check-dcos-component-health.rb'
check = "#{gem_path}/#{check_name}"
describe 'ruby environment' do
it_behaves_like 'ruby checks', check
end
describe command("#{check} -u http://localhost/system/health/units") do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(Regexp.new(Regexp.escape('CheckDcosComponentHealth OK: components.unhealthy = 0'))) }
end
describe command("#{check} -u http://localhost/system/health/units/fail") do
its(:exit_status) { should eq 2 }
its(:stdout) { should match(Regexp.new(Regexp.escape('CheckDcosComponentHealth CRITICAL: components.unhealthy = 2'))) }
end
describe command("#{check} -u http://localhost/system/health/units -c 'dcos-mesos-slave-public.service'") do
its(:exit_status) { should eq 0 }
its(:stdout) { should match(Regexp.new(Regexp.escape('CheckDcosComponentHealth OK: dcos-mesos-slave-public.service = 0'))) }
end
describe command("#{check} -u http://localhost/system/health/units/fail -c 'dcos-mesos-slave-public.service'") do
its(:exit_status) { should eq 2 }
its(:stdout) { should match(Regexp.new(Regexp.escape('CheckDcosComponentHealth CRITICAL: dcos-mesos-slave-public.service = 1'))) }
end