Commit d8791851 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent fa478f18
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.34" image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
stages: stages:
- sync - sync
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
- .default-retry - .default-retry
- .default-before_script - .default-before_script
- .assets-compile-cache - .assets-compile-cache
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-graphicsmagick-1.3.34-docker-19.03.1 image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-graphicsmagick-1.3.34-docker-19.03.1
stage: prepare stage: prepare
services: services:
- docker:19.03.0-dind - docker:19.03.0-dind
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
- unknown_failure - unknown_failure
- api_failure - api_failure
- runner_system_failure - runner_system_failure
- job_execution_timeout
- stuck_or_timeout_failure
.default-before_script: .default-before_script:
before_script: before_script:
...@@ -203,7 +205,7 @@ ...@@ -203,7 +205,7 @@
- name: redis:alpine - name: redis:alpine
.use-pg10: .use-pg10:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.34" image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
services: services:
- name: postgres:10.9 - name: postgres:10.9
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
...@@ -217,7 +219,7 @@ ...@@ -217,7 +219,7 @@
- name: elasticsearch:6.4.2 - name: elasticsearch:6.4.2
.use-pg10-ee: .use-pg10-ee:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.34" image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
services: services:
- name: postgres:10.9 - name: postgres:10.9
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
......
...@@ -343,6 +343,8 @@ RSpec/HaveGitlabHttpStatus: ...@@ -343,6 +343,8 @@ RSpec/HaveGitlabHttpStatus:
- 'ee/spec/controllers/*.rb' - 'ee/spec/controllers/*.rb'
- 'spec/controllers/projects/**/*.rb' - 'spec/controllers/projects/**/*.rb'
- 'ee/spec/controllers/projects/**/*.rb' - 'ee/spec/controllers/projects/**/*.rb'
- 'spec/controllers/groups/**/*.rb'
- 'ee/spec/controllers/groups/**/*.rb'
- 'spec/requests/*.rb' - 'spec/requests/*.rb'
- 'ee/spec/requests/*.rb' - 'ee/spec/requests/*.rb'
......
import $ from 'jquery'; import $ from 'jquery';
import Chart from 'chart.js'; import Chart from 'chart.js';
import _ from 'underscore';
import { barChartOptions, pieChartOptions } from '~/lib/utils/chart_utils'; import { barChartOptions, pieChartOptions } from '~/lib/utils/chart_utils';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
...@@ -40,7 +38,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -40,7 +38,7 @@ document.addEventListener('DOMContentLoaded', () => {
backgroundColor: 'rgba(220,220,220,0.5)', backgroundColor: 'rgba(220,220,220,0.5)',
borderColor: 'rgba(220,220,220,1)', borderColor: 'rgba(220,220,220,1)',
borderWidth: 1, borderWidth: 1,
data: _.values(data), data: Object.values(data),
}, },
], ],
}); });
......
...@@ -46,10 +46,14 @@ module Metrics ...@@ -46,10 +46,14 @@ module Metrics
# Returns a new dashboard Hash, supplemented with DB info # Returns a new dashboard Hash, supplemented with DB info
def process_dashboard def process_dashboard
::Gitlab::Metrics::Dashboard::Processor ::Gitlab::Metrics::Dashboard::Processor
.new(project, raw_dashboard, sequence, params) .new(project, raw_dashboard, sequence, process_params)
.process .process
end end
def process_params
params
end
# @return [String] Relative filepath of the dashboard yml # @return [String] Relative filepath of the dashboard yml
def dashboard_path def dashboard_path
params[:dashboard_path] params[:dashboard_path]
......
---
title: Create an environment for self monitoring project
merge_request: 24403
author:
type: added
...@@ -42,9 +42,9 @@ The current stages are: ...@@ -42,9 +42,9 @@ The current stages are:
## Default image ## Default image
The default image is currently The default image is currently
`registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.16-postgresql-9.6-graphicsmagick-1.3.34`. `registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34`.
It includes Ruby 2.6.5, Go 1.12, Git 2.24, Git LFS 2.9, Chrome 73, Node 12, Yarn 1.16, It includes Ruby 2.6.5, Go 1.12, Git 2.24, Git LFS 2.9, Chrome 73, Node 12, Yarn 1.21,
PostgreSQL 9.6, and Graphics Magick 1.3.33. PostgreSQL 9.6, and Graphics Magick 1.3.33.
The images used in our pipelines are configured in the The images used in our pipelines are configured in the
...@@ -71,8 +71,8 @@ These common definitions are: ...@@ -71,8 +71,8 @@ These common definitions are:
- `.default-tags`: Ensures a job has the `gitlab-org` tag to ensure it's using - `.default-tags`: Ensures a job has the `gitlab-org` tag to ensure it's using
our dedicated runners. our dedicated runners.
- `.default-retry`: Allows a job to retry upon `unknown_failure`, `api_failure`, - `.default-retry`: Allows a job to [retry](../ci/yaml/README.md#retry) upon `unknown_failure`, `api_failure`,
`runner_system_failure`. `runner_system_failure`, `job_execution_timeout`, or `stuck_or_timeout_failure`.
- `.default-before_script`: Allows a job to use a default `before_script` definition - `.default-before_script`: Allows a job to use a default `before_script` definition
suitable for Ruby/Rails tasks that may need a database running (e.g. tests). suitable for Ruby/Rails tasks that may need a database running (e.g. tests).
- `.default-cache`: Allows a job to use a default `cache` definition suitable for - `.default-cache`: Allows a job to use a default `cache` definition suitable for
......
...@@ -15,6 +15,7 @@ module Gitlab ...@@ -15,6 +15,7 @@ module Gitlab
:create_group, :create_group,
:create_project, :create_project,
:save_project_id, :save_project_id,
:create_environment,
:add_prometheus_manual_configuration, :add_prometheus_manual_configuration,
:track_event :track_event
...@@ -80,6 +81,17 @@ module Gitlab ...@@ -80,6 +81,17 @@ module Gitlab
end end
end end
def create_environment(result)
environment = ::Environment.new(project_id: result[:project].id, name: 'production')
if environment.save
success(result)
else
log_error("Could not create environment for the Self monitoring project. Errors: %{errors}" % { errors: environment.errors.full_messages })
error(_('Could not create environment'))
end
end
def add_prometheus_manual_configuration(result) def add_prometheus_manual_configuration(result)
return success(result) unless prometheus_enabled? return success(result) unless prometheus_enabled?
return success(result) unless prometheus_listen_address.present? return success(result) unless prometheus_listen_address.present?
......
...@@ -93,8 +93,6 @@ module Gitlab ...@@ -93,8 +93,6 @@ module Gitlab
# #
redis.expire(key, EXPIRATION) redis.expire(key, EXPIRATION)
end end
record_metrics(redis.memory("USAGE", key))
end end
# Subsequent read_file calls would need the latest cache. # Subsequent read_file calls would need the latest cache.
...@@ -103,10 +101,6 @@ module Gitlab ...@@ -103,10 +101,6 @@ module Gitlab
clear_memoization(:cacheable_files) clear_memoization(:cacheable_files)
end end
def record_metrics(memory_usage)
self.class.gitlab_redis_diff_caching_memory_usage_bytes.observe({}, memory_usage)
end
def file_paths def file_paths
strong_memoize(:file_paths) do strong_memoize(:file_paths) do
diff_files.collect(&:file_path) diff_files.collect(&:file_path)
......
...@@ -34,6 +34,8 @@ module Gitlab ...@@ -34,6 +34,8 @@ module Gitlab
# cluster, one of [:admin, :project, :group] # cluster, one of [:admin, :project, :group]
# @param options - grafana_url [String] URL pointing # @param options - grafana_url [String] URL pointing
# to a grafana dashboard panel # to a grafana dashboard panel
# @param options - prometheus_alert_id [Integer] ID of
# a PrometheusAlert. For dashboard embeds.
# @return [Hash] # @return [Hash]
def find(project, user, options = {}) def find(project, user, options = {})
service_for(options) service_for(options)
......
...@@ -5379,6 +5379,9 @@ msgstr "" ...@@ -5379,6 +5379,9 @@ msgstr ""
msgid "Could not create Wiki Repository at this time. Please try again later." msgid "Could not create Wiki Repository at this time. Please try again later."
msgstr "" msgstr ""
msgid "Could not create environment"
msgstr ""
msgid "Could not create group" msgid "Could not create group"
msgstr "" msgstr ""
......
...@@ -25,6 +25,6 @@ describe Groups::AvatarsController do ...@@ -25,6 +25,6 @@ describe Groups::AvatarsController do
delete :destroy, params: { group_id: group } delete :destroy, params: { group_id: group }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -33,7 +33,7 @@ describe Groups::BoardsController do ...@@ -33,7 +33,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
list_boards list_boards
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
end end
...@@ -76,7 +76,7 @@ describe Groups::BoardsController do ...@@ -76,7 +76,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
list_boards format: :json list_boards format: :json
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
end end
end end
...@@ -111,7 +111,7 @@ describe Groups::BoardsController do ...@@ -111,7 +111,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
read_board board: board read_board board: board
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
end end
...@@ -148,7 +148,7 @@ describe Groups::BoardsController do ...@@ -148,7 +148,7 @@ describe Groups::BoardsController do
it 'returns a not found 404 response' do it 'returns a not found 404 response' do
read_board board: board, format: :json read_board board: board, format: :json
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
end end
end end
...@@ -160,7 +160,7 @@ describe Groups::BoardsController do ...@@ -160,7 +160,7 @@ describe Groups::BoardsController do
read_board board: another_board read_board board: another_board
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
......
...@@ -142,7 +142,7 @@ describe Groups::ChildrenController do ...@@ -142,7 +142,7 @@ describe Groups::ChildrenController do
get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json get :index, params: { group_id: subgroup.to_param, filter: 'test' }, format: :json
expect(response).to have_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns an array with one element when only one result is matched' do it 'returns an array with one element when only one result is matched' do
...@@ -185,7 +185,7 @@ describe Groups::ChildrenController do ...@@ -185,7 +185,7 @@ describe Groups::ChildrenController do
get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 3 }, format: :json get :index, params: { group_id: group.to_param, filter: 'filter', per_page: 3 }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
it 'includes pagination headers' do it 'includes pagination headers' do
...@@ -316,7 +316,7 @@ describe Groups::ChildrenController do ...@@ -316,7 +316,7 @@ describe Groups::ChildrenController do
it 'correctly calculates the counts' do it 'correctly calculates the counts' do
get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json get :index, params: { group_id: group.to_param, sort: 'id_asc', page: 2 }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -328,7 +328,7 @@ describe Groups::ChildrenController do ...@@ -328,7 +328,7 @@ describe Groups::ChildrenController do
get :index, params: { group_id: group }, format: :json get :index, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -43,7 +43,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -43,7 +43,7 @@ describe Groups::Clusters::ApplicationsController do
expect(ClusterInstallAppWorker).to receive(:perform_async).with(application, anything).once expect(ClusterInstallAppWorker).to receive(:perform_async).with(application, anything).once
expect { subject }.to change { current_application.count } expect { subject }.to change { current_application.count }
expect(response).to have_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
expect(cluster.application_helm).to be_scheduled expect(cluster.application_helm).to be_scheduled
end end
...@@ -54,7 +54,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -54,7 +54,7 @@ describe Groups::Clusters::ApplicationsController do
it 'return 404' do it 'return 404' do
expect { subject }.not_to change { current_application.count } expect { subject }.not_to change { current_application.count }
expect(response).to have_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -62,7 +62,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -62,7 +62,7 @@ describe Groups::Clusters::ApplicationsController do
let(:application) { 'unkwnown-app' } let(:application) { 'unkwnown-app' }
it 'return 404' do it 'return 404' do
is_expected.to have_http_status(:not_found) is_expected.to have_gitlab_http_status(:not_found)
end end
end end
...@@ -72,7 +72,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -72,7 +72,7 @@ describe Groups::Clusters::ApplicationsController do
end end
it 'returns 400' do it 'returns 400' do
is_expected.to have_http_status(:bad_request) is_expected.to have_gitlab_http_status(:bad_request)
end end
end end
end end
...@@ -107,7 +107,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -107,7 +107,7 @@ describe Groups::Clusters::ApplicationsController do
it "schedules an application update" do it "schedules an application update" do
expect(ClusterPatchAppWorker).to receive(:perform_async).with(application.name, anything).once expect(ClusterPatchAppWorker).to receive(:perform_async).with(application.name, anything).once
is_expected.to have_http_status(:no_content) is_expected.to have_gitlab_http_status(:no_content)
expect(cluster.application_cert_manager).to be_scheduled expect(cluster.application_cert_manager).to be_scheduled
end end
...@@ -118,13 +118,13 @@ describe Groups::Clusters::ApplicationsController do ...@@ -118,13 +118,13 @@ describe Groups::Clusters::ApplicationsController do
cluster.destroy! cluster.destroy!
end end
it { is_expected.to have_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
context 'when application is unknown' do context 'when application is unknown' do
let(:application_name) { 'unkwnown-app' } let(:application_name) { 'unkwnown-app' }
it { is_expected.to have_http_status(:not_found) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
context 'when application is already scheduled' do context 'when application is already scheduled' do
...@@ -132,7 +132,7 @@ describe Groups::Clusters::ApplicationsController do ...@@ -132,7 +132,7 @@ describe Groups::Clusters::ApplicationsController do
application.make_scheduled! application.make_scheduled!
end end
it { is_expected.to have_http_status(:bad_request) } it { is_expected.to have_gitlab_http_status(:bad_request) }
end end
end end
......
...@@ -654,7 +654,7 @@ describe Groups::ClustersController do ...@@ -654,7 +654,7 @@ describe Groups::ClustersController do
go(format: :json) go(format: :json)
cluster.reload cluster.reload
expect(response).to have_http_status(:no_content) expect(response).to have_gitlab_http_status(:no_content)
expect(cluster.enabled).to be_falsey expect(cluster.enabled).to be_falsey
expect(cluster.name).to eq('my-new-cluster-name') expect(cluster.name).to eq('my-new-cluster-name')
expect(cluster).not_to be_managed expect(cluster).not_to be_managed
...@@ -674,7 +674,7 @@ describe Groups::ClustersController do ...@@ -674,7 +674,7 @@ describe Groups::ClustersController do
it 'rejects changes' do it 'rejects changes' do
go(format: :json) go(format: :json)
expect(response).to have_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
end end
end end
end end
......
...@@ -100,7 +100,7 @@ describe Groups::GroupLinksController do ...@@ -100,7 +100,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -113,7 +113,7 @@ describe Groups::GroupLinksController do ...@@ -113,7 +113,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -126,7 +126,7 @@ describe Groups::GroupLinksController do ...@@ -126,7 +126,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -168,7 +168,7 @@ describe Groups::GroupLinksController do ...@@ -168,7 +168,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -180,7 +180,7 @@ describe Groups::GroupLinksController do ...@@ -180,7 +180,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -210,7 +210,7 @@ describe Groups::GroupLinksController do ...@@ -210,7 +210,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -222,7 +222,7 @@ describe Groups::GroupLinksController do ...@@ -222,7 +222,7 @@ describe Groups::GroupLinksController do
it 'renders 404' do it 'renders 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -13,7 +13,7 @@ describe Groups::GroupMembersController do ...@@ -13,7 +13,7 @@ describe Groups::GroupMembersController do
it 'renders index with 200 status code' do it 'renders index with 200 status code' do
get :index, params: { group_id: group } get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index) expect(response).to render_template(:index)
end end
...@@ -105,7 +105,7 @@ describe Groups::GroupMembersController do ...@@ -105,7 +105,7 @@ describe Groups::GroupMembersController do
access_level: Gitlab::Access::GUEST access_level: Gitlab::Access::GUEST
} }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
expect(group.users).not_to include group_user expect(group.users).not_to include group_user
end end
end end
...@@ -173,7 +173,7 @@ describe Groups::GroupMembersController do ...@@ -173,7 +173,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do it 'returns 403' do
delete :destroy, params: { group_id: group, id: 42 } delete :destroy, params: { group_id: group, id: 42 }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -186,7 +186,7 @@ describe Groups::GroupMembersController do ...@@ -186,7 +186,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do it 'returns 403' do
delete :destroy, params: { group_id: group, id: member } delete :destroy, params: { group_id: group, id: member }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
expect(group.members).to include member expect(group.members).to include member
end end
end end
...@@ -223,7 +223,7 @@ describe Groups::GroupMembersController do ...@@ -223,7 +223,7 @@ describe Groups::GroupMembersController do
it 'returns 404' do it 'returns 404' do
delete :leave, params: { group_id: group } delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -244,7 +244,7 @@ describe Groups::GroupMembersController do ...@@ -244,7 +244,7 @@ describe Groups::GroupMembersController do
it 'supports json request' do it 'supports json request' do
delete :leave, params: { group_id: group }, format: :json delete :leave, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(json_response['notice']).to eq "You left the \"#{group.name}\" group." expect(json_response['notice']).to eq "You left the \"#{group.name}\" group."
end end
end end
...@@ -257,7 +257,7 @@ describe Groups::GroupMembersController do ...@@ -257,7 +257,7 @@ describe Groups::GroupMembersController do
it 'cannot removes himself from the group' do it 'cannot removes himself from the group' do
delete :leave, params: { group_id: group } delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -304,7 +304,7 @@ describe Groups::GroupMembersController do ...@@ -304,7 +304,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do it 'returns 403' do
post :approve_access_request, params: { group_id: group, id: 42 } post :approve_access_request, params: { group_id: group, id: 42 }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
end end
end end
...@@ -317,7 +317,7 @@ describe Groups::GroupMembersController do ...@@ -317,7 +317,7 @@ describe Groups::GroupMembersController do
it 'returns 403' do it 'returns 403' do
post :approve_access_request, params: { group_id: group, id: member } post :approve_access_request, params: { group_id: group, id: member }
expect(response).to have_gitlab_http_status(403) expect(response).to have_gitlab_http_status(:forbidden)
expect(group.members).not_to include member expect(group.members).not_to include member
end end
end end
...@@ -348,7 +348,7 @@ describe Groups::GroupMembersController do ...@@ -348,7 +348,7 @@ describe Groups::GroupMembersController do
it 'is successful' do it 'is successful' do
get :index, params: { group_id: group } get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -356,7 +356,7 @@ describe Groups::GroupMembersController do ...@@ -356,7 +356,7 @@ describe Groups::GroupMembersController do
it 'is successful' do it 'is successful' do
post :create, params: { group_id: group, users: user, access_level: Gitlab::Access::GUEST } post :create, params: { group_id: group, users: user, access_level: Gitlab::Access::GUEST }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -370,7 +370,7 @@ describe Groups::GroupMembersController do ...@@ -370,7 +370,7 @@ describe Groups::GroupMembersController do
}, },
format: :js format: :js
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -378,7 +378,7 @@ describe Groups::GroupMembersController do ...@@ -378,7 +378,7 @@ describe Groups::GroupMembersController do
it 'is successful' do it 'is successful' do
delete :destroy, params: { group_id: group, id: membership } delete :destroy, params: { group_id: group, id: membership }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -388,7 +388,7 @@ describe Groups::GroupMembersController do ...@@ -388,7 +388,7 @@ describe Groups::GroupMembersController do
post :request_access, params: { group_id: group } post :request_access, params: { group_id: group }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -397,7 +397,7 @@ describe Groups::GroupMembersController do ...@@ -397,7 +397,7 @@ describe Groups::GroupMembersController do
access_request = create(:group_member, :access_request, group: group) access_request = create(:group_member, :access_request, group: group)
post :approve_access_request, params: { group_id: group, id: access_request } post :approve_access_request, params: { group_id: group, id: access_request }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -407,7 +407,7 @@ describe Groups::GroupMembersController do ...@@ -407,7 +407,7 @@ describe Groups::GroupMembersController do
delete :leave, params: { group_id: group } delete :leave, params: { group_id: group }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
...@@ -415,7 +415,7 @@ describe Groups::GroupMembersController do ...@@ -415,7 +415,7 @@ describe Groups::GroupMembersController do
it 'is successful' do it 'is successful' do
post :resend_invite, params: { group_id: group, id: membership } post :resend_invite, params: { group_id: group, id: membership }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
end end
end end
end end
......
...@@ -53,7 +53,7 @@ describe Groups::LabelsController do ...@@ -53,7 +53,7 @@ describe Groups::LabelsController do
post :toggle_subscription, params: { group_id: group.to_param, id: label.to_param } post :toggle_subscription, params: { group_id: group.to_param, id: label.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -42,7 +42,7 @@ describe Groups::MilestonesController do ...@@ -42,7 +42,7 @@ describe Groups::MilestonesController do
get :index, params: { group_id: group.to_param } get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(milestone.title) expect(response.body).to include(milestone.title)
end end
...@@ -74,7 +74,7 @@ describe Groups::MilestonesController do ...@@ -74,7 +74,7 @@ describe Groups::MilestonesController do
get :index, params: { group_id: group.to_param } get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(milestone.title) expect(response.body).to include(milestone.title)
end end
end end
...@@ -84,7 +84,7 @@ describe Groups::MilestonesController do ...@@ -84,7 +84,7 @@ describe Groups::MilestonesController do
it 'does not return milestone' do it 'does not return milestone' do
get :index, params: { group_id: public_group.to_param } get :index, params: { group_id: public_group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).not_to include(private_milestone.title) expect(response.body).not_to include(private_milestone.title)
end end
end end
...@@ -125,7 +125,7 @@ describe Groups::MilestonesController do ...@@ -125,7 +125,7 @@ describe Groups::MilestonesController do
it 'returns the milestone' do it 'returns the milestone' do
get :index, params: { group_id: public_group.to_param } get :index, params: { group_id: public_group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(private_milestone.title) expect(response.body).to include(private_milestone.title)
end end
end end
...@@ -141,7 +141,7 @@ describe Groups::MilestonesController do ...@@ -141,7 +141,7 @@ describe Groups::MilestonesController do
it 'shows subgroup milestones that user has access to' do it 'shows subgroup milestones that user has access to' do
get :index, params: { group_id: group.to_param } get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(group_milestone.title) expect(response.body).to include(group_milestone.title)
expect(response.body).to include(sub_project_milestone.title) expect(response.body).to include(sub_project_milestone.title)
expect(response.body).to include(subgroup_milestone.title) expect(response.body).to include(subgroup_milestone.title)
...@@ -157,7 +157,7 @@ describe Groups::MilestonesController do ...@@ -157,7 +157,7 @@ describe Groups::MilestonesController do
it 'does not show subgroup milestones' do it 'does not show subgroup milestones' do
get :index, params: { group_id: group.to_param } get :index, params: { group_id: group.to_param }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.body).to include(group_milestone.title) expect(response.body).to include(group_milestone.title)
expect(response.body).not_to include(sub_project_milestone.title) expect(response.body).not_to include(sub_project_milestone.title)
expect(response.body).not_to include(subgroup_milestone.title) expect(response.body).not_to include(subgroup_milestone.title)
...@@ -179,7 +179,7 @@ describe Groups::MilestonesController do ...@@ -179,7 +179,7 @@ describe Groups::MilestonesController do
expect(milestones.count).to eq(2) expect(milestones.count).to eq(2)
expect(milestones.first["title"]).to eq("group milestone") expect(milestones.first["title"]).to eq("group milestone")
expect(milestones.second["title"]).to eq("legacy") expect(milestones.second["title"]).to eq("legacy")
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response.content_type).to eq 'application/json' expect(response.content_type).to eq 'application/json'
end end
...@@ -330,7 +330,7 @@ describe Groups::MilestonesController do ...@@ -330,7 +330,7 @@ describe Groups::MilestonesController do
it 'does not redirect' do it 'does not redirect' do
get :index, params: { group_id: group.to_param } get :index, params: { group_id: group.to_param }
expect(response).not_to have_gitlab_http_status(301) expect(response).not_to have_gitlab_http_status(:moved_permanently)
end end
end end
...@@ -349,7 +349,7 @@ describe Groups::MilestonesController do ...@@ -349,7 +349,7 @@ describe Groups::MilestonesController do
it 'does not redirect' do it 'does not redirect' do
get :show, params: { group_id: group.to_param, id: title } get :show, params: { group_id: group.to_param, id: title }
expect(response).not_to have_gitlab_http_status(301) expect(response).not_to have_gitlab_http_status(:moved_permanently)
end end
end end
...@@ -439,7 +439,7 @@ describe Groups::MilestonesController do ...@@ -439,7 +439,7 @@ describe Groups::MilestonesController do
milestone: { title: title } milestone: { title: title }
} }
expect(response).not_to have_gitlab_http_status(404) expect(response).not_to have_gitlab_http_status(:not_found)
end end
it 'does not redirect to the correct casing' do it 'does not redirect to the correct casing' do
...@@ -449,7 +449,7 @@ describe Groups::MilestonesController do ...@@ -449,7 +449,7 @@ describe Groups::MilestonesController do
milestone: { title: title } milestone: { title: title }
} }
expect(response).not_to have_gitlab_http_status(301) expect(response).not_to have_gitlab_http_status(:moved_permanently)
end end
end end
...@@ -463,7 +463,7 @@ describe Groups::MilestonesController do ...@@ -463,7 +463,7 @@ describe Groups::MilestonesController do
milestone: { title: title } milestone: { title: title }
} }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
......
...@@ -21,7 +21,7 @@ describe Groups::RunnersController do ...@@ -21,7 +21,7 @@ describe Groups::RunnersController do
it 'renders show with 200 status code' do it 'renders show with 200 status code' do
get :show, params: { group_id: group, id: runner } get :show, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show) expect(response).to render_template(:show)
end end
end end
...@@ -34,7 +34,7 @@ describe Groups::RunnersController do ...@@ -34,7 +34,7 @@ describe Groups::RunnersController do
it 'renders a 404' do it 'renders a 404' do
get :show, params: { group_id: group, id: runner } get :show, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -48,7 +48,7 @@ describe Groups::RunnersController do ...@@ -48,7 +48,7 @@ describe Groups::RunnersController do
it 'renders show with 200 status code' do it 'renders show with 200 status code' do
get :edit, params: { group_id: group, id: runner } get :edit, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:edit) expect(response).to render_template(:edit)
end end
end end
...@@ -61,7 +61,7 @@ describe Groups::RunnersController do ...@@ -61,7 +61,7 @@ describe Groups::RunnersController do
it 'renders a 404' do it 'renders a 404' do
get :edit, params: { group_id: group, id: runner } get :edit, params: { group_id: group, id: runner }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -79,7 +79,7 @@ describe Groups::RunnersController do ...@@ -79,7 +79,7 @@ describe Groups::RunnersController do
post :update, params: params.merge(runner: { description: new_desc } ) post :update, params: params.merge(runner: { description: new_desc } )
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(runner.reload.description).to eq(new_desc) expect(runner.reload.description).to eq(new_desc)
end end
end end
...@@ -96,7 +96,7 @@ describe Groups::RunnersController do ...@@ -96,7 +96,7 @@ describe Groups::RunnersController do
post :update, params: params.merge(runner: { description: old_desc.swapcase } ) post :update, params: params.merge(runner: { description: old_desc.swapcase } )
end.not_to change { runner.ensure_runner_queue_value } end.not_to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(runner.reload.description).to eq(old_desc) expect(runner.reload.description).to eq(old_desc)
end end
end end
...@@ -111,7 +111,7 @@ describe Groups::RunnersController do ...@@ -111,7 +111,7 @@ describe Groups::RunnersController do
it 'destroys the runner and redirects' do it 'destroys the runner and redirects' do
delete :destroy, params: params delete :destroy, params: params
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(Ci::Runner.find_by(id: runner.id)).to be_nil expect(Ci::Runner.find_by(id: runner.id)).to be_nil
end end
end end
...@@ -124,7 +124,7 @@ describe Groups::RunnersController do ...@@ -124,7 +124,7 @@ describe Groups::RunnersController do
it 'responds 404 and does not destroy the runner' do it 'responds 404 and does not destroy the runner' do
delete :destroy, params: params delete :destroy, params: params
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(Ci::Runner.find_by(id: runner.id)).to be_present expect(Ci::Runner.find_by(id: runner.id)).to be_present
end end
end end
...@@ -143,7 +143,7 @@ describe Groups::RunnersController do ...@@ -143,7 +143,7 @@ describe Groups::RunnersController do
post :resume, params: params post :resume, params: params
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(runner.reload.active).to eq(true) expect(runner.reload.active).to eq(true)
end end
end end
...@@ -160,7 +160,7 @@ describe Groups::RunnersController do ...@@ -160,7 +160,7 @@ describe Groups::RunnersController do
post :resume, params: params post :resume, params: params
end.not_to change { runner.ensure_runner_queue_value } end.not_to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(runner.reload.active).to eq(false) expect(runner.reload.active).to eq(false)
end end
end end
...@@ -179,7 +179,7 @@ describe Groups::RunnersController do ...@@ -179,7 +179,7 @@ describe Groups::RunnersController do
post :pause, params: params post :pause, params: params
end.to change { runner.ensure_runner_queue_value } end.to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(302) expect(response).to have_gitlab_http_status(:found)
expect(runner.reload.active).to eq(false) expect(runner.reload.active).to eq(false)
end end
end end
...@@ -196,7 +196,7 @@ describe Groups::RunnersController do ...@@ -196,7 +196,7 @@ describe Groups::RunnersController do
post :pause, params: params post :pause, params: params
end.not_to change { runner.ensure_runner_queue_value } end.not_to change { runner.ensure_runner_queue_value }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
expect(runner.reload.active).to eq(true) expect(runner.reload.active).to eq(true)
end end
end end
......
...@@ -21,7 +21,7 @@ describe Groups::Settings::CiCdController do ...@@ -21,7 +21,7 @@ describe Groups::Settings::CiCdController do
it 'renders show with 200 status code' do it 'renders show with 200 status code' do
get :show, params: { group_id: group } get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show) expect(response).to render_template(:show)
end end
end end
...@@ -34,7 +34,7 @@ describe Groups::Settings::CiCdController do ...@@ -34,7 +34,7 @@ describe Groups::Settings::CiCdController do
it 'renders a 404' do it 'renders a 404' do
get :show, params: { group_id: group } get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
...@@ -47,7 +47,7 @@ describe Groups::Settings::CiCdController do ...@@ -47,7 +47,7 @@ describe Groups::Settings::CiCdController do
it 'renders show with 200 status code' do it 'renders show with 200 status code' do
get :show, params: { group_id: group } get :show, params: { group_id: group }
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
...@@ -79,7 +79,7 @@ describe Groups::Settings::CiCdController do ...@@ -79,7 +79,7 @@ describe Groups::Settings::CiCdController do
it 'renders a 404' do it 'renders a 404' do
subject subject
expect(response).to have_gitlab_http_status(404) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
end end
...@@ -99,7 +99,7 @@ describe Groups::Settings::CiCdController do ...@@ -99,7 +99,7 @@ describe Groups::Settings::CiCdController do
group.add_maintainer(user) group.add_maintainer(user)
end end
it { is_expected.to have_gitlab_http_status(404) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
context 'when user has enough privileges' do context 'when user has enough privileges' do
...@@ -170,7 +170,7 @@ describe Groups::Settings::CiCdController do ...@@ -170,7 +170,7 @@ describe Groups::Settings::CiCdController do
group.add_owner(user) group.add_owner(user)
end end
it { is_expected.to have_gitlab_http_status(404) } it { is_expected.to have_gitlab_http_status(:not_found) }
end end
context 'when user is an admin' do context 'when user is an admin' do
......
...@@ -50,7 +50,7 @@ describe Groups::VariablesController do ...@@ -50,7 +50,7 @@ describe Groups::VariablesController do
it 'is successful' do it 'is successful' do
get :show, params: { group_id: group }, format: :json get :show, params: { group_id: group }, format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
...@@ -66,7 +66,7 @@ describe Groups::VariablesController do ...@@ -66,7 +66,7 @@ describe Groups::VariablesController do
}, },
format: :json format: :json
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(:ok)
end end
end end
end end
......
...@@ -1084,12 +1084,6 @@ describe Projects::IssuesController do ...@@ -1084,12 +1084,6 @@ describe Projects::IssuesController do
it 'creates a sentry issue' do it 'creates a sentry issue' do
expect { subject }.to change(SentryIssue, :count) expect { subject }.to change(SentryIssue, :count)
end end
it 'with existing issue it will not create an issue' do
post_new_issue(sentry_issue_attributes: { sentry_issue_identifier: 1234567 })
expect { subject }.not_to change(Issue, :count)
end
end end
end end
......
...@@ -125,6 +125,25 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do ...@@ -125,6 +125,25 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
expect(application_setting.self_monitoring_project_id).to eq(project.id) expect(application_setting.self_monitoring_project_id).to eq(project.id)
end end
it 'creates an environment for the project' do
expect(project.default_environment.name).to eq('production')
end
context 'when the environment creation fails' do
let(:environment) { build(:environment, name: 'production') }
it 'returns error' do
allow(Environment).to receive(:new).and_return(environment)
allow(environment).to receive(:save).and_return(false)
expect(result).to eq(
status: :error,
message: 'Could not create environment',
last_step: :create_environment
)
end
end
it 'returns error when saving project ID fails' do it 'returns error when saving project ID fails' do
allow(application_setting).to receive(:update).and_call_original allow(application_setting).to receive(:update).and_call_original
allow(application_setting).to receive(:update) allow(application_setting).to receive(:update)
......
...@@ -101,13 +101,6 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do ...@@ -101,13 +101,6 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
let(:paths) { merge_request.diffs.raw_diff_files.select(&:text?).map(&:file_path) } let(:paths) { merge_request.diffs.raw_diff_files.select(&:text?).map(&:file_path) }
end end
it 'updates memory usage metrics' do
expect(described_class.gitlab_redis_diff_caching_memory_usage_bytes)
.to receive(:observe).and_call_original
cache.send(:write_to_redis_hash, diff_hash)
end
context 'different diff_collections for the same diffable' do context 'different diff_collections for the same diffable' do
before do before do
cache.write_if_empty cache.write_if_empty
......
...@@ -17,13 +17,13 @@ module DnsHelpers ...@@ -17,13 +17,13 @@ module DnsHelpers
end end
def stub_invalid_dns! def stub_invalid_dns!
allow(Addrinfo).to receive(:getaddrinfo).with(/foobar\.\w|(\d{1,3}\.){4,}\d{1,3}/i, anything, nil, :STREAM) do allow(Addrinfo).to receive(:getaddrinfo).with(/\Afoobar\.\w|(\d{1,3}\.){4,}\d{1,3}\z/i, anything, nil, :STREAM) do
raise SocketError.new("getaddrinfo: Name or service not known") raise SocketError.new("getaddrinfo: Name or service not known")
end end
end end
def permit_local_dns! def permit_local_dns!
local_addresses = /(127|10)\.0\.0\.\d{1,3}|(192\.168|172\.16)\.\d{1,3}\.\d{1,3}|0\.0\.0\.0|localhost/i local_addresses = /\A(127|10)\.0\.0\.\d{1,3}|(192\.168|172\.16)\.\d{1,3}\.\d{1,3}|0\.0\.0\.0|localhost\z/i
allow(Addrinfo).to receive(:getaddrinfo).with(local_addresses, anything, nil, :STREAM).and_call_original allow(Addrinfo).to receive(:getaddrinfo).with(local_addresses, anything, nil, :STREAM).and_call_original
allow(Addrinfo).to receive(:getaddrinfo).with(local_addresses, anything, nil, :STREAM, anything, anything).and_call_original allow(Addrinfo).to receive(:getaddrinfo).with(local_addresses, anything, nil, :STREAM, anything, anything).and_call_original
end end
......
...@@ -318,5 +318,169 @@ RSpec.shared_context 'ProjectPolicyTable context' do ...@@ -318,5 +318,169 @@ RSpec.shared_context 'ProjectPolicyTable context' do
:private | :non_member | 0 :private | :non_member | 0
:private | :anonymous | 0 :private | :anonymous | 0
end end
# :snippet_level, :project_level, :feature_access_level, :membership, :expected_count
def permission_table_for_project_snippet_access
:public | :public | :enabled | :admin | 1
:public | :public | :enabled | :reporter | 1
:public | :public | :enabled | :guest | 1
:public | :public | :enabled | :non_member | 1
:public | :public | :enabled | :anonymous | 1
:public | :public | :private | :admin | 1
:public | :public | :private | :reporter | 1
:public | :public | :private | :guest | 1
:public | :public | :private | :non_member | 0
:public | :public | :private | :anonymous | 0
:public | :public | :disabled | :admin | 1
:public | :public | :disabled | :reporter | 0
:public | :public | :disabled | :guest | 0
:public | :public | :disabled | :non_member | 0
:public | :public | :disabled | :anonymous | 0
:public | :internal | :enabled | :admin | 1
:public | :internal | :enabled | :reporter | 1
:public | :internal | :enabled | :guest | 1
:public | :internal | :enabled | :non_member | 1
:public | :internal | :enabled | :anonymous | 0
:public | :internal | :private | :admin | 1
:public | :internal | :private | :reporter | 1
:public | :internal | :private | :guest | 1
:public | :internal | :private | :non_member | 0
:public | :internal | :private | :anonymous | 0
:public | :internal | :disabled | :admin | 1
:public | :internal | :disabled | :reporter | 0
:public | :internal | :disabled | :guest | 0
:public | :internal | :disabled | :non_member | 0
:public | :internal | :disabled | :anonymous | 0
:public | :private | :private | :admin | 1
:public | :private | :private | :reporter | 1
:public | :private | :private | :guest | 1
:public | :private | :private | :non_member | 0
:public | :private | :private | :anonymous | 0
:public | :private | :disabled | :reporter | 0
:public | :private | :disabled | :guest | 0
:public | :private | :disabled | :non_member | 0
:public | :private | :disabled | :anonymous | 0
:internal | :public | :enabled | :admin | 1
:internal | :public | :enabled | :reporter | 1
:internal | :public | :enabled | :guest | 1
:internal | :public | :enabled | :non_member | 1
:internal | :public | :enabled | :anonymous | 0
:internal | :public | :private | :admin | 1
:internal | :public | :private | :reporter | 1
:internal | :public | :private | :guest | 1
:internal | :public | :private | :non_member | 0
:internal | :public | :private | :anonymous | 0
:internal | :public | :disabled | :admin | 1
:internal | :public | :disabled | :reporter | 0
:internal | :public | :disabled | :guest | 0
:internal | :public | :disabled | :non_member | 0
:internal | :public | :disabled | :anonymous | 0
:internal | :internal | :enabled | :admin | 1
:internal | :internal | :enabled | :reporter | 1
:internal | :internal | :enabled | :guest | 1
:internal | :internal | :enabled | :non_member | 1
:internal | :internal | :enabled | :anonymous | 0
:internal | :internal | :private | :admin | 1
:internal | :internal | :private | :reporter | 1
:internal | :internal | :private | :guest | 1
:internal | :internal | :private | :non_member | 0
:internal | :internal | :private | :anonymous | 0
:internal | :internal | :disabled | :admin | 1
:internal | :internal | :disabled | :reporter | 0
:internal | :internal | :disabled | :guest | 0
:internal | :internal | :disabled | :non_member | 0
:internal | :internal | :disabled | :anonymous | 0
:internal | :private | :private | :admin | 1
:internal | :private | :private | :reporter | 1
:internal | :private | :private | :guest | 1
:internal | :private | :private | :non_member | 0
:internal | :private | :private | :anonymous | 0
:internal | :private | :disabled | :admin | 1
:internal | :private | :disabled | :reporter | 0
:internal | :private | :disabled | :guest | 0
:internal | :private | :disabled | :non_member | 0
:internal | :private | :disabled | :anonymous | 0
:private | :public | :enabled | :admin | 1
:private | :public | :enabled | :reporter | 1
:private | :public | :enabled | :guest | 1
:private | :public | :enabled | :non_member | 0
:private | :public | :enabled | :anonymous | 0
:private | :public | :private | :admin | 1
:private | :public | :private | :reporter | 1
:private | :public | :private | :guest | 1
:private | :public | :private | :non_member | 0
:private | :public | :private | :anonymous | 0
:private | :public | :disabled | :admin | 1
:private | :public | :disabled | :reporter | 0
:private | :public | :disabled | :guest | 0
:private | :public | :disabled | :non_member | 0
:private | :public | :disabled | :anonymous | 0
:private | :internal | :enabled | :admin | 1
:private | :internal | :enabled | :reporter | 1
:private | :internal | :enabled | :guest | 1
:private | :internal | :enabled | :non_member | 0
:private | :internal | :enabled | :anonymous | 0
:private | :internal | :private | :admin | 1
:private | :internal | :private | :reporter | 1
:private | :internal | :private | :guest | 1
:private | :internal | :private | :non_member | 0
:private | :internal | :private | :anonymous | 0
:private | :internal | :disabled | :admin | 1
:private | :internal | :disabled | :reporter | 0
:private | :internal | :disabled | :guest | 0
:private | :internal | :disabled | :non_member | 0
:private | :internal | :disabled | :anonymous | 0
:private | :private | :private | :admin | 1
:private | :private | :private | :reporter | 1
:private | :private | :private | :guest | 1
:private | :private | :private | :non_member | 0
:private | :private | :private | :anonymous | 0
:private | :private | :disabled | :admin | 1
:private | :private | :disabled | :reporter | 0
:private | :private | :disabled | :guest | 0
:private | :private | :disabled | :non_member | 0
:private | :private | :disabled | :anonymous | 0
end
# :snippet_level, :membership, :expected_count
def permission_table_for_personal_snippet_access
:public | :admin | 1
:public | :author | 1
:public | :non_member | 1
:public | :anonymous | 1
:internal | :admin | 1
:internal | :author | 1
:internal | :non_member | 1
:internal | :anonymous | 0
:private | :admin | 1
:private | :author | 1
:private | :non_member | 0
:private | :anonymous | 0
end
# rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/AbcSize
end end
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