Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ee20ecd3
Commit
ee20ecd3
authored
Aug 06, 2020
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix presenter specs
parent
e606683f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
4 deletions
+17
-4
app/presenters/alert_management/alert_presenter.rb
app/presenters/alert_management/alert_presenter.rb
+1
-1
app/presenters/projects/prometheus/alert_presenter.rb
app/presenters/projects/prometheus/alert_presenter.rb
+1
-1
spec/presenters/projects/prometheus/alert_presenter_spec.rb
spec/presenters/projects/prometheus/alert_presenter_spec.rb
+13
-0
spec/workers/incident_management/process_alert_worker_spec.rb
.../workers/incident_management/process_alert_worker_spec.rb
+2
-2
No files found.
app/presenters/alert_management/alert_presenter.rb
View file @
ee20ecd3
...
...
@@ -75,7 +75,7 @@ module AlertManagement
metadata
<<
list_item
(
'Monitoring tool'
,
monitoring_tool
)
if
monitoring_tool
metadata
<<
list_item
(
'Hosts'
,
host_links
)
if
hosts
.
any?
metadata
<<
list_item
(
'Description'
,
description
)
if
description
.
present?
metadata
<<
list_item
(
'GitLab
A
lert'
,
details_url
)
if
details_url
.
present?
metadata
<<
list_item
(
'GitLab
a
lert'
,
details_url
)
if
details_url
.
present?
metadata
.
join
(
MARKDOWN_LINE_BREAK
)
end
...
...
app/presenters/projects/prometheus/alert_presenter.rb
View file @
ee20ecd3
...
...
@@ -107,7 +107,7 @@ module Projects
metadata
<<
list_item
(
service
.
label
.
humanize
,
service
.
value
)
if
service
metadata
<<
list_item
(
monitoring_tool
.
label
.
humanize
,
monitoring_tool
.
value
)
if
monitoring_tool
metadata
<<
list_item
(
hosts
.
label
.
humanize
,
host_links
)
if
hosts
metadata
<<
list_item
(
'GitLab
A
lert'
,
details_url
)
if
details_url
metadata
<<
list_item
(
'GitLab
a
lert'
,
details_url
)
if
details_url
metadata
.
join
(
MARKDOWN_LINE_BREAK
)
end
...
...
spec/presenters/projects/prometheus/alert_presenter_spec.rb
View file @
ee20ecd3
...
...
@@ -293,6 +293,19 @@ RSpec.describe Projects::Prometheus::AlertPresenter do
end
end
describe
'#details_url'
do
subject
{
presenter
.
details_url
}
it
{
is_expected
.
to
eq
(
nil
)
}
context
'alert management alert present'
do
let
(
:am_alert
)
{
create
(
:alert_management_alert
,
project:
project
)
}
let
(
:alert
)
{
create
(
:alerting_alert
,
project:
project
,
payload:
payload
,
alert:
am_alert
)
}
it
{
is_expected
.
to
eq
(
"http://localhost/
#{
project
.
full_path
}
/-/alert_management/
#{
am_alert
.
id
}
/details"
)
}
end
end
context
'with gitlab alert'
do
include_context
'gitlab alert'
...
...
spec/workers/incident_management/process_alert_worker_spec.rb
View file @
ee20ecd3
...
...
@@ -19,14 +19,14 @@ RSpec.describe IncidentManagement::ProcessAlertWorker do
allow
(
Gitlab
::
AppLogger
).
to
receive
(
:warn
).
and_call_original
allow
(
IncidentManagement
::
CreateIssueService
)
.
to
receive
(
:new
).
with
(
alert
.
project
,
parsed_payload
)
.
to
receive
(
:new
).
with
(
alert
.
project
,
alert
)
.
and_call_original
end
shared_examples
'creates issue successfully'
do
it
'creates an issue'
do
expect
(
IncidentManagement
::
CreateIssueService
)
.
to
receive
(
:new
).
with
(
alert
.
project
,
parsed_payload
)
.
to
receive
(
:new
).
with
(
alert
.
project
,
alert
)
expect
{
subject
}.
to
change
{
Issue
.
count
}.
by
(
1
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment