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
ae9c8277
Commit
ae9c8277
authored
Jan 04, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for Manual configuration override and service activation synchronization
parent
72003273
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
spec/models/project_services/prometheus_service_spec.rb
spec/models/project_services/prometheus_service_spec.rb
+66
-0
No files found.
spec/models/project_services/prometheus_service_spec.rb
View file @
ae9c8277
...
...
@@ -264,4 +264,70 @@ describe PrometheusService, :use_clean_rails_memory_store_caching do
end
end
end
describe
'#synchronize_service_state! before_save callback'
do
context
'no clusters with prometheus are installed'
do
context
'when service is inactive'
do
before
do
service
.
active
=
false
end
it
'activates service when manual_configuration is enabled'
do
expect
{
service
.
update!
(
manual_configuration:
true
)
}.
to
change
{
service
.
active
}.
from
(
false
).
to
(
true
)
end
it
'keeps service inactive when manual_configuration is disabled'
do
expect
{
service
.
update!
(
manual_configuration:
false
)
}.
not_to
change
{
service
.
active
}.
from
(
false
)
end
end
context
'when service is active'
do
before
do
service
.
active
=
true
end
it
'keeps the service active when manual_configuration is enabled'
do
expect
{
service
.
update!
(
manual_configuration:
true
)
}.
not_to
change
{
service
.
active
}.
from
(
true
)
end
it
'inactivates the service when manual_configuration is disabled'
do
expect
{
service
.
update!
(
manual_configuration:
false
)
}.
to
change
{
service
.
active
}.
from
(
true
).
to
(
false
)
end
end
end
context
'with prometheus installed in the cluster'
do
before
do
allow
(
service
).
to
receive
(
:prometheus_installed?
).
and_return
(
true
)
end
context
'when service is inactive'
do
before
do
service
.
active
=
false
end
it
'activates service when manual_configuration is enabled'
do
expect
{
service
.
update!
(
manual_configuration:
true
)
}.
to
change
{
service
.
active
}.
from
(
false
).
to
(
true
)
end
it
'activates service when manual_configuration is disabled'
do
expect
{
service
.
update!
(
manual_configuration:
false
)
}.
to
change
{
service
.
active
}.
from
(
false
).
to
(
true
)
end
end
context
'when service is active'
do
before
do
service
.
active
=
true
end
it
'keeps service active when manual_configuration is enabled'
do
expect
{
service
.
update!
(
manual_configuration:
true
)
}.
not_to
change
{
service
.
active
}.
from
(
true
)
end
it
'keeps service active when manual_configuration is disabled'
do
expect
{
service
.
update!
(
manual_configuration:
false
)
}.
not_to
change
{
service
.
active
}.
from
(
true
)
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