Commit deaf4756 authored by Stan Hu's avatar Stan Hu

Merge branch '322697-fix-pending-trait-specs-for-monitor' into 'master'

Fix pending trait specs

See merge request gitlab-org/gitlab!55063
parents 1fb7f444 b4daccb2
......@@ -47,10 +47,6 @@ FactoryBot.define do
hosts { [FFaker::Internet.ip_v4_address] }
end
trait :with_ended_at do
ended_at { Time.current }
end
trait :without_ended_at do
ended_at { nil }
end
......@@ -67,7 +63,7 @@ FactoryBot.define do
trait :resolved do
status { AlertManagement::Alert.status_value(:resolved) }
with_ended_at
ended_at { Time.current }
end
trait :ignored do
......
......@@ -13,10 +13,5 @@ FactoryBot.define do
ended_at { Time.now }
payload_key { nil }
end
trait :none do
status { nil }
started_at { nil }
end
end
end
......@@ -8,16 +8,5 @@ FactoryBot.define do
title { 'alert' }
query_expression { 'vector(2)' }
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
......@@ -7,7 +7,6 @@ RSpec.describe 'factories' do
def skipped_traits
[
[:alert_management_alert, :with_ended_at],
[:audit_event, :unauthenticated],
[:ci_build_trace_chunk, :fog_with_data],
[:ci_job_artifact, :remote_store],
......@@ -32,10 +31,7 @@ RSpec.describe 'factories' do
[:pages_domain, :explicit_ecdsa],
[:project_member, :blocked],
[:project, :remote_mirror],
[:prometheus_alert_event, :none],
[:remote_mirror, :ssh],
[:self_managed_prometheus_alert_event, :resolved],
[:self_managed_prometheus_alert_event, :none],
[:user_preference, :only_comments]
]
end
......
......@@ -52,7 +52,7 @@ RSpec.describe PrometheusAlertEvent do
let(:started_at) { Time.current }
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
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