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
3c5c6c2c
Commit
3c5c6c2c
authored
Sep 12, 2018
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address BE review - re-arrange some specs
parent
6cba2698
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
spec/services/clusters/gcp/kubernetes/create_service_account_service_spec.rb
...ers/gcp/kubernetes/create_service_account_service_spec.rb
+3
-2
spec/services/clusters/gcp/kubernetes/fetch_kubernetes_token_service_spec.rb
...ers/gcp/kubernetes/fetch_kubernetes_token_service_spec.rb
+4
-2
spec/support/services/clusters/create_service_shared.rb
spec/support/services/clusters/create_service_shared.rb
+2
-1
No files found.
spec/services/clusters/gcp/kubernetes/create_service_account_service_spec.rb
View file @
3c5c6c2c
...
@@ -8,12 +8,11 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
...
@@ -8,12 +8,11 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
let
(
:service
)
{
described_class
.
new
(
kubeclient
,
rbac:
rbac
)
}
let
(
:service
)
{
described_class
.
new
(
kubeclient
,
rbac:
rbac
)
}
describe
'#execute'
do
describe
'#execute'
do
subject
{
service
.
execute
}
let
(
:rbac
)
{
false
}
let
(
:rbac
)
{
false
}
let
(
:api_url
)
{
'http://111.111.111.111'
}
let
(
:api_url
)
{
'http://111.111.111.111'
}
let
(
:username
)
{
'admin'
}
let
(
:username
)
{
'admin'
}
let
(
:password
)
{
'xxx'
}
let
(
:password
)
{
'xxx'
}
let
(
:kubeclient
)
do
let
(
:kubeclient
)
do
Gitlab
::
Kubernetes
::
KubeClient
.
new
(
Gitlab
::
Kubernetes
::
KubeClient
.
new
(
api_url
,
api_url
,
...
@@ -22,6 +21,8 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
...
@@ -22,6 +21,8 @@ describe Clusters::Gcp::Kubernetes::CreateServiceAccountService do
)
)
end
end
subject
{
service
.
execute
}
context
'when params are correct'
do
context
'when params are correct'
do
before
do
before
do
stub_kubeclient_discover
(
api_url
)
stub_kubeclient_discover
(
api_url
)
...
...
spec/services/clusters/gcp/kubernetes/fetch_kubernetes_token_service_spec.rb
View file @
3c5c6c2c
# frozen_string_literal: true
require
'fast_spec_helper'
require
'fast_spec_helper'
describe
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
do
describe
Clusters
::
Gcp
::
Kubernetes
::
FetchKubernetesTokenService
do
describe
'#execute'
do
describe
'#execute'
do
subject
{
described_class
.
new
(
kubeclient
).
execute
}
let
(
:api_url
)
{
'http://111.111.111.111'
}
let
(
:api_url
)
{
'http://111.111.111.111'
}
let
(
:username
)
{
'admin'
}
let
(
:username
)
{
'admin'
}
let
(
:password
)
{
'xxx'
}
let
(
:password
)
{
'xxx'
}
...
@@ -16,6 +16,8 @@ describe Clusters::Gcp::Kubernetes::FetchKubernetesTokenService do
...
@@ -16,6 +16,8 @@ describe Clusters::Gcp::Kubernetes::FetchKubernetesTokenService do
)
)
end
end
subject
{
described_class
.
new
(
kubeclient
).
execute
}
context
'when params correct'
do
context
'when params correct'
do
let
(
:decoded_token
)
{
'xxx.token.xxx'
}
let
(
:decoded_token
)
{
'xxx.token.xxx'
}
let
(
:token
)
{
Base64
.
encode64
(
decoded_token
)
}
let
(
:token
)
{
Base64
.
encode64
(
decoded_token
)
}
...
...
spec/support/services/clusters/create_service_shared.rb
View file @
3c5c6c2c
...
@@ -32,10 +32,11 @@ end
...
@@ -32,10 +32,11 @@ end
shared_examples
'create cluster service success'
do
shared_examples
'create cluster service success'
do
before
do
before
do
stub_feature_flags
(
rbac_clusters:
false
)
stub_feature_flags
(
rbac_clusters:
false
)
expect
(
ClusterProvisionWorker
).
to
receive
(
:perform_async
)
end
end
it
'creates a cluster object and performs a worker'
do
it
'creates a cluster object and performs a worker'
do
expect
(
ClusterProvisionWorker
).
to
receive
(
:perform_async
)
expect
{
subject
}
expect
{
subject
}
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
.
to
change
{
Clusters
::
Cluster
.
count
}.
by
(
1
)
.
and
change
{
Clusters
::
Providers
::
Gcp
.
count
}.
by
(
1
)
.
and
change
{
Clusters
::
Providers
::
Gcp
.
count
}.
by
(
1
)
...
...
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