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
024ddcab
Commit
024ddcab
authored
Apr 15, 2019
by
Thong Kuah
Committed by
Stan Hu
Apr 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deactivate any prometheus_service upon destroy
Basically does the reverse of after_transition to :installed.
parent
eae0fc2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
app/models/clusters/applications/prometheus.rb
app/models/clusters/applications/prometheus.rb
+8
-0
spec/models/clusters/applications/prometheus_spec.rb
spec/models/clusters/applications/prometheus_spec.rb
+17
-0
No files found.
app/models/clusters/applications/prometheus.rb
View file @
024ddcab
...
...
@@ -16,6 +16,8 @@ module Clusters
default_value_for
:version
,
VERSION
after_destroy
:disable_prometheus_integration
state_machine
:status
do
after_transition
any
=>
[
:installed
]
do
|
application
|
application
.
cluster
.
projects
.
each
do
|
project
|
...
...
@@ -90,6 +92,12 @@ module Clusters
private
def
disable_prometheus_integration
cluster
.
projects
.
each
do
|
project
|
project
.
prometheus_service
&
.
update
(
active:
false
)
end
end
def
kube_client
cluster
&
.
kubeclient
&
.
core_client
end
...
...
spec/models/clusters/applications/prometheus_spec.rb
View file @
024ddcab
...
...
@@ -11,6 +11,23 @@ describe Clusters::Applications::Prometheus do
include_examples
'cluster application helm specs'
,
:clusters_applications_prometheus
include_examples
'cluster application initial status specs'
describe
'after_destroy'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:with_installed_helm
,
projects:
[
project
])
}
let!
(
:application
)
{
create
(
:clusters_applications_prometheus
,
:installed
,
cluster:
cluster
)
}
let!
(
:prometheus_service
)
{
project
.
create_prometheus_service
(
active:
true
)
}
it
'deactivates prometheus_service after destroy'
do
expect
do
application
.
destroy
prometheus_service
.
reload
end
.
to
change
(
prometheus_service
,
:active
)
expect
(
prometheus_service
).
not_to
be_active
end
end
describe
'transition to installed'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:with_installed_helm
,
projects:
[
project
])
}
...
...
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