Commit 3c6492ea authored by Vladimir Shushlin's avatar Vladimir Shushlin Committed by Robert Speicher

Remove feature_flag_audit feature flag

Remove feature flag and specs for it being turned off
parent 90b9f50a
......@@ -6,13 +6,7 @@ module FeatureFlags
protected
def audit_enabled?
Feature.enabled?(:feature_flag_audit, project, default_enabled: true)
end
def audit_event(feature_flag)
return unless audit_enabled?
message = audit_message(feature_flag)
return if message.blank?
......@@ -33,7 +27,7 @@ module FeatureFlags
end
def save_audit_event(audit_event)
return unless audit_event # feature_flag_audit is disabled or audit_message is blank
return unless audit_event
audit_event.security_event
end
......
......@@ -15,7 +15,6 @@ describe 'User creates feature flag', :js do
end
context 'when creates without changing scopes' do
shared_examples 'succesfully creates feature flag' do
before do
visit(new_project_feature_flag_path(project))
set_feature_flag_info('ci_live_trace', 'For live trace')
......@@ -34,10 +33,6 @@ describe 'User creates feature flag', :js do
end
end
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully creates feature flag'
it 'records audit event' do
visit(project_audit_events_path(project))
......@@ -46,23 +41,7 @@ describe 'User creates feature flag', :js do
end
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully creates feature flag'
it 'does not record audit event' do
visit(project_audit_events_path(project))
expect(page).to have_no_text("Created feature flag")
end
end
end
context 'when creates with disabling the default scope' do
shared_examples 'succesfully creates feature flag' do
before do
visit(new_project_feature_flag_path(project))
set_feature_flag_info('ci_live_trace', 'For live trace')
......@@ -87,21 +66,7 @@ describe 'User creates feature flag', :js do
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully creates feature flag'
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully creates feature flag'
end
end
context 'when creates with an additional scope' do
shared_examples 'succesfully creates feature flag' do
before do
visit(new_project_feature_flag_path(project))
set_feature_flag_info('mr_train', '')
......@@ -135,23 +100,9 @@ describe 'User creates feature flag', :js do
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully creates feature flag'
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully creates feature flag'
end
end
context 'when searches an environment name for scope creation' do
let!(:environment) { create(:environment, name: 'production', project: project) }
shared_examples 'succesfully creates feature flag' do
before do
visit(new_project_feature_flag_path(project))
set_feature_flag_info('mr_train', '')
......@@ -181,19 +132,6 @@ describe 'User creates feature flag', :js do
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully creates feature flag'
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully creates feature flag'
end
end
private
def set_feature_flag_info(name, description)
......
......@@ -37,7 +37,6 @@ describe 'User updates feature flag', :js do
end
context 'when user updates a status of a scope' do
shared_examples 'succesfully updates feature flag' do
before do
within_scope_row(2) do
within_status { find('.project-feature-toggle').click }
......@@ -60,10 +59,6 @@ describe 'User updates feature flag', :js do
end
end
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully updates feature flag'
it 'records audit event' do
visit(project_audit_events_path(project))
......@@ -74,23 +69,7 @@ describe 'User updates feature flag', :js do
end
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully updates feature flag'
it 'does not record audit event' do
visit(project_audit_events_path(project))
expect(page).to have_no_text("Updated feature flag")
end
end
end
context 'when user adds a new scope' do
shared_examples 'succesfully updates feature flag' do
before do
within_scope_row(3) do
within_environment_spec do
......@@ -111,10 +90,6 @@ describe 'User updates feature flag', :js do
end
end
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully updates feature flag'
it 'records audit event' do
visit(project_audit_events_path(project))
......@@ -125,23 +100,7 @@ describe 'User updates feature flag', :js do
end
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully updates feature flag'
it 'does not record audit event' do
visit(project_audit_events_path(project))
expect(page).to have_no_text("Updated feature flag")
end
end
end
context 'when user deletes a scope' do
shared_examples 'succesfully updates feature flag' do
before do
within_scope_row(2) do
within_delete { find('.js-delete-scope').click }
......@@ -159,10 +118,6 @@ describe 'User updates feature flag', :js do
end
end
end
end
context 'when feature flag audit enabled' do
include_examples 'succesfully updates feature flag'
it 'records audit event' do
visit(project_audit_events_path(project))
......@@ -172,19 +127,4 @@ describe 'User updates feature flag', :js do
)
end
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
include_examples 'succesfully updates feature flag'
it 'does not record audit event' do
visit(project_audit_events_path(project))
expect(page).to have_no_text("Updated feature flag")
end
end
end
end
......@@ -55,22 +55,6 @@ describe FeatureFlags::CreateService do
expect { subject }.to change { AuditEvent.count }.by(1)
expect(AuditEvent.last.present.action).to eq(expected_message)
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
it { expect(subject[:status]).to eq(:success) }
it 'creates feature flag' do
expect { subject }.to change { Operations::FeatureFlag.count }.by(1)
end
it 'does not create audit log' do
expect { subject }.not_to change { AuditEvent.count }
end
end
end
end
end
......@@ -24,20 +24,6 @@ describe FeatureFlags::DestroyService do
expect(audit_event_message).to eq("Deleted feature flag <strong>#{feature_flag.name.tr('_', ' ')}</strong>.")
end
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
it 'works successfully' do
expect(subject[:status]).to eq(:success)
end
it 'does not create audit event' do
expect { subject }.not_to change { AuditEvent.count }
end
end
context 'when feature flag can not be destroyed' do
before do
allow(feature_flag).to receive(:destroy).and_return(false)
......
......@@ -29,24 +29,6 @@ describe FeatureFlags::UpdateService do
)
end
shared_examples 'disabled feature flag audit' do
context 'when feature flag audit is disabled' do
before do
stub_feature_flags(feature_flag_audit: false)
end
it 'returns success status' do
expect(subject[:status]).to eq(:success)
end
it 'does not create audit event' do
expect { subject }.not_to change { AuditEvent.count }
end
end
end
include_examples 'disabled feature flag audit'
context 'with invalid params' do
let(:params) { { name: nil } }
......@@ -85,8 +67,6 @@ describe FeatureFlags::UpdateService do
" to <strong>\"new description\"</strong>.")
)
end
include_examples 'disabled feature flag audit'
end
context 'when active state is changed' do
......@@ -103,8 +83,6 @@ describe FeatureFlags::UpdateService do
"from <strong>true</strong> to <strong>false</strong>.")
)
end
include_examples 'disabled feature flag audit'
end
context 'when scope is renamed' do
......@@ -123,8 +101,6 @@ describe FeatureFlags::UpdateService do
)
end
include_examples 'disabled feature flag audit'
context 'when scope can not be updated' do
let(:params) do
{
......@@ -159,8 +135,6 @@ describe FeatureFlags::UpdateService do
expect(audit_event_message).to include("Deleted rule <strong>review</strong>.")
end
include_examples 'disabled feature flag audit'
context 'when scope can not be deleted' do
RSpec::Matchers.define_negated_matcher :not_change, :change
......@@ -191,8 +165,6 @@ describe FeatureFlags::UpdateService do
)
end
include_examples 'disabled feature flag audit'
context 'when scope can not be created' do
let(:new_environment_scope) { '' }
......
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