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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /spec/requests/api/internal
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/requests/api/internal')
-rw-r--r--spec/requests/api/internal/base_spec.rb8
-rw-r--r--spec/requests/api/internal/kubernetes_spec.rb90
2 files changed, 4 insertions, 94 deletions
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index 49756df61c6..aeca4e435f4 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -609,7 +609,7 @@ RSpec.describe API::Internal::Base do
end
context 'with Project' do
- it_behaves_like 'storing arguments in the application context' do
+ it_behaves_like 'storing arguments in the application context for the API' do
let(:expected_params) { { user: key.user.username, project: project.full_path, caller_id: "POST /api/:version/internal/allowed" } }
subject { push(key, project) }
@@ -617,7 +617,7 @@ RSpec.describe API::Internal::Base do
end
context 'with PersonalSnippet' do
- it_behaves_like 'storing arguments in the application context' do
+ it_behaves_like 'storing arguments in the application context for the API' do
let(:expected_params) { { user: key.user.username, caller_id: "POST /api/:version/internal/allowed" } }
subject { push(key, personal_snippet) }
@@ -625,7 +625,7 @@ RSpec.describe API::Internal::Base do
end
context 'with ProjectSnippet' do
- it_behaves_like 'storing arguments in the application context' do
+ it_behaves_like 'storing arguments in the application context for the API' do
let(:expected_params) { { user: key.user.username, project: project_snippet.project.full_path, caller_id: "POST /api/:version/internal/allowed" } }
subject { push(key, project_snippet) }
@@ -1197,7 +1197,7 @@ RSpec.describe API::Internal::Base do
subject
end
- it_behaves_like 'storing arguments in the application context' do
+ it_behaves_like 'storing arguments in the application context for the API' do
let(:expected_params) { expected_context }
end
end
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