Commit 9c471988 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'oncall_schedule_feature_flag_removal' into 'master'

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

See merge request gitlab-org/gitlab!56263
parents 189bf0ed 8bdfa060
---
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,8 +3,7 @@
module Gitlab
module IncidentManagement
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
......@@ -55,18 +55,6 @@ RSpec.describe Projects::IncidentManagement::OncallSchedulesController do
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
before do
stub_licensed_features(oncall_schedules: false)
......
......@@ -39,14 +39,6 @@ RSpec.describe IncidentManagement::OncallRotationsFinder do
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
let(:oncall_schedule) { nil }
......
......@@ -34,14 +34,6 @@ RSpec.describe IncidentManagement::OncallSchedulesFinder do
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
context 'when user has no permissions' do
......
......@@ -10,19 +10,10 @@ RSpec.describe Gitlab::IncidentManagement do
before do
stub_licensed_features(oncall_schedules: true)
stub_feature_flags(oncall_schedules_mvc: project)
end
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
before do
stub_licensed_features(oncall_schedules: false)
......
......@@ -11,7 +11,6 @@ RSpec.describe IncidentManagement::OncallRotationPolicy do
subject(:policy) { described_class.new(user, oncall_rotation) }
before do
stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true)
end
......
......@@ -10,7 +10,6 @@ RSpec.describe IncidentManagement::OncallSchedulePolicy do
subject(:policy) { described_class.new(user, oncall_schedule) }
before do
stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true)
end
......
......@@ -10,7 +10,6 @@ RSpec.describe IncidentManagement::OncallShiftPolicy do
subject(:policy) { described_class.new(user, shift) }
before do
stub_feature_flags(oncall_schedules_mvc: project)
stub_licensed_features(oncall_schedules: true)
end
......
......@@ -1547,14 +1547,6 @@ RSpec.describe ProjectPolicy do
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
before do
stub_licensed_features(oncall_schedules: false)
......@@ -1588,14 +1580,6 @@ RSpec.describe ProjectPolicy do
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
before do
stub_licensed_features(oncall_schedules: false)
......
......@@ -62,14 +62,6 @@ RSpec.describe IncidentManagement::OncallRotations::CreateService do
it_behaves_like 'error response', 'Your license does not support on-call rotations'
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
let!(:oncall_rotation) { create(:incident_management_oncall_rotation, schedule: schedule, name: 'On-call rotation') }
......
......@@ -48,14 +48,6 @@ RSpec.describe IncidentManagement::OncallRotations::DestroyService do
it_behaves_like 'error response', 'Your license does not support on-call rotations'
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
before do
allow(oncall_rotation).to receive(:destroy).and_return(false)
......
......@@ -46,14 +46,6 @@ RSpec.describe IncidentManagement::OncallSchedules::CreateService do
it_behaves_like 'error response', 'Your license does not support on-call schedules'
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
let!(:oncall_schedule) { create(:incident_management_oncall_schedule, project: project, name: 'On-call schedule') }
......
......@@ -47,14 +47,6 @@ RSpec.describe IncidentManagement::OncallSchedules::DestroyService do
it_behaves_like 'error response', 'Your license does not support on-call schedules'
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
before do
allow(oncall_schedule).to receive(:destroy).and_return(false)
......
......@@ -47,14 +47,6 @@ RSpec.describe IncidentManagement::OncallSchedules::UpdateService do
it_behaves_like 'error response', 'Your license does not support on-call schedules'
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
before do
create(:incident_management_oncall_schedule, project: project, name: params[:name])
......
......@@ -72,14 +72,6 @@ RSpec.describe ::IncidentManagement::OncallShifts::ReadService do
it_behaves_like 'error response', 'Your license does not support on-call rotations'
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
let(:end_time) { 1.day.before(start_time) }
......
......@@ -120,16 +120,6 @@ RSpec.describe IncidentManagement::OncallRotations::PersistShiftsJob do
travel_to(existing_shift.ends_at + (3 * rotation.shift_cycle_duration)) { example.run }
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
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