1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# frozen_string_literal: true
module QA
RSpec.describe 'Monitor', product_group: :respond do
describe 'Alert settings' do
shared_examples 'sends test alert' do
it 'creates new alert' do
Page::Project::Menu.perform(&:go_to_monitor_alerts)
Page::Project::Monitor::Alerts::Index.perform do |index|
expect(index).to have_alert_with_title(alert_title)
end
end
end
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-for-alerts'
project.description = 'Project for alerts'
end
end
let(:alert_title) { Faker::Lorem.word }
before do
Flow::Login.sign_in
project.visit!
end
context(
'when using HTTP endpoint integration',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/382803'
) do
let(:payload) do
{ title: alert_title, description: alert_title }
end
before do
Flow::AlertSettings.setup_http_endpoint(payload: payload)
end
it_behaves_like 'sends test alert'
end
context(
'when using Prometheus integration',
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/385792'
) do
let(:payload) do
{
version: '4',
groupKey: nil,
status: 'firing',
receiver: '',
groupLabels: {},
commonLabels: {},
commonAnnotations: {},
externalURL: '',
alerts: [
{
startsAt: Time.now,
generatorURL: Faker::Internet.url,
endsAt: nil,
status: 'firing',
labels: { gitlab_environment_name: Faker::Lorem.word },
annotations:
{
title: alert_title,
gitlab_y_label: 'status'
}
}
]
}
end
before do
Flow::AlertSettings.setup_prometheus(payload: payload)
end
it_behaves_like 'sends test alert'
end
end
end
end
|