Commit 8bdfa060 authored by David O'Regan's avatar David O'Regan Committed by Peter Leitzen

[Feature flag] Enable Incident Management On-call Schedules [RUN ALL RSPEC] [RUN AS-IF-FOSS]

parent e79dffe7
---
title: Incident Management On-call Schedules
merge_request: 56263
author:
type: added
---
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
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
module Gitlab module Gitlab
module IncidentManagement module IncidentManagement
def self.oncall_schedules_available?(project) def self.oncall_schedules_available?(project)
::Feature.enabled?(:oncall_schedules_mvc, project) &&
project.feature_available?(:oncall_schedules) project.feature_available?(:oncall_schedules)
end end
end end
......
...@@ -55,18 +55,6 @@ RSpec.describe Projects::IncidentManagement::OncallSchedulesController do ...@@ -55,18 +55,6 @@ RSpec.describe Projects::IncidentManagement::OncallSchedulesController do
end end
end end
context 'with feature flag off' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it 'responds with 404' do
request
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'with unavailable feature' do context 'with unavailable feature' do
before do before do
stub_licensed_features(oncall_schedules: false) stub_licensed_features(oncall_schedules: false)
......
...@@ -39,14 +39,6 @@ RSpec.describe IncidentManagement::OncallRotationsFinder do ...@@ -39,14 +39,6 @@ RSpec.describe IncidentManagement::OncallRotationsFinder do
end end
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::OncallRotation.none) }
end
context 'schedule is nil' do context 'schedule is nil' do
let(:oncall_schedule) { nil } let(:oncall_schedule) { nil }
......
...@@ -34,14 +34,6 @@ RSpec.describe IncidentManagement::OncallSchedulesFinder do ...@@ -34,14 +34,6 @@ RSpec.describe IncidentManagement::OncallSchedulesFinder do
is_expected.to contain_exactly(oncall_schedule) is_expected.to contain_exactly(oncall_schedule)
end end
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
......
...@@ -10,19 +10,10 @@ RSpec.describe Gitlab::IncidentManagement do ...@@ -10,19 +10,10 @@ RSpec.describe Gitlab::IncidentManagement do
before do before do
stub_licensed_features(oncall_schedules: true) stub_licensed_features(oncall_schedules: true)
stub_feature_flags(oncall_schedules_mvc: project)
end end
it { is_expected.to be_truthy } it { is_expected.to be_truthy }
context 'when feature flag is disabled' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it { is_expected.to be_falsey }
end
context 'when there is no license' do context 'when there is no license' do
before do before do
stub_licensed_features(oncall_schedules: false) stub_licensed_features(oncall_schedules: false)
......
...@@ -11,7 +11,6 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do ...@@ -11,7 +11,6 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
subject(:policy) { described_class.new(user, oncall_rotation) } subject(:policy) { described_class.new(user, oncall_rotation) }
before do before do
stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true) stub_licensed_features(oncall_schedules: true)
end end
......
...@@ -10,7 +10,6 @@ RSpec.describe IncidentManagement::OncallSchedulePolicy do ...@@ -10,7 +10,6 @@ RSpec.describe IncidentManagement::OncallSchedulePolicy do
subject(:policy) { described_class.new(user, oncall_schedule) } subject(:policy) { described_class.new(user, oncall_schedule) }
before do before do
stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true) stub_licensed_features(oncall_schedules: true)
end end
......
...@@ -10,7 +10,6 @@ RSpec.describe IncidentManagement::OncallShiftPolicy do ...@@ -10,7 +10,6 @@ RSpec.describe IncidentManagement::OncallShiftPolicy do
subject(:policy) { described_class.new(user, shift) } subject(:policy) { described_class.new(user, shift) }
before do before do
stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true) stub_licensed_features(oncall_schedules: true)
end end
......
...@@ -1547,14 +1547,6 @@ RSpec.describe ProjectPolicy do ...@@ -1547,14 +1547,6 @@ RSpec.describe ProjectPolicy do
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) } it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
context 'with disabled feature flag' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it { is_expected.to(be_disallowed(policy)) }
end
context 'with unavailable license' do context 'with unavailable license' do
before do before do
stub_licensed_features(oncall_schedules: false) stub_licensed_features(oncall_schedules: false)
...@@ -1588,14 +1580,6 @@ RSpec.describe ProjectPolicy do ...@@ -1588,14 +1580,6 @@ RSpec.describe ProjectPolicy do
it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) } it { is_expected.to(allowed ? be_allowed(policy) : be_disallowed(policy)) }
context 'with disabled feature flag' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it { is_expected.to(be_disallowed(policy)) }
end
context 'with unavailable license' do context 'with unavailable license' do
before do before do
stub_licensed_features(oncall_schedules: false) stub_licensed_features(oncall_schedules: false)
......
...@@ -62,14 +62,6 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do ...@@ -62,14 +62,6 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
it_behaves_like 'error response', 'Your license does not support on-call rotations' it_behaves_like 'error response', 'Your license does not support on-call rotations'
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 rotations'
end
context 'when an on-call rotation already exists' do context 'when an on-call rotation already exists' do
let!(:oncall_rotation) { create(:incident_management_oncall_rotation, schedule: schedule, name: 'On-call rotation') } let!(:oncall_rotation) { create(:incident_management_oncall_rotation, schedule: schedule, name: 'On-call rotation') }
......
...@@ -48,14 +48,6 @@ RSpec.describe IncidentManagement::OncallRotations::DestroyService do ...@@ -48,14 +48,6 @@ RSpec.describe IncidentManagement::OncallRotations::DestroyService do
it_behaves_like 'error response', 'Your license does not support on-call rotations' it_behaves_like 'error response', 'Your license does not support on-call rotations'
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 rotations'
end
context 'when an error occurs during removal' do context 'when an error occurs during removal' do
before do before do
allow(oncall_rotation).to receive(:destroy).and_return(false) allow(oncall_rotation).to receive(:destroy).and_return(false)
......
...@@ -46,14 +46,6 @@ RSpec.describe IncidentManagement::OncallSchedules::CreateService do ...@@ -46,14 +46,6 @@ 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') }
......
...@@ -47,14 +47,6 @@ RSpec.describe IncidentManagement::OncallSchedules::DestroyService do ...@@ -47,14 +47,6 @@ RSpec.describe IncidentManagement::OncallSchedules::DestroyService 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 error occurs during removal' do context 'when an error occurs during removal' do
before do before do
allow(oncall_schedule).to receive(:destroy).and_return(false) allow(oncall_schedule).to receive(:destroy).and_return(false)
......
...@@ -47,14 +47,6 @@ RSpec.describe IncidentManagement::OncallSchedules::UpdateService do ...@@ -47,14 +47,6 @@ RSpec.describe IncidentManagement::OncallSchedules::UpdateService 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 witht the same name already exists' do context 'when an on-call schedule witht the same name already exists' do
before do before do
create(:incident_management_oncall_schedule, project: project, name: params[:name]) create(:incident_management_oncall_schedule, project: project, name: params[:name])
......
...@@ -72,14 +72,6 @@ RSpec.describe ::IncidentManagement::OncallShifts::ReadService do ...@@ -72,14 +72,6 @@ RSpec.describe ::IncidentManagement::OncallShifts::ReadService do
it_behaves_like 'error response', 'Your license does not support on-call rotations' it_behaves_like 'error response', 'Your license does not support on-call rotations'
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 rotations'
end
context 'when the start time is after the end time' do context 'when the start time is after the end time' do
let(:end_time) { 1.day.before(start_time) } let(:end_time) { 1.day.before(start_time) }
......
...@@ -120,16 +120,6 @@ RSpec.describe IncidentManagement::OncallRotations::PersistShiftsJob do ...@@ -120,16 +120,6 @@ RSpec.describe IncidentManagement::OncallRotations::PersistShiftsJob do
travel_to(existing_shift.ends_at + (3 * rotation.shift_cycle_duration)) { example.run } travel_to(existing_shift.ends_at + (3 * rotation.shift_cycle_duration)) { example.run }
end end
context 'when feature flag is not enabled' do
before do
stub_feature_flags(oncall_schedules_mvc: false)
end
it 'does not create shifts' do
expect { perform }.not_to change { IncidentManagement::OncallShift.count }
end
end
it 'creates multiple shifts' do it 'creates multiple shifts' do
expect { perform }.to change { rotation.shifts.count }.by(3) expect { perform }.to change { rotation.shifts.count }.by(3)
......
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