Remove yaml and switch to JSON because yaml is so slow

This commit is contained in:
Joseph Schorr 2015-09-24 16:17:42 -04:00
parent f0636c0536
commit 4dc30d6321
2 changed files with 15 additions and 14 deletions

View file

@ -24,6 +24,7 @@ import endpoints.decorated
import json
import features
import hashlib
import logging
import tarfile
import shutil
@ -48,6 +49,8 @@ except ValueError:
# DB connection.
testbp = Blueprint('testbp', __name__)
logger = logging.getLogger(__name__)
@testbp.route('/csrf', methods=['GET'])
def generate_csrf():
@ -101,6 +104,7 @@ class TestFeature(object):
_PORT_NUMBER = 5001
_CLEAN_DATABASE_PATH = None
_JWK = RSAKey(key=RSA.generate(2048))
def get_new_database_uri():
@ -334,6 +338,9 @@ class V2RegistryPushMixin(V2RegistryMixin):
checksum = 'sha256:' + hashlib.sha256(full_contents).hexdigest()
builder.add_layer(checksum, json.dumps({'id': image_id, 'data': contents}))
# Build the manifest.
manifest = builder.build(_JWK)
# Push the image's layers.
for image_id, contents in images.iteritems():
chunks = None
@ -368,10 +375,6 @@ class V2RegistryPushMixin(V2RegistryMixin):
self.conduct('PUT', location, params=dict(digest=checksum), expected_code=201, auth='jwt')
# Write the manifest.
new_key = RSA.generate(2048)
jwk = RSAKey(key=new_key)
manifest = builder.build(jwk)
self.conduct('PUT', '/v2/%s/%s/manifests/%s' % (namespace, repository, tag_name),
data=manifest.bytes, expected_code=202,
headers={'Content-Type': 'application/json'}, auth='jwt')