Merge pull request #3107 from quay/public-catalog-db-test

Add a test to ensure we don't hit the database when accessing a private catalog with no auth
This commit is contained in:
Joseph Schorr 2018-06-06 11:23:03 -04:00 committed by GitHub
commit b0489aa8b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -674,6 +674,19 @@ def test_push_disabled_namespace(pusher, basic_images, liveserver_session,
credentials=credentials, expected_failure=Failures.NAMESPACE_DISABLED)
def test_private_catalog_no_access(v2_protocol, liveserver_session, app_reloader, liveserver,
registry_server_executor):
""" Test: Ensure that accessing a private catalog with anonymous access results in no database
connections.
"""
with FeatureFlagValue('PUBLIC_CATALOG', False, registry_server_executor.on(liveserver)):
# Disconnect the server from the database.
registry_server_executor.on(liveserver).break_database()
results = v2_protocol.catalog(liveserver_session)
assert not results
@pytest.mark.parametrize('public_catalog, credentials, expected_repos', [
# No public access and no credentials => No results.
(False, None, None),