Ensure that we limit the length of repository names
Until now, they'd simply be truncated by the database. Now, we properly check their lengths. Fixes https://jira.coreos.com/browse/QUAY-963
This commit is contained in:
parent
beebe6d5ed
commit
a572fd33c7
6 changed files with 41 additions and 7 deletions
|
@ -362,15 +362,25 @@ def test_image_replication(pusher, basic_images, liveserver_session, app_reloade
|
|||
assert r.text == 'OK'
|
||||
|
||||
|
||||
def test_push_reponame_with_slashes(pusher, basic_images, liveserver_session, app_reloader):
|
||||
""" Test: Attempt to add a repository name with slashes. This should fail as we do not
|
||||
support it.
|
||||
@pytest.mark.parametrize('repo_name, expected_failure', [
|
||||
('something', None),
|
||||
('some/slash', Failures.SLASH_REPOSITORY),
|
||||
pytest.param('x' * 255, None, id='Valid long name'),
|
||||
pytest.param('x' * 256, Failures.INVALID_REPOSITORY, id='Name too long'),
|
||||
])
|
||||
def test_push_reponame(repo_name, expected_failure, pusher, puller, basic_images,
|
||||
liveserver_session, app_reloader):
|
||||
""" Test: Attempt to add a repository with various names.
|
||||
"""
|
||||
credentials = ('devtable', 'password')
|
||||
|
||||
pusher.push(liveserver_session, 'devtable', 'some/slash', 'latest', basic_images,
|
||||
pusher.push(liveserver_session, 'devtable', repo_name, 'latest', basic_images,
|
||||
credentials=credentials,
|
||||
expected_failure=Failures.INVALID_REPOSITORY)
|
||||
expected_failure=expected_failure)
|
||||
|
||||
if expected_failure is None:
|
||||
puller.pull(liveserver_session, 'devtable', repo_name, 'latest', basic_images,
|
||||
credentials=credentials)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('tag_name, expected_failure', [
|
||||
|
|
Reference in a new issue