specinfra 2.82.25 → 2.83.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/specinfra/processor.rb +1 -1
- data/lib/specinfra/version.rb +1 -1
- data/spec/processor_spec.rb +49 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d74b760931c73cff0e9828d546a7e63f658ec60a
|
4
|
+
data.tar.gz: f945ae61dd3f169436d89903db0ad45847684f63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5c308cdcf87bc332143697d3c6d8d5a47e221f1afef33e711ae0786958a71f3d20009d37d15591294465427e5a31b438ac7fb1494a868cc67895ceb50f1a3fe
|
7
|
+
data.tar.gz: cfc67a5a753304dfa7f38573c77b0f6124c4012d63cc57c81d862671fed9bda823a597de02cffa61042c8d6cb1d1ef4b2d609eb3828937bdfa9458886a7e638a
|
data/lib/specinfra/processor.rb
CHANGED
@@ -10,7 +10,7 @@ module Specinfra
|
|
10
10
|
return false if ret.stdout =~ /stop(ped)?\/waiting/
|
11
11
|
|
12
12
|
# If the service is not registered, check by ps command
|
13
|
-
if ret.exit_status == 1
|
13
|
+
if ret.exit_status == 1 && !Specinfra.configuration.no_service_process_fallback
|
14
14
|
cmd = Specinfra.command.get(:check_process_is_running, service)
|
15
15
|
ret = Specinfra.backend.run_command(cmd)
|
16
16
|
end
|
data/lib/specinfra/version.rb
CHANGED
data/spec/processor_spec.rb
CHANGED
@@ -60,4 +60,53 @@ describe Specinfra::Processor do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
describe 'check_service_is_running' do
|
65
|
+
let(:service_command) { Specinfra.command.get(:check_service_is_running, 'service_name') }
|
66
|
+
let(:process_command) { Specinfra.command.get(:check_process_is_running, 'service_name') }
|
67
|
+
|
68
|
+
context 'default settings' do
|
69
|
+
it 'does not fall back to process checking if service checking succeeds' do
|
70
|
+
allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 0 }
|
71
|
+
|
72
|
+
expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(true)
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'when service checking fails' do
|
76
|
+
it 'falls back to checking by process and returns true if that succeeds' do
|
77
|
+
allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 1 }
|
78
|
+
|
79
|
+
expect(Specinfra.backend).to receive(:run_command).with(process_command) { CommandResult.new :exit_status => 0 }
|
80
|
+
|
81
|
+
expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(true)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'falls back to checking by process and returns false if that fails' do
|
85
|
+
allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 1 }
|
86
|
+
|
87
|
+
expect(Specinfra.backend).to receive(:run_command).with(process_command) { CommandResult.new :exit_status => 1 }
|
88
|
+
|
89
|
+
expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(false)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'no_service_process_fallback set to true' do
|
95
|
+
it 'does not fall back to checking processes if service checking succeeds' do
|
96
|
+
Specinfra.configuration.no_service_process_fallback(true)
|
97
|
+
|
98
|
+
allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 0 }
|
99
|
+
|
100
|
+
expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(true)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'does not fall back to checking processes if service checking fails' do
|
104
|
+
Specinfra.configuration.no_service_process_fallback(true)
|
105
|
+
|
106
|
+
allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 1 }
|
107
|
+
|
108
|
+
expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(false)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
63
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.83.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -633,7 +633,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
633
633
|
- !ruby/object:Gem::Version
|
634
634
|
version: '0'
|
635
635
|
requirements: []
|
636
|
-
|
636
|
+
rubyforge_project:
|
637
|
+
rubygems_version: 2.5.1
|
637
638
|
signing_key:
|
638
639
|
specification_version: 4
|
639
640
|
summary: Common layer for serverspec and itamae
|