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
Show 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
...
@@ -8,6 +8,13 @@ FactoryBot.define do
title
{
FFaker
::
Lorem
.
sentence
}
title
{
FFaker
::
Lorem
.
sentence
}
started_at
{
Time
.
current
}
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
trait
:with_issue
do
issue
issue
end
end
...
...
spec/services/alert_management/create_alert_issue_service_spec.rb
View file @
00f87838
...
@@ -94,11 +94,7 @@ RSpec.describe AlertManagement::CreateAlertIssueService do
...
@@ -94,11 +94,7 @@ RSpec.describe AlertManagement::CreateAlertIssueService do
end
end
context
'when alert cannot be updated'
do
context
'when alert cannot be updated'
do
before
do
let
(
:alert
)
{
create
(
:alert_management_alert
,
:with_validation_errors
,
:triggered
,
project:
project
,
payload:
payload
)
}
# invalidate alert
too_many_hosts
=
Array
.
new
(
AlertManagement
::
Alert
::
HOSTS_MAX_LENGTH
+
1
)
{
|
_
|
'host'
}
alert
.
update_columns
(
hosts:
too_many_hosts
)
end
it
'responds with error'
do
it
'responds with error'
do
expect
(
execute
).
to
be_error
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
...
@@ -70,11 +70,7 @@ describe IncidentManagement::ProcessAlertWorker do
end
end
context
'when alert cannot be updated'
do
context
'when alert cannot be updated'
do
before
do
let
(
:alert
)
{
create
(
:alert_management_alert
,
:with_validation_errors
,
project:
project
)
}
# invalidate alert
too_many_hosts
=
Array
.
new
(
AlertManagement
::
Alert
::
HOSTS_MAX_LENGTH
+
1
)
{
|
_
|
'host'
}
alert
.
update_columns
(
hosts:
too_many_hosts
)
end
it
'updates AlertManagement::Alert#issue_id'
do
it
'updates AlertManagement::Alert#issue_id'
do
expect
{
subject
}.
not_to
change
{
alert
.
reload
.
issue_id
}
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