Skip to content

Commit e9cd9b2

Browse files
authored
Merge pull request #844 from kmala/scale
fix(scale): return error message in proper format
2 parents 9749a29 + 4efaed2 commit e9cd9b2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

rootfs/api/models/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def scale(self, user, structure): # noqa
317317
for target, count in structure.copy().items():
318318
structure[target] = int(count)
319319
validate_app_structure(structure)
320-
except (TypeError, ValueError) as e:
320+
except (TypeError, ValueError, ValidationError) as e:
321321
raise DeisException('Invalid scaling format: {}'.format(e))
322322

323323
# test for available process types

rootfs/api/tests/test_pods.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ def test_scale_errors(self, mock_requests):
415415
body = {'web': -1}
416416
response = self.client.post(url, body)
417417
self.assertEqual(response.status_code, 400, response.data)
418+
self.assertEqual(response.data, {"detail": "Invalid scaling format: "
419+
"['Must be greater than or equal to zero']"})
418420

419421
# scale to something other than a number
420422
url = "/v2/apps/{app_id}/scale".format(**locals())

0 commit comments

Comments
 (0)