wellness 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wellness/middleware.rb +4 -4
- data/lib/wellness/services/postgres_service.rb +8 -8
- data/lib/wellness/version.rb +1 -1
- data/spec/wellness/middleware_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4dfb06c69ae9ad383213314a083e3d45f29494bc
|
|
4
|
+
data.tar.gz: da02f76f57427872ec6aee0758f47f888cd22aa0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b0bbb5258a83a3c434857e6f1625c1e957937a2db2af93f4de2f24298ef736ad8f4f2757c3f74858c84d0384f80e185653810242cc928723109993c3c9fbdca
|
|
7
|
+
data.tar.gz: 8ea9833a6380a18562e24c752b0a21f8a932279c2a793ed4c653b1f04c3394f4f6c61dd260645c02ef0e349252e8648f3586eec1208e37333fc47b75f7eae97d
|
data/lib/wellness/middleware.rb
CHANGED
|
@@ -29,17 +29,17 @@ module Wellness
|
|
|
29
29
|
|
|
30
30
|
def health_status_check
|
|
31
31
|
if @system.check
|
|
32
|
-
[200, { 'Content-Type' => '
|
|
32
|
+
[200, { 'Content-Type' => 'application/json' }, [{ status: 'HEALTHY' }.to_json]]
|
|
33
33
|
else
|
|
34
|
-
[500, { 'Content-Type' => '
|
|
34
|
+
[500, { 'Content-Type' => 'application/json' }, [{ status: 'UNHEALTHY' }.to_json]]
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def health_details_check
|
|
39
39
|
if @system.check
|
|
40
|
-
[200, { 'Content-Type' => '
|
|
40
|
+
[200, { 'Content-Type' => 'application/json' }, [@system.to_json]]
|
|
41
41
|
else
|
|
42
|
-
[500, { 'Content-Type' => '
|
|
42
|
+
[500, { 'Content-Type' => 'application/json' }, [@system.to_json]]
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -7,14 +7,14 @@ module Wellness
|
|
|
7
7
|
class PostgresService < Wellness::Services::Base
|
|
8
8
|
def check
|
|
9
9
|
case ping
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
when PG::Constants::PQPING_NO_ATTEMPT
|
|
11
|
+
ping_failed('no attempt made to ping')
|
|
12
|
+
when PG::Constants::PQPING_NO_RESPONSE
|
|
13
|
+
ping_failed('no response from ping')
|
|
14
|
+
when PG::Constants::PQPING_REJECT
|
|
15
|
+
ping_failed('ping was rejected')
|
|
16
|
+
else
|
|
17
|
+
ping_successful
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
data/lib/wellness/version.rb
CHANGED
|
@@ -38,7 +38,7 @@ describe Wellness::Middleware do
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it 'returns a json content type' do
|
|
41
|
-
expect(subject[1]).to eq({ 'Content-Type' => '
|
|
41
|
+
expect(subject[1]).to eq({ 'Content-Type' => 'application/json' })
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
it 'returns UNHEALTHY' do
|
|
@@ -55,7 +55,7 @@ describe Wellness::Middleware do
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
it 'returns a json content type' do
|
|
58
|
-
expect(subject[1]).to eq({ 'Content-Type' => '
|
|
58
|
+
expect(subject[1]).to eq({ 'Content-Type' => 'application/json' })
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
it 'returns HEALTHY' do
|
|
@@ -79,7 +79,7 @@ describe Wellness::Middleware do
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
it 'returns a json content type' do
|
|
82
|
-
expect(subject[1]).to eq({ 'Content-Type' => '
|
|
82
|
+
expect(subject[1]).to eq({ 'Content-Type' => 'application/json' })
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
it 'returns UNHEALTHY' do
|
|
@@ -108,7 +108,7 @@ describe Wellness::Middleware do
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
it 'returns a json content type' do
|
|
111
|
-
expect(subject[1]).to eq({ 'Content-Type' => '
|
|
111
|
+
expect(subject[1]).to eq({ 'Content-Type' => 'application/json' })
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
it 'returns UNHEALTHY' do
|