diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-14 00:09:31 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-14 00:09:31 +0300 |
commit | c19dce027b11e8172105685f2a306be51fdac8d3 (patch) | |
tree | fc613edfe02d94caceb5cf58d933828480172259 /spec/routing | |
parent | feb61d56e7ce9ab2cd994486bbad9887c3c023f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/routing')
-rw-r--r-- | spec/routing/group_routing_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/routing/group_routing_spec.rb b/spec/routing/group_routing_spec.rb index 9de99b73d23..f4d5ccc81b6 100644 --- a/spec/routing/group_routing_spec.rb +++ b/spec/routing/group_routing_spec.rb @@ -79,4 +79,40 @@ RSpec.describe "Groups", "routing" do let(:group_path) { 'projects.abc123' } end end + + describe 'dependency proxy for containers' do + context 'image name without namespace' do + it 'routes to #manifest' do + expect(get('/v2/gitlabhq/dependency_proxy/containers/ruby/manifests/2.3.6')) + .to route_to('groups/dependency_proxy_for_containers#manifest', group_id: 'gitlabhq', image: 'ruby', tag: '2.3.6') + end + + it 'routes to #blob' do + expect(get('/v2/gitlabhq/dependency_proxy/containers/ruby/blobs/abc12345')) + .to route_to('groups/dependency_proxy_for_containers#blob', group_id: 'gitlabhq', image: 'ruby', sha: 'abc12345') + end + + it 'does not route to #blob with an invalid sha' do + expect(get('/v2/gitlabhq/dependency_proxy/containers/ruby/blobs/sha256:asdf1234%2f%2e%2e')) + .not_to route_to(group_id: 'gitlabhq', image: 'ruby', sha: 'sha256:asdf1234%2f%2e%2e') + end + + it 'does not route to #blob with an invalid image' do + expect(get('/v2/gitlabhq/dependency_proxy/containers/ru*by/blobs/abc12345')) + .not_to route_to('groups/dependency_proxy_for_containers#blob', group_id: 'gitlabhq', image: 'ru*by', sha: 'abc12345') + end + end + + context 'image name with namespace' do + it 'routes to #manifest' do + expect(get('/v2/gitlabhq/dependency_proxy/containers/foo/bar/manifests/2.3.6')) + .to route_to('groups/dependency_proxy_for_containers#manifest', group_id: 'gitlabhq', image: 'foo/bar', tag: '2.3.6') + end + + it 'routes to #blob' do + expect(get('/v2/gitlabhq/dependency_proxy/containers/foo/bar/blobs/abc12345')) + .to route_to('groups/dependency_proxy_for_containers#blob', group_id: 'gitlabhq', image: 'foo/bar', sha: 'abc12345') + end + end + end end |