Commit 03bf81f2 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'fix_multiple_instance_clusters' into 'master'

Add missing EE prepend for clusterable actions

Closes gitlab-ce#63366

See merge request gitlab-org/gitlab-ee!14270
parents 9e9b48ad 7352ff77
...@@ -12,3 +12,5 @@ module ClusterableActions ...@@ -12,3 +12,5 @@ module ClusterableActions
!subject.clusters.empty? !subject.clusters.empty?
end end
end end
ClusterableActions.prepend(EE::ClusterableActions)
...@@ -124,5 +124,3 @@ module EE ...@@ -124,5 +124,3 @@ module EE
end end
end end
end end
EE::GroupPolicy.include(EE::ClusterableActions)
...@@ -264,5 +264,3 @@ module EE ...@@ -264,5 +264,3 @@ module EE
end end
end end
end end
EE::ProjectPolicy.include(EE::ClusterableActions)
---
title: Fix to allow adding multiple instance-level clusters
merge_request: 14270
author:
type: fixed
# frozen_string_literal: true
require 'spec_helper'
describe Clusters::InstancePolicy do
let(:user) { create(:admin) }
let(:policy) { described_class.new(user, Clusters::Instance.new) }
describe 'rules' do
context 'multiple clusters allowed' do
before do
stub_feature_flags(multiple_clusters: true)
end
context 'no existing instance level cluster' do
it { expect(policy).to be_allowed :add_cluster }
end
context 'with an existing instance level cluster' do
before do
create(:cluster, :instance)
end
it { expect(policy).to be_allowed :add_cluster }
end
end
context 'multiple clusters disallowed' do
before do
stub_feature_flags(multiple_clusters: false)
end
context 'no existing instance level cluster' do
it { expect(policy).to be_allowed :add_cluster }
end
context 'with an existing instance level cluster' do
before do
create(:cluster, :instance)
end
it { expect(policy).to be_disallowed :add_cluster }
end
end
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