serverspec 0.6.26 → 0.6.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,11 +68,6 @@ module Serverspec
68
68
  ret[:exit_status] == 0
69
69
  end
70
70
 
71
- def check_running_under_upstart(process)
72
- ret = run_command(commands.check_running_under_upstart(process))
73
- ret[:exit_status] == 0 && ret[:stdout] =~ /running/
74
- end
75
-
76
71
  def check_monitored_by_monit(process)
77
72
  ret = run_command(commands.check_monitored_by_monit(process))
78
73
  return false unless ret[:stdout] != nil && ret[:exit_status] == 0
@@ -91,13 +91,17 @@ module Serverspec
91
91
  end
92
92
 
93
93
  def check_running_under_upstart(service)
94
- "initctl status #{escape(service)}"
94
+ "initctl status #{escape(service)} | grep running"
95
95
  end
96
96
 
97
97
  def check_monitored_by_monit(service)
98
98
  "monit status"
99
99
  end
100
100
 
101
+ def check_monitored_by_god(service)
102
+ "god status #{escape(service)}"
103
+ end
104
+
101
105
  def check_process(process)
102
106
  "ps aux | grep -w -- #{escape(process)} | grep -qv grep"
103
107
  end
@@ -21,9 +21,10 @@ module Serverspec
21
21
 
22
22
  def monitored_by?(monitor)
23
23
  check_method = "check_monitored_by_#{monitor}".to_sym
24
- unless monitor && backend.respond_to?(check_method)
25
- raise ArgumentError.new("`be_monitored_by` matcher doesn't support #{monitor}")
24
+ unless monitor && commands.respond_to?(check_method)
25
+ raise ArgumentError.new("`be_monitored_by` matcher doesn't support #{monitor}")
26
26
  end
27
+
27
28
  backend.send(check_method, @name)
28
29
  end
29
30
 
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.6.26"
2
+ VERSION = "0.6.27"
3
3
  end
@@ -34,6 +34,7 @@ end
34
34
 
35
35
  describe service('sshd') do
36
36
  it { should be_running.under('supervisor') }
37
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
37
38
  end
38
39
 
39
40
  describe service('invalid-daemon') do
@@ -41,13 +42,8 @@ describe service('invalid-daemon') do
41
42
  end
42
43
 
43
44
  describe service('sshd') do
44
- let(:stdout) { "sshd running\r\n" }
45
45
  it { should be_running.under('upstart') }
46
- end
47
-
48
- describe service('sshd') do
49
- let(:stdout) { "sshd waiting\r\n" }
50
- it { should_not be_running.under('upstart') }
46
+ its(:command) { should eq "initctl status sshd | grep running" }
51
47
  end
52
48
 
53
49
  describe service('invalid-daemon') do
@@ -77,6 +73,15 @@ describe service('invalid-daemon') do
77
73
  it { should_not be_monitored_by('monit') }
78
74
  end
79
75
 
76
+ describe service('unicorn') do
77
+ it { should be_monitored_by('god') }
78
+ its(:command) { should eq "god status unicorn" }
79
+ end
80
+
81
+ describe service('invalid-daemon') do
82
+ it { should_not be_monitored_by('god') }
83
+ end
84
+
80
85
  describe service('sshd') do
81
86
  it {
82
87
  expect {
@@ -36,6 +36,7 @@ end
36
36
 
37
37
  describe service('sshd') do
38
38
  it { should be_running.under('supervisor') }
39
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
39
40
  end
40
41
 
41
42
  describe service('invalid-daemon') do
@@ -43,13 +44,8 @@ describe service('invalid-daemon') do
43
44
  end
44
45
 
45
46
  describe service('sshd') do
46
- let(:stdout) { "sshd running\r\n" }
47
47
  it { should be_running.under('upstart') }
48
- end
49
-
50
- describe service('sshd') do
51
- let(:stdout) { "sshd waiting\r\n" }
52
- it { should_not be_running.under('upstart') }
48
+ its(:command) { should eq "initctl status sshd | grep running" }
53
49
  end
54
50
 
55
51
  describe service('invalid-daemon') do
@@ -79,6 +75,15 @@ describe service('invalid-daemon') do
79
75
  it { should_not be_monitored_by('monit') }
80
76
  end
81
77
 
78
+ describe service('unicorn') do
79
+ it { should be_monitored_by('god') }
80
+ its(:command) { should eq "god status unicorn" }
81
+ end
82
+
83
+ describe service('invalid-daemon') do
84
+ it { should_not be_monitored_by('god') }
85
+ end
86
+
82
87
  describe service('sshd') do
83
88
  it {
84
89
  expect {
@@ -36,6 +36,7 @@ end
36
36
 
37
37
  describe service('sshd') do
38
38
  it { should be_running.under('supervisor') }
39
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
39
40
  end
40
41
 
41
42
  describe service('invalid-daemon') do
@@ -43,13 +44,8 @@ describe service('invalid-daemon') do
43
44
  end
44
45
 
45
46
  describe service('sshd') do
46
- let(:stdout) { "sshd running\r\n" }
47
47
  it { should be_running.under('upstart') }
48
- end
49
-
50
- describe service('sshd') do
51
- let(:stdout) { "sshd waiting\r\n" }
52
- it { should_not be_running.under('upstart') }
48
+ its(:command) { should eq "initctl status sshd | grep running" }
53
49
  end
54
50
 
55
51
  describe service('invalid-daemon') do
@@ -79,6 +75,15 @@ describe service('invalid-daemon') do
79
75
  it { should_not be_monitored_by('monit') }
80
76
  end
81
77
 
78
+ describe service('unicorn') do
79
+ it { should be_monitored_by('god') }
80
+ its(:command) { should eq "god status unicorn" }
81
+ end
82
+
83
+ describe service('invalid-daemon') do
84
+ it { should_not be_monitored_by('god') }
85
+ end
86
+
82
87
  describe service('sshd') do
83
88
  it {
84
89
  expect {
@@ -36,6 +36,7 @@ end
36
36
 
37
37
  describe service('sshd') do
38
38
  it { should be_running.under('supervisor') }
39
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
39
40
  end
40
41
 
41
42
  describe service('invalid-daemon') do
@@ -43,13 +44,8 @@ describe service('invalid-daemon') do
43
44
  end
44
45
 
45
46
  describe service('sshd') do
46
- let(:stdout) { "sshd running\r\n" }
47
47
  it { should be_running.under('upstart') }
48
- end
49
-
50
- describe service('sshd') do
51
- let(:stdout) { "sshd waiting\r\n" }
52
- it { should_not be_running.under('upstart') }
48
+ its(:command) { should eq "initctl status sshd | grep running" }
53
49
  end
54
50
 
55
51
  describe service('invalid-daemon') do
@@ -79,6 +75,15 @@ describe service('invalid-daemon') do
79
75
  it { should_not be_monitored_by('monit') }
80
76
  end
81
77
 
78
+ describe service('unicorn') do
79
+ it { should be_monitored_by('god') }
80
+ its(:command) { should eq "god status unicorn" }
81
+ end
82
+
83
+ describe service('invalid-daemon') do
84
+ it { should_not be_monitored_by('god') }
85
+ end
86
+
82
87
  describe service('sshd') do
83
88
  it {
84
89
  expect {
@@ -36,6 +36,7 @@ end
36
36
 
37
37
  describe service('sshd') do
38
38
  it { should be_running.under('supervisor') }
39
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
39
40
  end
40
41
 
41
42
  describe service('invalid-daemon') do
@@ -43,13 +44,8 @@ describe service('invalid-daemon') do
43
44
  end
44
45
 
45
46
  describe service('sshd') do
46
- let(:stdout) { "sshd running\r\n" }
47
47
  it { should be_running.under('upstart') }
48
- end
49
-
50
- describe service('sshd') do
51
- let(:stdout) { "sshd waiting\r\n" }
52
- it { should_not be_running.under('upstart') }
48
+ its(:command) { should eq "initctl status sshd | grep running" }
53
49
  end
54
50
 
55
51
  describe service('invalid-daemon') do
@@ -79,6 +75,15 @@ describe service('invalid-daemon') do
79
75
  it { should_not be_monitored_by('monit') }
80
76
  end
81
77
 
78
+ describe service('unicorn') do
79
+ it { should be_monitored_by('god') }
80
+ its(:command) { should eq "god status unicorn" }
81
+ end
82
+
83
+ describe service('invalid-daemon') do
84
+ it { should_not be_monitored_by('god') }
85
+ end
86
+
82
87
  describe service('sshd') do
83
88
  it {
84
89
  expect {
@@ -36,6 +36,7 @@ end
36
36
 
37
37
  describe service('sshd') do
38
38
  it { should be_running.under('supervisor') }
39
+ its(:command) { should eq "supervisorctl status sshd | grep RUNNING" }
39
40
  end
40
41
 
41
42
  describe service('invalid-daemon') do
@@ -43,13 +44,8 @@ describe service('invalid-daemon') do
43
44
  end
44
45
 
45
46
  describe service('sshd') do
46
- let(:stdout) { "sshd running\r\n" }
47
47
  it { should be_running.under('upstart') }
48
- end
49
-
50
- describe service('sshd') do
51
- let(:stdout) { "sshd waiting\r\n" }
52
- it { should_not be_running.under('upstart') }
48
+ its(:command) { should eq "initctl status sshd | grep running" }
53
49
  end
54
50
 
55
51
  describe service('invalid-daemon') do
@@ -79,6 +75,15 @@ describe service('invalid-daemon') do
79
75
  it { should_not be_monitored_by('monit') }
80
76
  end
81
77
 
78
+ describe service('unicorn') do
79
+ it { should be_monitored_by('god') }
80
+ its(:command) { should eq "god status unicorn" }
81
+ end
82
+
83
+ describe service('invalid-daemon') do
84
+ it { should_not be_monitored_by('god') }
85
+ end
86
+
82
87
  describe service('sshd') do
83
88
  it {
84
89
  expect {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.26
4
+ version: 0.6.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: