Commit 581dd9b8 authored by Max Woolf's avatar Max Woolf Committed by Stan Hu

Handle event streaming licence error when no entity

parent 18c34a49
......@@ -57,7 +57,7 @@ module EE
def stream_to_external_destinations
return if entity.nil?
return unless ::Feature.enabled?(:ff_external_audit_events_namespace, group_entity)
return unless group_entity.licensed_feature_available?(:external_audit_events)
return unless group_entity&.licensed_feature_available?(:external_audit_events)
AuditEvents::AuditEventStreamingWorker.perform_async(id)
end
......
......@@ -101,6 +101,20 @@ RSpec.describe AuditEvent, type: :model do
event.stream_to_external_destinations
end
context 'when entity is not a group or project' do
let_it_be(:event) { create(:user_audit_event) }
before do
stub_feature_flags(ff_external_audit_events_namespace: true)
end
it 'enqueues no workers' do
expect(AuditEvents::AuditEventStreamingWorker).not_to receive(:perform_async)
event.stream_to_external_destinations
end
end
end
context 'when ff_external_audit_events_namespace is disabled' do
......
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