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
46864c43
Commit
46864c43
authored
Apr 12, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
3d1906f0
6fbfa060
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
app/services/update_deployment_service.rb
app/services/update_deployment_service.rb
+2
-0
changelogs/unreleased/11124-update-deployment-service-fails-if-project-is-nil.yml
...124-update-deployment-service-fails-if-project-is-nil.yml
+5
-0
spec/services/update_deployment_service_spec.rb
spec/services/update_deployment_service_spec.rb
+26
-11
No files found.
app/services/update_deployment_service.rb
View file @
46864c43
...
...
@@ -27,6 +27,8 @@ class UpdateDeploymentService
deployment
.
tap
(
&
:update_merge_request_metrics!
)
end
deployment
end
private
...
...
changelogs/unreleased/11124-update-deployment-service-fails-if-project-is-nil.yml
0 → 100644
View file @
46864c43
---
title
:
Always return the deployment in the UpdateDeploymentService#execute method
merge_request
:
27322
author
:
type
:
fixed
spec/services/update_deployment_service_spec.rb
View file @
46864c43
...
...
@@ -4,6 +4,7 @@ require 'spec_helper'
describe
UpdateDeploymentService
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:options
)
{
{
name:
'production'
}
}
let
(
:job
)
do
...
...
@@ -15,24 +16,22 @@ describe UpdateDeploymentService do
project:
project
)
end
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:environment
)
{
deployment
.
environment
}
let
(
:deployment
)
{
job
.
deployment
}
let
(
:service
)
{
described_class
.
new
(
deployment
)
}
let
(
:environment
)
{
deployment
.
environment
}
subject
(
:service
)
{
described_class
.
new
(
deployment
)
}
before
do
job
.
success!
# Create/Succeed deployment
end
describe
'#execute'
do
subject
{
service
.
execute
}
let
(
:store
)
{
Gitlab
::
EtagCaching
::
Store
.
new
}
it
'invalidates the environment etag cache'
do
old_value
=
store
.
get
(
environment
.
etag_cache_key
)
s
ubject
s
ervice
.
execute
expect
(
store
.
get
(
environment
.
etag_cache_key
)).
not_to
eq
(
old_value
)
end
...
...
@@ -42,14 +41,30 @@ describe UpdateDeploymentService do
.
to
receive
(
:create_ref
)
.
with
(
deployment
.
ref
,
deployment
.
send
(
:ref_path
))
s
ubject
s
ervice
.
execute
end
it
'updates merge request metrics'
do
expect_any_instance_of
(
Deployment
)
.
to
receive
(
:update_merge_request_metrics!
)
subject
service
.
execute
end
it
'returns the deployment'
do
expect
(
subject
.
execute
).
to
eq
(
deployment
)
end
it
'returns the deployment when could not save the environment'
do
allow
(
environment
).
to
receive
(
:save
).
and_return
(
false
)
expect
(
subject
.
execute
).
to
eq
(
deployment
)
end
it
'returns the deployment when environment is stopped'
do
allow
(
environment
).
to
receive
(
:stopped?
).
and_return
(
true
)
expect
(
subject
.
execute
).
to
eq
(
deployment
)
end
context
'when start action is defined'
do
...
...
@@ -61,7 +76,7 @@ describe UpdateDeploymentService do
end
it
'makes environment available'
do
s
ubject
s
ervice
.
execute
expect
(
environment
.
reload
).
to
be_available
end
...
...
@@ -80,11 +95,11 @@ describe UpdateDeploymentService do
end
it
'does not create a new environment'
do
expect
{
subject
}.
not_to
change
{
Environment
.
count
}
expect
{
subject
.
execute
}.
not_to
change
{
Environment
.
count
}
end
it
'updates external url'
do
subject
subject
.
execute
expect
(
subject
.
environment
.
name
).
to
eq
(
'review-apps/master'
)
expect
(
subject
.
environment
.
external_url
).
to
eq
(
'http://master.review-apps.gitlab.com'
)
...
...
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