Commit b7cf298e authored by Vitali Tatarintev's avatar Vitali Tatarintev

Hide on-call schedules behind a feature flag

Add an `oncall_schedules_ff` feature flag
parent d5539749
...@@ -19,7 +19,8 @@ module IncidentManagement ...@@ -19,7 +19,8 @@ module IncidentManagement
attr_reader :current_user, :project, :params attr_reader :current_user, :project, :params
def available? def available?
project.feature_available?(:oncall_schedules) Feature.enabled?(:oncall_schedules_mvc, project) &&
project.feature_available?(:oncall_schedules)
end end
def allowed? def allowed?
......
...@@ -31,7 +31,8 @@ module IncidentManagement ...@@ -31,7 +31,8 @@ module IncidentManagement
end end
def available? def available?
project.feature_available?(:oncall_schedules) Feature.enabled?(:oncall_schedules_mvc, project) &&
project.feature_available?(:oncall_schedules)
end end
def error(message) def error(message)
......
---
name: oncall_schedules_mvc
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47407
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/283914
milestone: '13.7'
type: development
group: group::monitor
default_enabled: false
...@@ -24,6 +24,14 @@ RSpec.describe IncidentManagement::OncallSchedulesFinder do ...@@ -24,6 +24,14 @@ RSpec.describe IncidentManagement::OncallSchedulesFinder do
it 'returns project on-call schedules' do it 'returns project on-call schedules' do
is_expected.to contain_exactly(oncall_schedule) is_expected.to contain_exactly(oncall_schedule)
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it { is_expected.to eq(IncidentManagement::OncallSchedule.none) }
end
end end
context 'when user has no permissions' do context 'when user has no permissions' do
......
...@@ -46,6 +46,14 @@ RSpec.describe IncidentManagement::OncallSchedules::CreateService do ...@@ -46,6 +46,14 @@ RSpec.describe IncidentManagement::OncallSchedules::CreateService do
it_behaves_like 'error response', 'Your license does not support on-call schedules' it_behaves_like 'error response', 'Your license does not support on-call schedules'
end end
context 'when feature flag is disabled' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it_behaves_like 'error response', 'Your license does not support on-call schedules'
end
context 'when an on-call schedule already exists' do context 'when an on-call schedule already exists' do
let!(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project, name: 'On-call schedule') } let!(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project, name: 'On-call schedule') }
......
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