Commit 675bfd50 authored by Mayra Cabrera's avatar Mayra Cabrera Committed by Thong Kuah

Adds feature flag for Group Clusters

As the frontend is still in progress and other related backend is still
in prgress we need a feature flag to turn off Group Clusters.
parent a90320f7
......@@ -3,6 +3,7 @@
class Groups::ClustersController < Clusters::ClustersController
include ControllerWithCrossProjectAccessCheck
prepend_before_action :check_group_clusters_feature_flag!
prepend_before_action :group
requires_cross_project_access
......@@ -17,4 +18,8 @@ class Groups::ClustersController < Clusters::ClustersController
def group
@group ||= find_routable!(Group, params[:group_id] || params[:id])
end
def check_group_clusters_feature_flag!
render_404 unless Feature.enabled?(:group_clusters)
end
end
......@@ -140,7 +140,7 @@ module GroupsHelper
can?(current_user, "read_group_#{resource}".to_sym, @group)
end
if can?(current_user, :read_cluster, @group)
if can?(current_user, :read_cluster, @group) && Feature.enabled?(:group_clusters)
links << :kubernetes
end
......
......@@ -20,6 +20,23 @@ describe Groups::ClustersController do
get :index, params.reverse_merge(group_id: group)
end
context 'when feature flag is not enabled' do
before do
stub_feature_flags(group_clusters: false)
end
it 'renders 404' do
go
expect(response).to have_gitlab_http_status(404)
end
end
context 'when feature flag is enabled' do
before do
stub_feature_flags(group_clusters: true)
end
describe 'functionality' do
context 'when group has one or more clusters' do
let(:group) { create(:group) }
......@@ -62,6 +79,7 @@ describe Groups::ClustersController do
end
end
end
end
describe 'security' do
let(:cluster) { create(:cluster, :provided_by_gcp, cluster_type: :group_type, groups: [group]) }
......
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