internal_event_matcher fail if no metric is defined
Problem
You should be able to create an event (foo) without a metric and then use internal_events_matchers in your specs like this:
context 'foo event' do
it 'triggers foo' do
expect { fetch }.to trigger_internal_events('foo')
end
it 'does not trigger foo' do
expect { nil }.not_to trigger_internal_events('foo')
end
end
However, the above will fail with:
1) Gitlab::LicenseScanning::PackageLicenses foo event triggers foo
Failure/Error: raise ArgumentError, "Unknown event '#{event_name}'! #{name} matcher accepts only existing events"
ArgumentError:
Unknown event 'foo'! trigger_internal_events matcher accepts only existing events
[snip]
And
2) Gitlab::LicenseScanning::PackageLicenses foo event does not trigger foo
Failure/Error: raise ArgumentError, "Unknown event '#{event_name}'! #{name} matcher accepts only existing events"
ArgumentError:
Unknown event 'foo'! trigger_internal_events matcher accepts only existing events
Desired Outcome
You can use the matchers for testing events that are not used in metrics.
Potential Solution(s)
How to verify
Create an event foo and a spec with the above examples and see it pass.
Further actions needed
Edited by Jonas Larsen