diff --git a/testinfra/test_static.py b/testinfra/test_static.py index bf9c93161b..eb9fc24c13 100644 --- a/testinfra/test_static.py +++ b/testinfra/test_static.py @@ -236,3 +236,27 @@ def test_ci_openstack_org(host, path, target): ' https://ci.openstack.org%s' % path) assert '301 Moved Permanently' in cmd.stdout assert target in cmd.stdout + +def test_registry_zuul_ci_org(host): + # The functional test does an actual pull; here we just check some + # specific URLs work. In particular, we want to make sure that we + # don't proxy /v2/. + + cmd = host.run('curl --resolve registry.zuul-ci.org:443:127.0.0.1' + ' https://registry.zuul-ci.org/v2/') + assert '301 Moved Permanently' not in cmd.stdout + assert '302 Found' not in cmd.stdout + assert cmd.stdout.strip() == "" + + cmd = host.run('curl --resolve registry.zuul-ci.org:443:127.0.0.1' + ' -I https://registry.zuul-ci.org/v2/zuul/manifests/8.2.0') + assert '302 Found' in cmd.stdout + assert 'Location: https://quay.io/v2/corvus/zuul/manifests/8.2.0' in cmd.stdout + + cmd = host.run('curl --resolve registry.zuul-ci.org:443:127.0.0.1' + ' https://registry.zuul-ci.org/v2/zuul/blobs/' + 'sha256:5dda314a937ad03f8beac81c714da74e459b6174301368e0903ef586a68ae150') + assert '302 Found' in cmd.stdout + assert ('https://quay.io/v2/corvus/zuul/blobs/' + 'sha256:5dda314a937ad03f8beac81c714da74e459b6174301368e0903ef586a68ae150' + in cmd.stdout)