Skip to content
Snippets Groups Projects
Commit 601539bb authored by Andrew Jung's avatar Andrew Jung :three:
Browse files

Fix audit events destination_url to be public

- Removes quarantine: #504781

Changelog: fixed
EE: true
parent f6ab6984
No related branches found
No related tags found
3 merge requests!181325Fix ambiguous `created_at` in project.rb,!179611Draft: Rebase CR approach for zoekt assignments,!175903Audit Events Specs for destination_url should be public urls
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :external_audit_event_destination, class: 'AuditEvents::ExternalAuditEventDestination' do
group
destination_url { FFaker::Internet.uri('https') }
sequence(:destination_url) { |n| "http://example.com/#{n}" }
stream_destination_id { nil }
end
end
......@@ -2,7 +2,7 @@
FactoryBot.define do
factory :instance_external_audit_event_destination, class: 'AuditEvents::InstanceExternalAuditEventDestination' do
destination_url { FFaker::Internet.uri('https') }
sequence(:destination_url) { |n| "http://example.com/#{n}" }
stream_destination_id { nil }
end
end
......@@ -59,7 +59,7 @@
end
if new_value != prev_value
it 'creates an audit event', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/504781' do
it 'creates an audit event' do
project.project_setting.update!(squash_option: new_value)
expect { auditor.execute }.to change(AuditEvent, :count).by(1)
......@@ -69,8 +69,7 @@
})
end
it 'streams correct audit event stream',
quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/504782' do
it 'streams correct audit event stream' do
project.project_setting.update!(squash_option: new_value)
expect(AuditEvents::AuditEventStreamingWorker).to receive(:perform_async).with(
......@@ -78,6 +77,7 @@
auditor.execute
end
else
it 'does not create audit event' do
project.project_setting.update!(squash_option: new_value)
......
......@@ -38,16 +38,16 @@
let_it_be(:group_2) { create(:group) }
it 'does not create destination with same url for a group' do
create(:external_audit_event_destination, destination_url: 'http://www.test.com', group: group)
destination = build(:external_audit_event_destination, destination_url: 'http://www.test.com', group: group)
create(:external_audit_event_destination, destination_url: 'http://example.com', group: group)
destination = build(:external_audit_event_destination, destination_url: 'http://example.com', group: group)
expect(destination).not_to be_valid
expect(destination.errors.full_messages).to include('Destination url has already been taken')
end
it 'creates destination with same url for different groups' do
create(:external_audit_event_destination, destination_url: 'http://www.test.com', group: group)
destination = build(:external_audit_event_destination, destination_url: 'http://www.test.com', group: group_2)
create(:external_audit_event_destination, destination_url: 'http://example.com', group: group)
destination = build(:external_audit_event_destination, destination_url: 'http://example.com', group: group_2)
expect(destination).to be_valid
end
......@@ -81,8 +81,8 @@
end
it 'must have a unique destination_url', :aggregate_failures do
create(:external_audit_event_destination, destination_url: 'https://example.com/1', group: group)
dup = build(:external_audit_event_destination, destination_url: 'https://example.com/1', group: group)
create(:external_audit_event_destination, destination_url: 'http://example.com/1', group: group)
dup = build(:external_audit_event_destination, destination_url: 'http://example.com/1', group: group)
expect(dup).to be_invalid
expect(dup.errors.full_messages).to include('Destination url has already been taken')
......
......@@ -64,8 +64,8 @@
end
it 'validates uniqueness of destination_url' do
create(:instance_external_audit_event_destination, destination_url: 'https://www.test.com')
destination = build(:instance_external_audit_event_destination, destination_url: 'https://www.test.com')
create(:instance_external_audit_event_destination, destination_url: 'https://www.example.com')
destination = build(:instance_external_audit_event_destination, destination_url: 'https://www.example.com')
expect(destination).not_to be_valid
expect(destination.errors.full_messages).to include('Destination url has already been taken')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment