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
8fc9ff7f
Commit
8fc9ff7f
authored
Apr 06, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix environment deployment platform filter method
parent
2faf991f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
2 deletions
+28
-2
app/models/environment.rb
app/models/environment.rb
+1
-1
lib/gitlab/prometheus/queries/query_additional_metrics.rb
lib/gitlab/prometheus/queries/query_additional_metrics.rb
+1
-1
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+26
-0
No files found.
app/models/environment.rb
View file @
8fc9ff7f
...
...
@@ -224,7 +224,7 @@ class Environment < ActiveRecord::Base
end
def
deployment_platform
project
.
deployment_platform
(
environment:
self
)
project
.
deployment_platform
(
environment:
self
.
name
)
end
private
...
...
lib/gitlab/prometheus/queries/query_additional_metrics.rb
View file @
8fc9ff7f
...
...
@@ -79,7 +79,7 @@ module Gitlab
def
common_query_context
(
environment
,
timeframe_start
:,
timeframe_end
:)
base_query_context
(
timeframe_start
,
timeframe_end
).
merge
({
ci_environment_slug:
environment
.
slug
,
kube_namespace:
environment
.
project
.
deployment_platform
&
.
actual_namespace
||
''
,
kube_namespace:
environment
.
deployment_platform
&
.
actual_namespace
||
''
,
environment_filter:
%{container_name!="POD",environment="#{environment.slug}"}
})
end
...
...
spec/models/environment_spec.rb
View file @
8fc9ff7f
...
...
@@ -368,6 +368,32 @@ describe Environment do
end
end
describe
'#deployment_platform'
do
context
'when there is a deployment platform for environment'
do
let!
(
:cluster
)
do
create
(
:cluster
,
:provided_by_gcp
,
environment_scope:
'*'
,
projects:
[
project
])
end
it
'finds a deployment platform'
do
expect
(
environment
.
deployment_platform
).
to
eq
cluster
.
platform
end
end
context
'when there is no deployment platform for environment'
do
it
'returns nil'
do
expect
(
environment
.
deployment_platform
).
to
be_nil
end
end
it
'checks deployment platforms associated with a project'
do
expect
(
project
).
to
receive
(
:deployment_platform
)
.
with
(
environment:
environment
.
name
)
environment
.
deployment_platform
end
end
describe
'#terminals'
do
subject
{
environment
.
terminals
}
...
...
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