Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/internal/kubernetes_spec.rb')
-rw-r--r--spec/requests/api/internal/kubernetes_spec.rb90
1 files changed, 0 insertions, 90 deletions
diff --git a/spec/requests/api/internal/kubernetes_spec.rb b/spec/requests/api/internal/kubernetes_spec.rb
index 24422f7b0dd..245e4e6ba15 100644
--- a/spec/requests/api/internal/kubernetes_spec.rb
+++ b/spec/requests/api/internal/kubernetes_spec.rb
@@ -177,94 +177,4 @@ RSpec.describe API::Internal::Kubernetes do
end
end
end
-
- describe 'GET /internal/kubernetes/project_info' do
- def send_request(headers: {}, params: {})
- get api('/internal/kubernetes/project_info'), params: params, headers: headers.reverse_merge(jwt_auth_headers)
- end
-
- include_examples 'authorization'
- include_examples 'agent authentication'
-
- context 'an agent is found' do
- let_it_be(:agent_token) { create(:cluster_agent_token) }
-
- shared_examples 'agent token tracking'
-
- context 'project is public' do
- let(:project) { create(:project, :public) }
-
- it 'returns expected data', :aggregate_failures do
- send_request(params: { id: project.id }, headers: { 'Authorization' => "Bearer #{agent_token.token}" })
-
- expect(response).to have_gitlab_http_status(:success)
-
- expect(json_response).to match(
- a_hash_including(
- 'project_id' => project.id,
- 'gitaly_info' => a_hash_including(
- 'address' => match(/\.socket$/),
- 'token' => 'secret',
- 'features' => {}
- ),
- 'gitaly_repository' => a_hash_including(
- 'storage_name' => project.repository_storage,
- 'relative_path' => project.disk_path + '.git',
- 'gl_repository' => "project-#{project.id}",
- 'gl_project_path' => project.full_path
- )
- )
- )
- end
-
- context 'repository is for project members only' do
- let(:project) { create(:project, :public, :repository_private) }
-
- it 'returns 404' do
- send_request(params: { id: project.id }, headers: { 'Authorization' => "Bearer #{agent_token.token}" })
-
- expect(response).to have_gitlab_http_status(:not_found)
- end
- end
- end
-
- context 'project is private' do
- let(:project) { create(:project, :private) }
-
- it 'returns 404' do
- send_request(params: { id: project.id }, headers: { 'Authorization' => "Bearer #{agent_token.token}" })
-
- expect(response).to have_gitlab_http_status(:not_found)
- end
-
- context 'and agent belongs to project' do
- let(:agent_token) { create(:cluster_agent_token, agent: create(:cluster_agent, project: project)) }
-
- it 'returns 200' do
- send_request(params: { id: project.id }, headers: { 'Authorization' => "Bearer #{agent_token.token}" })
-
- expect(response).to have_gitlab_http_status(:success)
- end
- end
- end
-
- context 'project is internal' do
- let(:project) { create(:project, :internal) }
-
- it 'returns 404' do
- send_request(params: { id: project.id }, headers: { 'Authorization' => "Bearer #{agent_token.token}" })
-
- expect(response).to have_gitlab_http_status(:not_found)
- end
- end
-
- context 'project does not exist' do
- it 'returns 404' do
- send_request(params: { id: non_existing_record_id }, headers: { 'Authorization' => "Bearer #{agent_token.token}" })
-
- expect(response).to have_gitlab_http_status(:not_found)
- end
- end
- end
- end
end