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
40600094
Commit
40600094
authored
May 14, 2020
by
Vitali Tatarintev
Committed by
Peter Leitzen
May 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename variables to increase tests readability
parent
425afac6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
spec/requests/api/graphql/project/alert_management/alerts_spec.rb
...uests/api/graphql/project/alert_management/alerts_spec.rb
+22
-22
No files found.
spec/requests/api/graphql/project/alert_management/alerts_spec.rb
View file @
40600094
...
...
@@ -7,8 +7,8 @@ describe 'getting Alert Management Alerts' do
let_it_be
(
:payload
)
{
{
'custom'
=>
{
'alert'
=>
'payload'
}
}
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:current_user
)
{
create
(
:user
)
}
let_it_be
(
:
alert_1
)
{
create
(
:alert_management_alert
,
:all_fields
,
:resolved
,
project:
project
,
issue:
nil
,
severity: :low
)
}
let_it_be
(
:
alert_2
)
{
create
(
:alert_management_alert
,
:all_fields
,
project:
project
,
severity: :critical
,
payload:
payload
)
}
let_it_be
(
:
resolved_alert
)
{
create
(
:alert_management_alert
,
:all_fields
,
:resolved
,
project:
project
,
issue:
nil
,
severity: :low
)
}
let_it_be
(
:
triggered_alert
)
{
create
(
:alert_management_alert
,
:all_fields
,
project:
project
,
severity: :critical
,
payload:
payload
)
}
let_it_be
(
:other_project_alert
)
{
create
(
:alert_management_alert
,
:all_fields
)
}
let
(
:params
)
{
{}
}
...
...
@@ -58,38 +58,38 @@ describe 'getting Alert Management Alerts' do
it
'returns the correct properties of the alerts'
do
expect
(
first_alert
).
to
include
(
'iid'
=>
alert_2
.
iid
.
to_s
,
'issueIid'
=>
alert_2
.
issue_iid
.
to_s
,
'title'
=>
alert_2
.
title
,
'description'
=>
alert_2
.
description
,
'severity'
=>
alert_2
.
severity
.
upcase
,
'iid'
=>
triggered_alert
.
iid
.
to_s
,
'issueIid'
=>
triggered_alert
.
issue_iid
.
to_s
,
'title'
=>
triggered_alert
.
title
,
'description'
=>
triggered_alert
.
description
,
'severity'
=>
triggered_alert
.
severity
.
upcase
,
'status'
=>
'TRIGGERED'
,
'monitoringTool'
=>
alert_2
.
monitoring_tool
,
'service'
=>
alert_2
.
service
,
'hosts'
=>
alert_2
.
hosts
,
'eventCount'
=>
alert_2
.
events
,
'startedAt'
=>
alert_2
.
started_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
),
'monitoringTool'
=>
triggered_alert
.
monitoring_tool
,
'service'
=>
triggered_alert
.
service
,
'hosts'
=>
triggered_alert
.
hosts
,
'eventCount'
=>
triggered_alert
.
events
,
'startedAt'
=>
triggered_alert
.
started_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
),
'endedAt'
=>
nil
,
'details'
=>
{
'custom.alert'
=>
'payload'
},
'createdAt'
=>
alert_2
.
created_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
),
'updatedAt'
=>
alert_2
.
updated_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
)
'createdAt'
=>
triggered_alert
.
created_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
),
'updatedAt'
=>
triggered_alert
.
updated_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
)
)
expect
(
second_alert
).
to
include
(
'iid'
=>
alert_1
.
iid
.
to_s
,
'iid'
=>
resolved_alert
.
iid
.
to_s
,
'issueIid'
=>
nil
,
'status'
=>
'RESOLVED'
,
'endedAt'
=>
alert_1
.
ended_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
)
'endedAt'
=>
resolved_alert
.
ended_at
.
strftime
(
'%Y-%m-%dT%H:%M:%SZ'
)
)
end
context
'with iid given'
do
let
(
:params
)
{
{
iid:
alert_1
.
iid
.
to_s
}
}
let
(
:params
)
{
{
iid:
resolved_alert
.
iid
.
to_s
}
}
it_behaves_like
'a working graphql query'
it
{
expect
(
alerts
.
size
).
to
eq
(
1
)
}
it
{
expect
(
first_alert
[
'iid'
]).
to
eq
(
alert_1
.
iid
.
to_s
)
}
it
{
expect
(
first_alert
[
'iid'
]).
to
eq
(
resolved_alert
.
iid
.
to_s
)
}
end
context
'sorting data given'
do
...
...
@@ -99,25 +99,25 @@ describe 'getting Alert Management Alerts' do
it_behaves_like
'a working graphql query'
it
'sorts in the correct order'
do
expect
(
iids
).
to
eq
[
alert_1
.
iid
.
to_s
,
alert_2
.
iid
.
to_s
]
expect
(
iids
).
to
eq
[
resolved_alert
.
iid
.
to_s
,
triggered_alert
.
iid
.
to_s
]
end
context
'ascending order'
do
let
(
:params
)
{
'sort: SEVERITY_ASC'
}
it
'sorts in the correct order'
do
expect
(
iids
).
to
eq
[
alert_2
.
iid
.
to_s
,
alert_1
.
iid
.
to_s
]
expect
(
iids
).
to
eq
[
triggered_alert
.
iid
.
to_s
,
resolved_alert
.
iid
.
to_s
]
end
end
end
context
'searching'
do
let
(
:params
)
{
{
search:
alert_1
.
title
}
}
let
(
:params
)
{
{
search:
resolved_alert
.
title
}
}
it_behaves_like
'a working graphql query'
it
{
expect
(
alerts
.
size
).
to
eq
(
1
)
}
it
{
expect
(
first_alert
[
'iid'
]).
to
eq
(
alert_1
.
iid
.
to_s
)
}
it
{
expect
(
first_alert
[
'iid'
]).
to
eq
(
resolved_alert
.
iid
.
to_s
)
}
context
'unknown criteria'
do
let
(
:params
)
{
{
search:
'something random'
}
}
...
...
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