diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/requests/api/environments_spec.rb | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/requests/api/environments_spec.rb')
-rw-r--r-- | spec/requests/api/environments_spec.rb | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/spec/requests/api/environments_spec.rb b/spec/requests/api/environments_spec.rb index 93f21c880a4..a35c1630caa 100644 --- a/spec/requests/api/environments_spec.rb +++ b/spec/requests/api/environments_spec.rb @@ -26,90 +26,7 @@ RSpec.describe API::Environments do expect(json_response.first['tier']).to eq(environment.tier) expect(json_response.first['external_url']).to eq(environment.external_url) expect(json_response.first['project']).to match_schema('public_api/v4/project') - expect(json_response.first['enable_advanced_logs_querying']).to eq(false) expect(json_response.first).not_to have_key('last_deployment') - expect(json_response.first).not_to have_key('gitlab_managed_apps_logs_path') - end - - context 'when the user can read pod logs' do - context 'with successful deployment on cluster' do - let_it_be(:deployment) { create(:deployment, :on_cluster, :success, environment: environment, project: project) } - - it 'returns environment with enable_advanced_logs_querying and logs_api_path' do - get api("/projects/#{project.id}/environments", user) - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response).to be_an Array - expect(json_response.size).to eq(1) - expect(json_response.first['gitlab_managed_apps_logs_path']).to eq( - "/#{project.full_path}/-/logs/k8s.json?cluster_id=#{deployment.cluster_id}" - ) - end - end - - context 'when elastic stack is available' do - before do - allow_next_found_instance_of(Environment) do |env| - allow(env).to receive(:elastic_stack_available?).and_return(true) - end - end - - it 'returns environment with enable_advanced_logs_querying and logs_api_path' do - get api("/projects/#{project.id}/environments", user) - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response).to be_an Array - expect(json_response.size).to eq(1) - expect(json_response.first['enable_advanced_logs_querying']).to eq(true) - expect(json_response.first['logs_api_path']).to eq( - "/#{project.full_path}/-/logs/elasticsearch.json?environment_name=#{environment.name}" - ) - end - end - - context 'when elastic stack is not available' do - before do - allow_next_found_instance_of(Environment) do |env| - allow(env).to receive(:elastic_stack_available?).and_return(false) - end - end - - it 'returns environment with enable_advanced_logs_querying logs_api_path' do - get api("/projects/#{project.id}/environments", user) - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response).to be_an Array - expect(json_response.size).to eq(1) - expect(json_response.first['enable_advanced_logs_querying']).to eq(false) - expect(json_response.first['logs_api_path']).to eq( - "/#{project.full_path}/-/logs/k8s.json?environment_name=#{environment.name}" - ) - end - end - end - - context 'when the user cannot read pod logs' do - before do - allow_next_found_instance_of(User) do |user| - allow(user).to receive(:can?).and_call_original - allow(user).to receive(:can?).with(:read_pod_logs, project).and_return(false) - end - end - - it 'does not contain enable_advanced_logs_querying' do - get api("/projects/#{project.id}/environments", user) - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to include_pagination_headers - expect(json_response).to be_an Array - expect(json_response.size).to eq(1) - expect(json_response.first).not_to have_key('enable_advanced_logs_querying') - expect(json_response.first).not_to have_key('logs_api_path') - expect(json_response.first).not_to have_key('gitlab_managed_apps_logs_path') - end end context 'when filtering' do |