Commit dc0fdadf authored by Steve Abrams's avatar Steve Abrams Committed by Michael Kozono

Remove conan package registry feature flag

Remove the conan_package_registry feature flag
for general availability.
parent 5631a464
---
title: Add support for Conan package management in the package registry
merge_request: 21152
author:
type: added
......@@ -13,8 +13,6 @@ module Packages
end
def execute
return ServiceResponse.error(message: 'not found', http_status: :not_found) unless feature_available?
ServiceResponse.success(payload: { results: search_results })
end
......@@ -38,10 +36,6 @@ module Packages
sanitized_query
end
def feature_available?
Feature.enabled?(:conan_package_registry)
end
def search_packages(query)
Packages::ConanPackageFinder.new(current_user, query: query).execute.map(&:conan_recipe)
end
......
......@@ -27,7 +27,6 @@ module API
CONAN_REVISION_REGEX = Gitlab::Regex.conan_revision_regex
before do
not_found! unless Feature.enabled?(:conan_package_registry)
require_packages_enabled!
# Personal access token will be extracted from Bearer or Basic authorization
......
......@@ -31,67 +31,53 @@ describe API::ConanPackages do
end
describe 'GET /api/v4/packages/conan/v1/ping' do
context 'feature flag disabled' do
before do
stub_feature_flags(conan_package_registry: false)
end
it 'responds with 404 Not Found' do
get api('/packages/conan/v1/ping')
it 'responds with 401 Unauthorized when no token provided' do
get api('/packages/conan/v1/ping')
expect(response).to have_gitlab_http_status(:not_found)
end
expect(response).to have_gitlab_http_status(:unauthorized)
end
context 'feature flag enabled' do
it 'responds with 401 Unauthorized when no token provided' do
get api('/packages/conan/v1/ping')
it 'responds with 200 OK when valid token is provided' do
jwt = build_jwt(personal_access_token)
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
expect(response).to have_gitlab_http_status(:unauthorized)
end
it 'responds with 200 OK when valid token is provided' do
jwt = build_jwt(personal_access_token)
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers['X-Conan-Server-Capabilities']).to eq("")
end
expect(response).to have_gitlab_http_status(:ok)
expect(response.headers['X-Conan-Server-Capabilities']).to eq("")
end
it 'responds with 401 Unauthorized when invalid access token ID is provided' do
jwt = build_jwt(double(id: 12345), user_id: personal_access_token.user_id)
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
it 'responds with 401 Unauthorized when invalid access token ID is provided' do
jwt = build_jwt(double(id: 12345), user_id: personal_access_token.user_id)
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
expect(response).to have_gitlab_http_status(:unauthorized)
end
expect(response).to have_gitlab_http_status(:unauthorized)
end
it 'responds with 401 Unauthorized when invalid user is provided' do
jwt = build_jwt(personal_access_token, user_id: 12345)
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
it 'responds with 401 Unauthorized when invalid user is provided' do
jwt = build_jwt(personal_access_token, user_id: 12345)
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
expect(response).to have_gitlab_http_status(:unauthorized)
end
expect(response).to have_gitlab_http_status(:unauthorized)
end
it 'responds with 401 Unauthorized when the provided JWT is signed with different secret' do
jwt = build_jwt(personal_access_token, secret: SecureRandom.base64(32))
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
it 'responds with 401 Unauthorized when the provided JWT is signed with different secret' do
jwt = build_jwt(personal_access_token, secret: SecureRandom.base64(32))
get api('/packages/conan/v1/ping'), headers: build_auth_headers(jwt.encoded)
expect(response).to have_gitlab_http_status(:unauthorized)
end
expect(response).to have_gitlab_http_status(:unauthorized)
end
it 'responds with 401 Unauthorized when invalid JWT is provided' do
get api('/packages/conan/v1/ping'), headers: build_auth_headers('invalid-jwt')
it 'responds with 401 Unauthorized when invalid JWT is provided' do
get api('/packages/conan/v1/ping'), headers: build_auth_headers('invalid-jwt')
expect(response).to have_gitlab_http_status(:unauthorized)
end
expect(response).to have_gitlab_http_status(:unauthorized)
end
context 'packages feature disabled' do
it 'responds with 404 Not Found' do
stub_packages_setting(enabled: false)
get api('/packages/conan/v1/ping')
context 'packages feature disabled' do
it 'responds with 404 Not Found' do
stub_packages_setting(enabled: false)
get api('/packages/conan/v1/ping')
expect(response).to have_gitlab_http_status(:not_found)
end
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
......
......@@ -15,21 +15,6 @@ describe Packages::Conan::SearchService do
end
describe '#execute' do
context 'feature unavailable' do
let(:query) { '' }
before do
stub_feature_flags(conan_package_registry: false)
end
it 'responds with 404 not found' do
result = subject.execute
expect(result.http_status).to eq :not_found
expect(result.message).to eq('not found')
end
end
context 'with wildcard' do
let(:partial_name) { conan_package.name.first[0, 3] }
let(:query) { "#{partial_name}*" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment