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
f6d9dcf8
Commit
f6d9dcf8
authored
Nov 27, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unit tests
parent
c36d7842
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
12 deletions
+15
-12
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+3
-1
spec/models/project_services/kubernetes_service_spec.rb
spec/models/project_services/kubernetes_service_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+2
-0
spec/workers/reactive_caching_worker_spec.rb
spec/workers/reactive_caching_worker_spec.rb
+9
-10
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
f6d9dcf8
...
...
@@ -6,7 +6,7 @@ module Clusters
include
ReactiveCaching
self
.
table_name
=
'cluster_platforms_kubernetes'
self
.
reactive_cache_key
=
->
(
kubernetes
)
{
[
kubernetes
.
class
.
model_name
.
singular
,
kubernetes
.
cluster_
id
]
}
self
.
reactive_cache_key
=
->
(
kubernetes
)
{
[
kubernetes
.
class
.
model_name
.
singular
,
kubernetes
.
id
]
}
belongs_to
:cluster
,
inverse_of: :platform_kubernetes
,
class_name:
'Clusters::Cluster'
...
...
@@ -41,6 +41,8 @@ module Clusters
delegate
:project
,
to: :cluster
,
allow_nil:
true
delegate
:enabled?
,
to: :cluster
,
allow_nil:
true
alias_method
:active?
,
:enabled?
def
actual_namespace
if
namespace
.
present?
namespace
...
...
spec/models/project_services/kubernetes_service_spec.rb
View file @
f6d9dcf8
...
...
@@ -4,7 +4,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
include
KubernetesHelpers
include
ReactiveCachingHelpers
let
(
:project
)
{
build_stubbed
(
:kubernetes_project
)
}
let
(
:project
)
{
create
(
:kubernetes_project
)
}
let
(
:service
)
{
project
.
deployment_platform
}
describe
'Associations'
do
...
...
spec/models/project_spec.rb
View file @
f6d9dcf8
...
...
@@ -3100,6 +3100,8 @@ describe Project do
describe
'#deployment_platform'
do
subject
{
project
.
deployment_platform
}
let
(
:project
)
{
create
(
:project
)
}
context
'when user configured kubernetes from Integration > Kubernetes'
do
let!
(
:kubernetes_service
)
{
create
(
:kubernetes_service
,
project:
project
)
}
...
...
spec/workers/reactive_caching_worker_spec.rb
View file @
f6d9dcf8
...
...
@@ -2,28 +2,27 @@ require 'spec_helper'
describe
ReactiveCachingWorker
do
let
(
:service
)
{
project
.
deployment_platform
}
subject
{
described_class
.
new
.
perform
(
"KubernetesService"
,
service
.
id
)
}
describe
'#perform'
do
shared_examples
'same behavior between KubernetesService and Platform::Kubernetes'
do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it
'calls #exclusively_update_reactive_cache!'
do
expect_any_instance_of
(
KubernetesService
).
to
receive
(
:exclusively_update_reactive_cache!
)
subject
described_class
.
new
.
perform
(
"KubernetesService"
,
service
.
id
)
end
end
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'same behavior between KubernetesService and Platform::Kubernetes'
end
context
'when user configured kubernetes from CI/CD > Clusters'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:project
,
:provided_by_gcp
)
}
let
(
:project
)
{
cluster
.
project
}
it_behaves_like
'same behavior between KubernetesService and Platform::Kubernetes'
it
'calls #exclusively_update_reactive_cache!'
do
expect_any_instance_of
(
Clusters
::
Platforms
::
Kubernetes
).
to
receive
(
:exclusively_update_reactive_cache!
)
described_class
.
new
.
perform
(
"Clusters::Platforms::Kubernetes"
,
service
.
id
)
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