@@ -25,6 +25,29 @@ def test_get_no_recent_activity(self):
25
25
response = yield self .web .get ("/health" )
26
26
data = response .json_value ()
27
27
28
+ self .assertEqual (response .responseCode , 503 )
29
+ self .assertEqual (data , {
30
+ 'status' : 'fail' ,
31
+ 'description' : ANY ,
32
+ 'checks' : {
33
+ 'sync' : [{
34
+ 'componentType' : 'internal' ,
35
+ 'status' : 'fail' ,
36
+ 'output' : HathorManager .UnhealthinessReason .NO_RECENT_ACTIVITY ,
37
+ 'time' : ANY
38
+ }]
39
+ }
40
+ })
41
+
42
+ @inlineCallbacks
43
+ def test_strict_status_code (self ):
44
+ """Make sure the 'strict_status_code' parameter is working.
45
+ The node should return 200 even if it's not ready.
46
+ """
47
+ response = yield self .web .get ("/health" , {b'strict_status_code' : b'1' })
48
+ data = response .json_value ()
49
+
50
+ self .assertEqual (response .responseCode , 200 )
28
51
self .assertEqual (data , {
29
52
'status' : 'fail' ,
30
53
'description' : ANY ,
@@ -50,6 +73,7 @@ def test_get_no_connected_peer(self):
50
73
response = yield self .web .get ("/health" )
51
74
data = response .json_value ()
52
75
76
+ self .assertEqual (response .responseCode , 503 )
53
77
self .assertEqual (data , {
54
78
'status' : 'fail' ,
55
79
'description' : ANY ,
@@ -78,9 +102,10 @@ def test_get_peer_out_of_sync(self):
78
102
79
103
self .assertEqual (self .manager2 .state , self .manager2 .NodeState .READY )
80
104
81
- response = yield self .web .get ("p2p/readiness " )
105
+ response = yield self .web .get ("/health " )
82
106
data = response .json_value ()
83
107
108
+ self .assertEqual (response .responseCode , 503 )
84
109
self .assertEqual (data , {
85
110
'status' : 'fail' ,
86
111
'description' : ANY ,
@@ -109,9 +134,10 @@ def test_get_ready(self):
109
134
self .conn1 .run_one_step (debug = True )
110
135
self .clock .advance (0.1 )
111
136
112
- response = yield self .web .get ("p2p/readiness " )
137
+ response = yield self .web .get ("/health " )
113
138
data = response .json_value ()
114
139
140
+ self .assertEqual (response .responseCode , 200 )
115
141
self .assertEqual (data , {
116
142
'status' : 'pass' ,
117
143
'description' : ANY ,
0 commit comments