@@ -75,32 +75,32 @@ def test_config_healthchecks(self, mock_requests):
7575 Test that healthchecks can be applied
7676 """
7777 app_id = self .create_app ()
78- readiness_probe = {'healthcheck' : { 'web/cmd' : { 'readinessProbe' :
79- {'httpGet' : {'port' : 5000 } }}}}
80-
78+ readiness_probe = {
79+ 'healthcheck' : { 'web' : { 'readinessProbe' : {'httpGet' : {'port' : 5000 }}}}
80+ }
8181 response = self .client .post (
8282 '/v2/apps/{app_id}/config' .format (** locals ()),
8383 readiness_probe )
8484 self .assertEqual (response .status_code , 201 , response .data )
85- self .assertIn ('readinessProbe' , response .data ['healthcheck' ]['web/cmd ' ])
85+ self .assertIn ('readinessProbe' , response .data ['healthcheck' ]['web' ])
8686 self .assertEqual (response .data ['healthcheck' ], readiness_probe ['healthcheck' ])
8787
88- liveness_probe = {'healthcheck' : {'web/cmd ' : {'livenessProbe' :
88+ liveness_probe = {'healthcheck' : {'web' : {'livenessProbe' :
8989 {'httpGet' : {'port' : 5000 },
9090 'successThreshold' : 1 }}}}
9191 response = self .client .post (
9292 '/v2/apps/{app_id}/config' .format (** locals ()),
9393 liveness_probe )
9494 self .assertEqual (response .status_code , 201 , response .data )
95- self .assertIn ('livenessProbe' , response .data ['healthcheck' ]['web/cmd ' ])
95+ self .assertIn ('livenessProbe' , response .data ['healthcheck' ]['web' ])
9696 self .assertEqual (
97- response .data ['healthcheck' ]['web/cmd ' ]['livenessProbe' ],
98- liveness_probe ['healthcheck' ]['web/cmd ' ]['livenessProbe' ])
97+ response .data ['healthcheck' ]['web' ]['livenessProbe' ],
98+ liveness_probe ['healthcheck' ]['web' ]['livenessProbe' ])
9999 # check that the readiness probe is still there too!
100- self .assertIn ('readinessProbe' , response .data ['healthcheck' ]['web/cmd ' ])
100+ self .assertIn ('readinessProbe' , response .data ['healthcheck' ]['web' ])
101101 self .assertEqual (
102- response .data ['healthcheck' ]['web/cmd ' ]['readinessProbe' ],
103- readiness_probe ['healthcheck' ]['web/cmd ' ]['readinessProbe' ])
102+ response .data ['healthcheck' ]['web' ]['readinessProbe' ],
103+ readiness_probe ['healthcheck' ]['web' ]['readinessProbe' ])
104104
105105 # check that config fails if trying to unset non-existing healthcheck
106106 response = self .client .post (
@@ -111,15 +111,15 @@ def test_config_healthchecks(self, mock_requests):
111111 # remove a probeType
112112 response = self .client .post (
113113 '/v2/apps/{app_id}/config' .format (** locals ()),
114- {'healthcheck' : {'web/cmd ' : {'livenessProbe' : None }}})
114+ {'healthcheck' : {'web' : {'livenessProbe' : None }}})
115115 self .assertEqual (response .status_code , 201 , response .data )
116- self .assertNotIn ('livenessProbe' , response .data ['healthcheck' ]['web/cmd ' ])
117- self .assertIn ('readinessProbe' , response .data ['healthcheck' ]['web/cmd ' ])
116+ self .assertNotIn ('livenessProbe' , response .data ['healthcheck' ]['web' ])
117+ self .assertIn ('readinessProbe' , response .data ['healthcheck' ]['web' ])
118118
119119 # check that config fails if trying to unset non-existing probeType
120120 response = self .client .post (
121121 '/v2/apps/{app_id}/config' .format (** locals ()),
122- {'healthcheck' : {'web/cmd ' : {'livenessProbe' : None }}})
122+ {'healthcheck' : {'web' : {'livenessProbe' : None }}})
123123 self .assertEqual (response .status_code , 422 , response .data )
124124
125125 # check that config fails if trying to unset non-existing probeType
@@ -131,9 +131,9 @@ def test_config_healthchecks(self, mock_requests):
131131 # check that config fails if trying to unset non-existing probeType
132132 response = self .client .post (
133133 '/v2/apps/{app_id}/config' .format (** locals ()),
134- {'healthcheck' : {'web/cmd ' : None }})
134+ {'healthcheck' : {'web' : None }})
135135 self .assertEqual (response .status_code , 201 , response .data )
136- self .assertNotIn ('web/cmd ' , response .data ['healthcheck' ])
136+ self .assertNotIn ('web' , response .data ['healthcheck' ])
137137
138138 # post a new build
139139 response = self .client .post (
@@ -151,23 +151,23 @@ def test_config_healthchecks_validations(self, mock_requests):
151151 # Set a probe different from liveness/readiness
152152 response = self .client .post (
153153 '/v2/apps/{app_id}/config' .format (** locals ()),
154- {'healthcheck' : json .dumps ({'web/cmd ' : {'testProbe' :
154+ {'healthcheck' : json .dumps ({'web' : {'testProbe' :
155155 {'httpGet' : {'port' : '50' }, 'initialDelaySeconds' : "1" }}})}
156156 )
157157 self .assertEqual (response .status_code , 400 , response .data )
158158
159159 # Set one of the values that require a numeric value to a string
160160 response = self .client .post (
161161 '/v2/apps/{app_id}/config' .format (** locals ()),
162- {'healthcheck' : json .dumps ({'web/cmd ' : {'livenessProbe' :
162+ {'healthcheck' : json .dumps ({'web' : {'livenessProbe' :
163163 {'httpGet' : {'port' : '50' }, 'initialDelaySeconds' : "t" }}})}
164164 )
165165 self .assertEqual (response .status_code , 400 , response .data )
166166
167167 # Don't set one of the mandatory value
168168 response = self .client .post (
169169 '/v2/apps/{app_id}/config' .format (** locals ()),
170- {'healthcheck' : json .dumps ({'web/cmd ' : {'livenessProbe' :
170+ {'healthcheck' : json .dumps ({'web' : {'livenessProbe' :
171171 {'httpGet' : {'path' : '/' }, 'initialDelaySeconds' : 1 }}})}
172172 )
173173 self .assertEqual (response .status_code , 400 , response .data )
@@ -176,7 +176,7 @@ def test_config_healthchecks_validations(self, mock_requests):
176176 # Don't set one of the mandatory value
177177 response = self .client .post (
178178 '/v2/apps/{app_id}/config' .format (** locals ()),
179- {'healthcheck' : {'web/cmd ' : {'livenessProbe' :
179+ {'healthcheck' : {'web' : {'livenessProbe' :
180180 {'httpGet' : {'path' : '/' , 'port' : 5000 },
181181 'successThreshold' : 5 }}}}
182182 )
@@ -199,7 +199,7 @@ def test_config_healthchecks_legacy(self, mock_requests):
199199 # this gets migrated to the new healtcheck format
200200 self .assertNotIn ('HEALTHCHECK_URL' , response .data ['values' ])
201201 # legacy defaults
202- expected = {'web/cmd ' : {
202+ expected = {'web' : {
203203 'livenessProbe' : {
204204 'initialDelaySeconds' : 50 ,
205205 'timeoutSeconds' : 50 ,
@@ -240,7 +240,7 @@ def test_config_healthchecks_legacy(self, mock_requests):
240240 self .assertEqual (response .status_code , 201 , response .data )
241241 # this gets migrated to the new healtcheck format
242242 self .assertNotIn ('HEALTHCHECK_INITIAL_DELAY' , response .data ['values' ])
243- expected ['web/cmd ' ]['livenessProbe' ] = {
243+ expected ['web' ]['livenessProbe' ] = {
244244 'initialDelaySeconds' : 25 ,
245245 'timeoutSeconds' : 10 ,
246246 'periodSeconds' : 5 ,
@@ -250,6 +250,6 @@ def test_config_healthchecks_legacy(self, mock_requests):
250250 'path' : '/health'
251251 }
252252 }
253- expected ['web/cmd ' ]['readinessProbe' ] = expected ['web/cmd ' ]['livenessProbe' ]
253+ expected ['web' ]['readinessProbe' ] = expected ['web' ]['livenessProbe' ]
254254 actual = app .config_set .latest ().healthcheck
255255 self .assertEqual (expected , actual )
0 commit comments