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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
d89d514e
Commit
d89d514e
authored
Nov 07, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '38464-k8s-apps' of
https://gitlab.com/gitlab-org/gitlab-ce
into 38464-k8s-apps
parents
6228b65f
3bf2abaa
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
25 deletions
+21
-25
app/models/clusters/concerns/application_status.rb
app/models/clusters/concerns/application_status.rb
+7
-7
spec/factories/clusters/applications/helm.rb
spec/factories/clusters/applications/helm.rb
+2
-6
spec/models/clusters/applications/helm_spec.rb
spec/models/clusters/applications/helm_spec.rb
+5
-5
spec/serializers/cluster_application_entity_spec.rb
spec/serializers/cluster_application_entity_spec.rb
+2
-2
spec/services/clusters/applications/check_installation_progress_service_spec.rb
.../applications/check_installation_progress_service_spec.rb
+2
-2
spec/services/clusters/applications/install_service_spec.rb
spec/services/clusters/applications/install_service_spec.rb
+2
-2
spec/services/clusters/applications/schedule_installation_service_spec.rb
...usters/applications/schedule_installation_service_spec.rb
+1
-1
No files found.
app/models/clusters/concerns/application_status.rb
View file @
d89d514e
...
@@ -12,20 +12,20 @@ module Clusters
...
@@ -12,20 +12,20 @@ module Clusters
state
:installing
,
value:
2
state
:installing
,
value:
2
state
:installed
,
value:
3
state
:installed
,
value:
3
event
:make_scheduled
do
transition
%i(installable errored)
=>
:scheduled
end
event
:make_installing
do
event
:make_installing
do
transition
any
-
[
:installing
]
=>
:installing
transition
%i(scheduled)
=>
:installing
end
end
event
:make_installed
do
event
:make_installed
do
transition
any
-
[
:installed
]
=>
:installed
transition
%i(installing)
=>
:installed
end
end
event
:make_errored
do
event
:make_errored
do
transition
any
-
[
:errored
]
=>
:errored
transition
any
=>
:errored
end
event
:make_scheduled
do
transition
%i(installable errored)
=>
:scheduled
end
end
before_transition
any
=>
[
:scheduled
]
do
|
app_status
,
_
|
before_transition
any
=>
[
:scheduled
]
do
|
app_status
,
_
|
...
...
spec/factories/clusters/applications/helm.rb
View file @
d89d514e
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:applications_helm
,
class:
Clusters
::
Applications
::
Helm
do
factory
:cluster_applications_helm
,
class:
Clusters
::
Applications
::
Helm
do
trait
:cluster
do
cluster
factory: :cluster
before
(
:create
)
do
|
app
,
_
|
app
.
cluster
=
create
(
:cluster
)
end
end
trait
:installable
do
trait
:installable
do
cluster
cluster
...
...
spec/models/clusters/applications/helm_spec.rb
View file @
d89d514e
...
@@ -28,7 +28,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
...
@@ -28,7 +28,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
describe
'status state machine'
do
describe
'status state machine'
do
describe
'#make_installing'
do
describe
'#make_installing'
do
subject
{
create
(
:applications_helm
,
:scheduled
)
}
subject
{
create
(
:
cluster_
applications_helm
,
:scheduled
)
}
it
'is installing'
do
it
'is installing'
do
subject
.
make_installing!
subject
.
make_installing!
...
@@ -38,7 +38,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
...
@@ -38,7 +38,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
end
end
describe
'#make_installed'
do
describe
'#make_installed'
do
subject
{
create
(
:applications_helm
,
:installing
)
}
subject
{
create
(
:
cluster_
applications_helm
,
:installing
)
}
it
'is installed'
do
it
'is installed'
do
subject
.
make_installed
subject
.
make_installed
...
@@ -48,7 +48,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
...
@@ -48,7 +48,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
end
end
describe
'#make_errored'
do
describe
'#make_errored'
do
subject
{
create
(
:applications_helm
,
:installing
)
}
subject
{
create
(
:
cluster_
applications_helm
,
:installing
)
}
let
(
:reason
)
{
'some errors'
}
let
(
:reason
)
{
'some errors'
}
it
'is errored'
do
it
'is errored'
do
...
@@ -60,7 +60,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
...
@@ -60,7 +60,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
end
end
describe
'#make_scheduled'
do
describe
'#make_scheduled'
do
subject
{
create
(
:applications_helm
,
:installable
)
}
subject
{
create
(
:
cluster_
applications_helm
,
:installable
)
}
it
'is scheduled'
do
it
'is scheduled'
do
subject
.
make_scheduled
subject
.
make_scheduled
...
@@ -69,7 +69,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
...
@@ -69,7 +69,7 @@ RSpec.describe Clusters::Applications::Helm, type: :model do
end
end
describe
'when was errored'
do
describe
'when was errored'
do
subject
{
create
(
:applications_helm
,
:errored
)
}
subject
{
create
(
:
cluster_
applications_helm
,
:errored
)
}
it
'clears #status_reason'
do
it
'clears #status_reason'
do
expect
(
subject
.
status_reason
).
not_to
be_nil
expect
(
subject
.
status_reason
).
not_to
be_nil
...
...
spec/serializers/cluster_application_entity_spec.rb
View file @
d89d514e
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
ClusterApplicationEntity
do
describe
ClusterApplicationEntity
do
describe
'#as_json'
do
describe
'#as_json'
do
let
(
:application
)
{
build
(
:applications_helm
)
}
let
(
:application
)
{
build
(
:
cluster_
applications_helm
)
}
subject
{
described_class
.
new
(
application
).
as_json
}
subject
{
described_class
.
new
(
application
).
as_json
}
it
'has name'
do
it
'has name'
do
...
@@ -18,7 +18,7 @@ describe ClusterApplicationEntity do
...
@@ -18,7 +18,7 @@ describe ClusterApplicationEntity do
end
end
context
'when application is errored'
do
context
'when application is errored'
do
let
(
:application
)
{
build
(
:applications_helm
,
:errored
)
}
let
(
:application
)
{
build
(
:
cluster_
applications_helm
,
:errored
)
}
it
'has corresponded data'
do
it
'has corresponded data'
do
expect
(
subject
[
:status
]).
to
eq
(
:errored
)
expect
(
subject
[
:status
]).
to
eq
(
:errored
)
...
...
spec/services/clusters/applications/check_installation_progress_service_spec.rb
View file @
d89d514e
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Clusters
::
Applications
::
CheckInstallationProgressService
do
describe
Clusters
::
Applications
::
CheckInstallationProgressService
do
RESCHEDULE_PHASES
=
Gitlab
::
Kubernetes
::
Pod
::
PHASES
-
[
Gitlab
::
Kubernetes
::
Pod
::
SUCCEEDED
,
Gitlab
::
Kubernetes
::
Pod
::
FAILED
].
freeze
RESCHEDULE_PHASES
=
Gitlab
::
Kubernetes
::
Pod
::
PHASES
-
[
Gitlab
::
Kubernetes
::
Pod
::
SUCCEEDED
,
Gitlab
::
Kubernetes
::
Pod
::
FAILED
].
freeze
let
(
:application
)
{
create
(
:applications_helm
,
:installing
)
}
let
(
:application
)
{
create
(
:
cluster_
applications_helm
,
:installing
)
}
let
(
:service
)
{
described_class
.
new
(
application
)
}
let
(
:service
)
{
described_class
.
new
(
application
)
}
let
(
:phase
)
{
Gitlab
::
Kubernetes
::
Pod
::
UNKNOWN
}
let
(
:phase
)
{
Gitlab
::
Kubernetes
::
Pod
::
UNKNOWN
}
let
(
:errors
)
{
nil
}
let
(
:errors
)
{
nil
}
...
@@ -33,7 +33,7 @@ describe Clusters::Applications::CheckInstallationProgressService do
...
@@ -33,7 +33,7 @@ describe Clusters::Applications::CheckInstallationProgressService do
end
end
context
'when timeouted'
do
context
'when timeouted'
do
let
(
:application
)
{
create
(
:applications_helm
,
:timeouted
)
}
let
(
:application
)
{
create
(
:
cluster_
applications_helm
,
:timeouted
)
}
it_behaves_like
'a terminated installation'
it_behaves_like
'a terminated installation'
...
...
spec/services/clusters/applications/install_service_spec.rb
View file @
d89d514e
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Clusters
::
Applications
::
InstallService
do
describe
Clusters
::
Applications
::
InstallService
do
describe
'#execute'
do
describe
'#execute'
do
let
(
:application
)
{
create
(
:applications_helm
,
:scheduled
)
}
let
(
:application
)
{
create
(
:
cluster_
applications_helm
,
:scheduled
)
}
let
(
:service
)
{
described_class
.
new
(
application
)
}
let
(
:service
)
{
described_class
.
new
(
application
)
}
context
'when there are no errors'
do
context
'when there are no errors'
do
...
@@ -39,7 +39,7 @@ describe Clusters::Applications::InstallService do
...
@@ -39,7 +39,7 @@ describe Clusters::Applications::InstallService do
end
end
context
'when application cannot be persisted'
do
context
'when application cannot be persisted'
do
let
(
:application
)
{
build
(
:applications_helm
,
:scheduled
)
}
let
(
:application
)
{
build
(
:
cluster_
applications_helm
,
:scheduled
)
}
it
'make the application errored'
do
it
'make the application errored'
do
expect
(
application
).
to
receive
(
:make_installing!
).
once
.
and_raise
(
ActiveRecord
::
RecordInvalid
)
expect
(
application
).
to
receive
(
:make_installing!
).
once
.
and_raise
(
ActiveRecord
::
RecordInvalid
)
...
...
spec/services/clusters/applications/schedule_installation_service_spec.rb
View file @
d89d514e
...
@@ -32,7 +32,7 @@ describe Clusters::Applications::ScheduleInstallationService do
...
@@ -32,7 +32,7 @@ describe Clusters::Applications::ScheduleInstallationService do
end
end
context
'when installation is already in progress'
do
context
'when installation is already in progress'
do
let
(
:application
)
{
create
(
:applications_helm
,
:installing
)
}
let
(
:application
)
{
create
(
:
cluster_
applications_helm
,
:installing
)
}
let
(
:cluster
)
{
application
.
cluster
}
let
(
:cluster
)
{
application
.
cluster
}
it_behaves_like
'a failing service'
it_behaves_like
'a failing service'
...
...
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