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
00f87838
Commit
00f87838
authored
May 20, 2020
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add :with_validation_errors trait for Alert
parent
339c39b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
spec/factories/alert_management/alerts.rb
spec/factories/alert_management/alerts.rb
+7
-0
spec/services/alert_management/create_alert_issue_service_spec.rb
...vices/alert_management/create_alert_issue_service_spec.rb
+1
-5
spec/workers/incident_management/process_alert_worker_spec.rb
.../workers/incident_management/process_alert_worker_spec.rb
+1
-5
No files found.
spec/factories/alert_management/alerts.rb
View file @
00f87838
...
...
@@ -8,6 +8,13 @@ FactoryBot.define do
title
{
FFaker
::
Lorem
.
sentence
}
started_at
{
Time
.
current
}
trait
:with_validation_errors
do
after
(
:create
)
do
|
alert
|
too_many_hosts
=
Array
.
new
(
AlertManagement
::
Alert
::
HOSTS_MAX_LENGTH
+
1
)
{
|
_
|
'host'
}
alert
.
update_columns
(
hosts:
too_many_hosts
)
end
end
trait
:with_issue
do
issue
end
...
...
spec/services/alert_management/create_alert_issue_service_spec.rb
View file @
00f87838
...
...
@@ -94,11 +94,7 @@ RSpec.describe AlertManagement::CreateAlertIssueService do
end
context
'when alert cannot be updated'
do
before
do
# invalidate alert
too_many_hosts
=
Array
.
new
(
AlertManagement
::
Alert
::
HOSTS_MAX_LENGTH
+
1
)
{
|
_
|
'host'
}
alert
.
update_columns
(
hosts:
too_many_hosts
)
end
let
(
:alert
)
{
create
(
:alert_management_alert
,
:with_validation_errors
,
:triggered
,
project:
project
,
payload:
payload
)
}
it
'responds with error'
do
expect
(
execute
).
to
be_error
...
...
spec/workers/incident_management/process_alert_worker_spec.rb
View file @
00f87838
...
...
@@ -70,11 +70,7 @@ describe IncidentManagement::ProcessAlertWorker do
end
context
'when alert cannot be updated'
do
before
do
# invalidate alert
too_many_hosts
=
Array
.
new
(
AlertManagement
::
Alert
::
HOSTS_MAX_LENGTH
+
1
)
{
|
_
|
'host'
}
alert
.
update_columns
(
hosts:
too_many_hosts
)
end
let
(
:alert
)
{
create
(
:alert_management_alert
,
:with_validation_errors
,
project:
project
)
}
it
'updates AlertManagement::Alert#issue_id'
do
expect
{
subject
}.
not_to
change
{
alert
.
reload
.
issue_id
}
...
...
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