From 7e9c479f7de77702622631cff2628a9c8dcbc627 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Nov 2020 08:27:35 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-6-stable-ee --- spec/routing/group_routing_spec.rb | 36 ++++++++++++++++++++++++++++++++++++ spec/routing/openid_connect_spec.rb | 5 ----- spec/routing/routing_spec.rb | 7 +++++++ 3 files changed, 43 insertions(+), 5 deletions(-) (limited to 'spec/routing') 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 diff --git a/spec/routing/openid_connect_spec.rb b/spec/routing/openid_connect_spec.rb index b5291953730..dc9190114fd 100644 --- a/spec/routing/openid_connect_spec.rb +++ b/spec/routing/openid_connect_spec.rb @@ -3,7 +3,6 @@ require 'spec_helper' # oauth_discovery_keys GET /oauth/discovery/keys(.:format) doorkeeper/openid_connect/discovery#keys -# jwks GET /-/jwks(.:format) doorkeeper/openid_connect/discovery#keys # oauth_discovery_provider GET /.well-known/openid-configuration(.:format) doorkeeper/openid_connect/discovery#provider # oauth_discovery_webfinger GET /.well-known/webfinger(.:format) doorkeeper/openid_connect/discovery#webfinger RSpec.describe Doorkeeper::OpenidConnect::DiscoveryController, 'routing' do @@ -18,10 +17,6 @@ RSpec.describe Doorkeeper::OpenidConnect::DiscoveryController, 'routing' do it "to #keys" do expect(get('/oauth/discovery/keys')).to route_to('doorkeeper/openid_connect/discovery#keys') end - - it "/-/jwks" do - expect(get('/-/jwks')).to route_to('doorkeeper/openid_connect/discovery#keys') - end end # oauth_userinfo GET /oauth/userinfo(.:format) doorkeeper/openid_connect/userinfo#show diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index f665dc31ee4..76ccdf3237c 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -369,3 +369,10 @@ RSpec.describe RunnerSetupController, 'routing' do expect(get("/-/runner_setup/platforms")).to route_to('runner_setup#platforms') end end + +# jwks GET /-/jwks(.:format) jwks#index +RSpec.describe JwksController, "routing" do + it "to #index" do + expect(get('/-/jwks')).to route_to('jwks#index') + end +end -- cgit v1.2.3