Commit b4daccb2 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Fix pending trait specs

Fixes pending trait specs for factories:

* `alert_management_alert`
* `prometheus_alert_event`
* `self_managed_prometheus_alert_event`
parent 56d95d9a
...@@ -47,10 +47,6 @@ FactoryBot.define do ...@@ -47,10 +47,6 @@ FactoryBot.define do
hosts { [FFaker::Internet.ip_v4_address] } hosts { [FFaker::Internet.ip_v4_address] }
end end
trait :with_ended_at do
ended_at { Time.current }
end
trait :without_ended_at do trait :without_ended_at do
ended_at { nil } ended_at { nil }
end end
...@@ -67,7 +63,7 @@ FactoryBot.define do ...@@ -67,7 +63,7 @@ FactoryBot.define do
trait :resolved do trait :resolved do
status { AlertManagement::Alert.status_value(:resolved) } status { AlertManagement::Alert.status_value(:resolved) }
with_ended_at ended_at { Time.current }
end end
trait :ignored do trait :ignored do
......
...@@ -13,10 +13,5 @@ FactoryBot.define do ...@@ -13,10 +13,5 @@ FactoryBot.define do
ended_at { Time.now } ended_at { Time.now }
payload_key { nil } payload_key { nil }
end end
trait :none do
status { nil }
started_at { nil }
end
end end
end end
...@@ -8,16 +8,5 @@ FactoryBot.define do ...@@ -8,16 +8,5 @@ FactoryBot.define do
title { 'alert' } title { 'alert' }
query_expression { 'vector(2)' } query_expression { 'vector(2)' }
started_at { Time.now } started_at { Time.now }
trait :resolved do
status { SelfManagedPrometheusAlertEvent.status_value_for(:resolved) }
ended_at { Time.now }
payload_key { nil }
end
trait :none do
status { nil }
started_at { nil }
end
end end
end end
...@@ -7,7 +7,6 @@ RSpec.describe 'factories' do ...@@ -7,7 +7,6 @@ RSpec.describe 'factories' do
def skipped_traits def skipped_traits
[ [
[:alert_management_alert, :with_ended_at],
[:audit_event, :unauthenticated], [:audit_event, :unauthenticated],
[:ci_build_trace_chunk, :fog_with_data], [:ci_build_trace_chunk, :fog_with_data],
[:ci_job_artifact, :remote_store], [:ci_job_artifact, :remote_store],
...@@ -32,10 +31,7 @@ RSpec.describe 'factories' do ...@@ -32,10 +31,7 @@ RSpec.describe 'factories' do
[:pages_domain, :explicit_ecdsa], [:pages_domain, :explicit_ecdsa],
[:project_member, :blocked], [:project_member, :blocked],
[:project, :remote_mirror], [:project, :remote_mirror],
[:prometheus_alert_event, :none],
[:remote_mirror, :ssh], [:remote_mirror, :ssh],
[:self_managed_prometheus_alert_event, :resolved],
[:self_managed_prometheus_alert_event, :none],
[:user_preference, :only_comments] [:user_preference, :only_comments]
] ]
end end
......
...@@ -52,7 +52,7 @@ RSpec.describe PrometheusAlertEvent do ...@@ -52,7 +52,7 @@ RSpec.describe PrometheusAlertEvent do
let(:started_at) { Time.current } let(:started_at) { Time.current }
context 'when status is none' do context 'when status is none' do
subject { build(:prometheus_alert_event, :none) } subject { build(:prometheus_alert_event, status: nil, started_at: nil) }
it 'fires an event' do it 'fires an event' do
result = subject.fire(started_at) result = subject.fire(started_at)
......
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