Fix pytests and enable parallel registry tests
This commit is contained in:
parent
135f4dae0c
commit
481cebe46b
7 changed files with 29 additions and 13 deletions
|
@ -42,6 +42,7 @@ from image.docker.schema1 import DockerSchema1ManifestBuilder
|
|||
from initdb import wipe_database, initialize_database, populate_database
|
||||
from jsonschema import validate as validate_schema
|
||||
from util.security.registry_jwt import decode_bearer_header
|
||||
from test.testutil import get_open_port
|
||||
|
||||
|
||||
try:
|
||||
|
@ -156,7 +157,6 @@ class TestFeature(object):
|
|||
headers={'Content-Type': 'application/json'})
|
||||
|
||||
|
||||
_PORT_NUMBER = 5001
|
||||
_CLEAN_DATABASE_PATH = None
|
||||
_JWK = RSAKey(key=RSA.generate(2048))
|
||||
|
||||
|
@ -236,14 +236,11 @@ def get_new_database_uri():
|
|||
|
||||
class RegistryTestCaseMixin(LiveServerTestCase):
|
||||
def create_app(self):
|
||||
global _PORT_NUMBER
|
||||
_PORT_NUMBER = _PORT_NUMBER + 1
|
||||
|
||||
if os.environ.get('DEBUG') == 'true':
|
||||
app.config['DEBUG'] = True
|
||||
|
||||
app.config['TESTING'] = True
|
||||
app.config['LIVESERVER_PORT'] = _PORT_NUMBER
|
||||
app.config['LIVESERVER_PORT'] = get_open_port()
|
||||
app.config['DB_URI'] = get_new_database_uri()
|
||||
return app
|
||||
|
||||
|
@ -1412,7 +1409,7 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
self.assertTrue(link.endswith('; rel="next"'))
|
||||
|
||||
url, _ = link.split(';')
|
||||
relative_url = url[len(self.get_server_url()):-1]
|
||||
relative_url = url[url.find('/v2/'):-1]
|
||||
|
||||
encountered.update(set(result_json['tags']))
|
||||
|
||||
|
@ -1474,8 +1471,10 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix
|
|||
labels = self.conduct('GET', '/api/v1/repository/devtable/newrepo/manifest/' + digest + '/labels').json()
|
||||
self.assertEquals(2, len(labels['labels']))
|
||||
|
||||
self.assertEquals('text/plain', labels['labels'][0]['media_type'])
|
||||
self.assertEquals('application/json', labels['labels'][1]['media_type'])
|
||||
media_types = set([label['media_type'] for label in labels['labels']])
|
||||
|
||||
self.assertTrue('text/plain' in media_types)
|
||||
self.assertTrue('application/json' in media_types)
|
||||
|
||||
def test_invalid_manifest_type(self):
|
||||
namespace = 'devtable'
|
||||
|
|
Reference in a new issue