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
8e92e25b
Commit
8e92e25b
authored
May 22, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remvoe disable_ddl_transaction! and redandant RecordNotUnique exception rescue
parent
f61666c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
24 deletions
+7
-24
db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
...igrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
+0
-2
lib/gitlab/ci/pipeline/chain/create.rb
lib/gitlab/ci/pipeline/chain/create.rb
+1
-1
spec/lib/gitlab/ci/pipeline/chain/create_spec.rb
spec/lib/gitlab/ci/pipeline/chain/create_spec.rb
+6
-21
No files found.
db/migrate/20180424160449_add_pipeline_iid_to_ci_pipelines.rb
View file @
8e92e25b
...
@@ -3,8 +3,6 @@ class AddPipelineIidToCiPipelines < ActiveRecord::Migration
...
@@ -3,8 +3,6 @@ class AddPipelineIidToCiPipelines < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
disable_ddl_transaction!
def
up
def
up
add_column
:ci_pipelines
,
:iid
,
:integer
add_column
:ci_pipelines
,
:iid
,
:integer
end
end
...
...
lib/gitlab/ci/pipeline/chain/create.rb
View file @
8e92e25b
...
@@ -23,7 +23,7 @@ module Gitlab
...
@@ -23,7 +23,7 @@ module Gitlab
end
end
end
end
end
end
rescue
ActiveRecord
::
RecordInvalid
,
ActiveRecord
::
RecordNotUnique
=>
e
rescue
ActiveRecord
::
RecordInvalid
=>
e
error
(
"Failed to persist the pipeline:
#{
e
}
"
)
error
(
"Failed to persist the pipeline:
#{
e
}
"
)
end
end
...
...
spec/lib/gitlab/ci/pipeline/chain/create_spec.rb
View file @
8e92e25b
...
@@ -37,17 +37,6 @@ describe Gitlab::Ci::Pipeline::Chain::Create do
...
@@ -37,17 +37,6 @@ describe Gitlab::Ci::Pipeline::Chain::Create do
end
end
context
'when pipeline has validation errors'
do
context
'when pipeline has validation errors'
do
shared_examples_for
'expectations'
do
it
'breaks the chain'
do
expect
(
step
.
break?
).
to
be
true
end
it
'appends validation error'
do
expect
(
pipeline
.
errors
.
to_a
)
.
to
include
/Failed to persist the pipeline/
end
end
context
'when ref is nil'
do
context
'when ref is nil'
do
let
(
:pipeline
)
do
let
(
:pipeline
)
do
build
(
:ci_pipeline
,
project:
project
,
ref:
nil
)
build
(
:ci_pipeline
,
project:
project
,
ref:
nil
)
...
@@ -57,18 +46,14 @@ describe Gitlab::Ci::Pipeline::Chain::Create do
...
@@ -57,18 +46,14 @@ describe Gitlab::Ci::Pipeline::Chain::Create do
step
.
perform!
step
.
perform!
end
end
it_behaves_like
'expectations'
it
'breaks the chain'
do
expect
(
step
.
break?
).
to
be
true
end
end
context
'when pipeline has a duplicate iid'
do
it
'appends validation error'
do
before
do
expect
(
pipeline
.
errors
.
to_a
)
allow_any_instance_of
(
Ci
::
Pipeline
).
to
receive
(
:ensure_project_iid!
)
{
|
p
|
p
.
send
(
:write_attribute
,
:iid
,
1
)
}
.
to
include
/Failed to persist the pipeline/
create
(
:ci_pipeline
,
project:
project
)
step
.
perform!
end
end
it_behaves_like
'expectations'
end
end
end
end
end
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