Commit 01f0b444 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'remove-ff-environments_dashboard' into 'master'

Remove FF environments_dashboard

See merge request gitlab-org/gitlab!30598
parents 4edbaf16 2422bf10
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class OperationsController < ApplicationController class OperationsController < ApplicationController
before_action :authorize_read_operations_dashboard! before_action :authorize_read_operations_dashboard!
before_action :environments_dashboard_feature_flag, only: %i[environments environments_list]
respond_to :json, only: [:list] respond_to :json, only: [:list]
...@@ -56,10 +55,6 @@ class OperationsController < ApplicationController ...@@ -56,10 +55,6 @@ class OperationsController < ApplicationController
render_404 unless can?(current_user, :read_operations_dashboard) render_404 unless can?(current_user, :read_operations_dashboard)
end end
def environments_dashboard_feature_flag
render_404 unless Feature.enabled?(:environments_dashboard, current_user, default_enabled: true)
end
def load_projects def load_projects
Dashboard::Operations::ListService.new(current_user).execute Dashboard::Operations::ListService.new(current_user).execute
end end
......
...@@ -45,7 +45,7 @@ module EE ...@@ -45,7 +45,7 @@ module EE
def get_dashboard_nav_links def get_dashboard_nav_links
super.tap do |links| super.tap do |links|
if can?(current_user, :read_operations_dashboard) if can?(current_user, :read_operations_dashboard)
links << :environments if ::Feature.enabled?(:environments_dashboard, current_user, default_enabled: true) links << :environments
links << :operations links << :operations
end end
......
...@@ -36,15 +36,6 @@ describe OperationsController do ...@@ -36,15 +36,6 @@ describe OperationsController do
expect(response).to render_template(:index) expect(response).to render_template(:index)
end end
it 'renders regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
get :index
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
context 'with an anonymous user' do context 'with an anonymous user' do
before do before do
sign_out(user) sign_out(user)
...@@ -68,24 +59,6 @@ describe OperationsController do ...@@ -68,24 +59,6 @@ describe OperationsController do
expect(response).to render_template(:environments) expect(response).to render_template(:environments)
end end
it 'returns a 404 when the feature is disabled' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
get :environments
expect(response).to have_gitlab_http_status(:not_found)
end
it 'renders the view when the feature is disabled for a different user' do
other_user = create(:user)
stub_feature_flags(environments_dashboard: { enabled: false, thing: other_user })
get :environments
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:environments)
end
context 'with an anonymous user' do context 'with an anonymous user' do
before do before do
sign_out(user) sign_out(user)
...@@ -183,9 +156,7 @@ describe OperationsController do ...@@ -183,9 +156,7 @@ describe OperationsController do
expect(json_response['projects'].size).to eq(8) expect(json_response['projects'].size).to eq(8)
end end
it 'returns a list of added projects regardless of the environments_dashboard feature flag' do it 'returns a list of added projects' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
get :list get :list
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
...@@ -282,30 +253,6 @@ describe OperationsController do ...@@ -282,30 +253,6 @@ describe OperationsController do
user.update!(ops_dashboard_projects: [project]) user.update!(ops_dashboard_projects: [project])
end end
it 'returns a 404 when the feature is disabled' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
environment = create(:environment, project: project)
ci_build = create(:ci_build, project: project)
create(:deployment, :success, project: project, environment: environment, deployable: ci_build)
get :environments_list
expect(response).to have_gitlab_http_status(:not_found)
end
it 'returns a project when the feature is disabled for another user' do
other_user = create(:user)
stub_feature_flags(environments_dashboard: { enabled: false, thing: other_user })
environment = create(:environment, project: project)
ci_build = create(:ci_build, project: project)
create(:deployment, :success, project: project, environment: environment, deployable: ci_build)
get :environments_list
expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('dashboard/operations/environments_list', dir: 'ee')
end
it 'returns a project without an environment' do it 'returns a project without an environment' do
get :environments_list get :environments_list
...@@ -692,16 +639,6 @@ describe OperationsController do ...@@ -692,16 +639,6 @@ describe OperationsController do
expect(user.ops_dashboard_projects).to contain_exactly(project_a, project_b) expect(user.ops_dashboard_projects).to contain_exactly(project_a, project_b)
end end
it 'adds projects to the dashboard regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
post :create, params: { project_ids: [project_a.id, project_b.id.to_s] }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to match_schema('dashboard/operations/add', dir: 'ee')
expect(json_response['added']).to contain_exactly(project_a.id, project_b.id)
end
it 'cannot add a project twice' do it 'cannot add a project twice' do
post :create, params: { project_ids: [project_a.id, project_a.id] } post :create, params: { project_ids: [project_a.id, project_a.id] }
...@@ -782,16 +719,6 @@ describe OperationsController do ...@@ -782,16 +719,6 @@ describe OperationsController do
user.reload user.reload
expect(user.ops_dashboard_projects).to eq([]) expect(user.ops_dashboard_projects).to eq([])
end end
it 'removes a project regardless of the environments_dashboard feature flag' do
stub_feature_flags(environments_dashboard: { enabled: false, thing: user })
delete :destroy, params: { project_id: project.id }
expect(response).to have_gitlab_http_status(:ok)
user.reload
expect(user.ops_dashboard_projects).to eq([])
end
end end
context 'without projects' do context 'without projects' do
......
...@@ -11,7 +11,6 @@ describe 'Operations dropdown navbar EE' do ...@@ -11,7 +11,6 @@ describe 'Operations dropdown navbar EE' do
sign_in(user) sign_in(user)
stub_licensed_features(operations_dashboard: true) stub_licensed_features(operations_dashboard: true)
stub_feature_flags(environments_dashboard: true)
visit project_issues_path(project) visit project_issues_path(project)
end end
......
...@@ -67,34 +67,18 @@ describe DashboardHelper, type: :helper do ...@@ -67,34 +67,18 @@ describe DashboardHelper, type: :helper do
end end
describe 'environments dashboard link' do describe 'environments dashboard link' do
context 'when the feature is enabled' do context 'and the feature is available on the license' do
before do context 'and the user is authenticated' do
stub_feature_flags(environments_dashboard: true) before do
end stub_user_permissions_for(:operations, true)
context 'and the feature is available on the license' do
context 'and the user is authenticated' do
before do
stub_user_permissions_for(:operations, true)
end
it 'is included in the nav' do
expect(helper.dashboard_nav_links).to include(:environments)
end
end end
context 'and the user is not authenticated' do it 'is included in the nav' do
before do expect(helper.dashboard_nav_links).to include(:environments)
stub_user_permissions_for(:operations, false)
end
it 'is not included in the nav' do
expect(helper.dashboard_nav_links).not_to include(:environments)
end
end end
end end
context 'and the feature is not available on the license' do context 'and the user is not authenticated' do
before do before do
stub_user_permissions_for(:operations, false) stub_user_permissions_for(:operations, false)
end end
...@@ -105,9 +89,8 @@ describe DashboardHelper, type: :helper do ...@@ -105,9 +89,8 @@ describe DashboardHelper, type: :helper do
end end
end end
context 'when the feature is not enabled' do context 'and the feature is not available on the license' do
before do before do
stub_feature_flags(environments_dashboard: false)
stub_user_permissions_for(:operations, false) stub_user_permissions_for(:operations, false)
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