Fix exception raised for certain non-JSON strings given to is_json
This is breaking pushes in production for certain manifests Fixes https://jira.prod.coreos.systems/browse/QS-60
This commit is contained in:
parent
5e5142a4d1
commit
2677720577
3 changed files with 40 additions and 2 deletions
|
@ -1536,6 +1536,27 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
self.assertTrue('text/plain' in media_types)
|
||||
self.assertTrue('application/json' in media_types)
|
||||
|
||||
def test_not_json_labels(self):
|
||||
# Push a new repo with the latest tag.
|
||||
images = [{
|
||||
'id': 'someid',
|
||||
'config': {'Labels': {'foo': '[hello world]', 'bar': '{wassup?!}'}},
|
||||
'contents': 'somecontent'
|
||||
}]
|
||||
|
||||
(_, manifests) = self.do_push('devtable', 'newrepo', 'devtable', 'password', images=images)
|
||||
digest = manifests['latest'].digest
|
||||
|
||||
self.conduct_api_login('devtable', 'password')
|
||||
labels = self.conduct('GET', '/api/v1/repository/devtable/newrepo/manifest/' + digest + '/labels').json()
|
||||
self.assertEquals(2, len(labels['labels']))
|
||||
|
||||
media_types = set([label['media_type'] for label in labels['labels']])
|
||||
|
||||
self.assertTrue('text/plain' in media_types)
|
||||
self.assertFalse('application/json' in media_types)
|
||||
|
||||
|
||||
def test_expiration_label(self):
|
||||
# Push a new repo with the latest tag.
|
||||
images = [{
|
||||
|
|
Reference in a new issue