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
68a92295
Commit
68a92295
authored
Nov 07, 2017
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cluster_applications_helm factory with a configured cluster
parent
d6134709
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
spec/factories/clusters/applications/helm.rb
spec/factories/clusters/applications/helm.rb
+1
-6
spec/services/clusters/applications/install_service_spec.rb
spec/services/clusters/applications/install_service_spec.rb
+9
-3
No files found.
spec/factories/clusters/applications/helm.rb
View file @
68a92295
FactoryGirl
.
define
do
factory
:cluster_applications_helm
,
class:
Clusters
::
Applications
::
Helm
do
cluster
factory:
:cluster
cluster
factory:
%i(cluster provided_by_gcp)
trait
:installable
do
cluster
status
0
end
trait
:scheduled
do
cluster
status
1
end
trait
:installing
do
cluster
status
2
end
trait
:installed
do
cluster
status
3
end
trait
:errored
do
cluster
status
(
-
1
)
status_reason
'something went wrong'
end
...
...
spec/services/clusters/applications/install_service_spec.rb
View file @
68a92295
...
...
@@ -4,14 +4,20 @@ describe Clusters::Applications::InstallService do
describe
'#execute'
do
let
(
:application
)
{
create
(
:cluster_applications_helm
,
:scheduled
)
}
let
(
:service
)
{
described_class
.
new
(
application
)
}
let
(
:helm_client
)
{
instance_double
(
Gitlab
::
Kubernetes
::
Helm
)
}
before
do
allow
(
service
).
to
receive
(
:helm_api
).
and_return
(
helm_client
)
end
context
'when there are no errors'
do
before
do
expect
_any_instance_of
(
Gitlab
::
Kubernetes
::
Helm
).
to
receive
(
:install
).
with
(
application
)
expect
(
helm_client
).
to
receive
(
:install
).
with
(
application
)
allow
(
ClusterWaitForAppInstallationWorker
).
to
receive
(
:perform_in
).
and_return
(
nil
)
end
it
'make the application installing'
do
expect
(
application
.
cluster
).
not_to
be_nil
service
.
execute
expect
(
application
).
to
be_installing
...
...
@@ -27,7 +33,7 @@ describe Clusters::Applications::InstallService do
context
'when k8s cluster communication fails'
do
before
do
error
=
KubeException
.
new
(
500
,
'system failure'
,
nil
)
expect
_any_instance_of
(
Gitlab
::
Kubernetes
::
Helm
).
to
receive
(
:install
).
with
(
application
).
and_raise
(
error
)
expect
(
helm_client
).
to
receive
(
:install
).
with
(
application
).
and_raise
(
error
)
end
it
'make the application errored'
do
...
...
@@ -43,7 +49,7 @@ describe Clusters::Applications::InstallService do
it
'make the application errored'
do
expect
(
application
).
to
receive
(
:make_installing!
).
once
.
and_raise
(
ActiveRecord
::
RecordInvalid
)
expect
_any_instance_of
(
Gitlab
::
Kubernetes
::
Helm
).
not_to
receive
(
:install
)
expect
(
helm_client
).
not_to
receive
(
:install
)
service
.
execute
...
...
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