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
Léo-Paul Géneau
gitlab-ce
Commits
6cba2698
Commit
6cba2698
authored
Sep 12, 2018
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature spec when FF is enabled
parent
0dc9a52a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
46 deletions
+61
-46
spec/features/projects/clusters/gcp_spec.rb
spec/features/projects/clusters/gcp_spec.rb
+33
-19
spec/features/projects/clusters/user_spec.rb
spec/features/projects/clusters/user_spec.rb
+28
-27
No files found.
spec/features/projects/clusters/gcp_spec.rb
View file @
6cba2698
...
@@ -33,6 +33,32 @@ describe 'Gcp Cluster', :js do
...
@@ -33,6 +33,32 @@ describe 'Gcp Cluster', :js do
context
'when user filled form with valid parameters'
do
context
'when user filled form with valid parameters'
do
subject
{
click_button
'Create Kubernetes cluster'
}
subject
{
click_button
'Create Kubernetes cluster'
}
shared_examples
'valid cluster gcp form'
do
it
'users sees a form with the GCP token'
do
expect
(
page
).
to
have_selector
(
:css
,
'form[data-token="token"]'
)
end
it
'user sees a cluster details page and creation status'
do
subject
expect
(
page
).
to
have_content
(
'Kubernetes cluster is being created on Google Kubernetes Engine...'
)
Clusters
::
Cluster
.
last
.
provider
.
make_created!
expect
(
page
).
to
have_content
(
'Kubernetes cluster was successfully created on Google Kubernetes Engine'
)
end
it
'user sees a error if something wrong during creation'
do
subject
expect
(
page
).
to
have_content
(
'Kubernetes cluster is being created on Google Kubernetes Engine...'
)
Clusters
::
Cluster
.
last
.
provider
.
make_errored!
(
'Something wrong!'
)
expect
(
page
).
to
have_content
(
'Something wrong!'
)
end
end
before
do
before
do
allow_any_instance_of
(
GoogleApi
::
CloudPlatform
::
Client
)
allow_any_instance_of
(
GoogleApi
::
CloudPlatform
::
Client
)
.
to
receive
(
:projects_zones_clusters_create
)
do
.
to
receive
(
:projects_zones_clusters_create
)
do
...
@@ -56,28 +82,16 @@ describe 'Gcp Cluster', :js do
...
@@ -56,28 +82,16 @@ describe 'Gcp Cluster', :js do
fill_in
'cluster[provider_gcp_attributes][machine_type]'
,
with:
'n1-standard-2'
fill_in
'cluster[provider_gcp_attributes][machine_type]'
,
with:
'n1-standard-2'
end
end
it
'users sees a form with the GCP token'
do
it_behaves_like
'valid cluster gcp form'
expect
(
page
).
to
have_selector
(
:css
,
'form[data-token="token"]'
)
end
it
'user sees a cluster details page and creation status'
do
subject
expect
(
page
).
to
have_content
(
'Kubernetes cluster is being created on Google Kubernetes Engine...'
)
Clusters
::
Cluster
.
last
.
provider
.
make_created!
context
'rbac_clusters feature flag is enabled'
do
before
do
stub_feature_flags
(
rbac_clusters:
true
)
expect
(
page
).
to
have_content
(
'Kubernetes cluster was successfully created on Google Kubernetes Engine'
)
check
'cluster_provider_gcp_attributes_legacy_abac'
end
end
it
'user sees a error if something wrong during creation'
do
it_behaves_like
'valid cluster gcp form'
subject
expect
(
page
).
to
have_content
(
'Kubernetes cluster is being created on Google Kubernetes Engine...'
)
Clusters
::
Cluster
.
last
.
provider
.
make_errored!
(
'Something wrong!'
)
expect
(
page
).
to
have_content
(
'Something wrong!'
)
end
end
end
end
...
...
spec/features/projects/clusters/user_spec.rb
View file @
6cba2698
...
@@ -21,14 +21,10 @@ describe 'User Cluster', :js do
...
@@ -21,14 +21,10 @@ describe 'User Cluster', :js do
end
end
context
'when user filled form with valid parameters'
do
context
'when user filled form with valid parameters'
do
before
do
shared_examples
'valid cluster user form'
do
fill_in
'cluster_name'
,
with:
'dev-cluster'
fill_in
'cluster_platform_kubernetes_attributes_api_url'
,
with:
'http://example.com'
fill_in
'cluster_platform_kubernetes_attributes_token'
,
with:
'my-token'
click_button
'Add Kubernetes cluster'
end
it
'user sees a cluster details page'
do
it
'user sees a cluster details page'
do
subject
expect
(
page
).
to
have_content
(
'Kubernetes cluster integration'
)
expect
(
page
).
to
have_content
(
'Kubernetes cluster integration'
)
expect
(
page
.
find_field
(
'cluster[name]'
).
value
).
to
eq
(
'dev-cluster'
)
expect
(
page
.
find_field
(
'cluster[name]'
).
value
).
to
eq
(
'dev-cluster'
)
expect
(
page
.
find_field
(
'cluster[platform_kubernetes_attributes][api_url]'
).
value
)
expect
(
page
.
find_field
(
'cluster[platform_kubernetes_attributes][api_url]'
).
value
)
...
@@ -38,27 +34,32 @@ describe 'User Cluster', :js do
...
@@ -38,27 +34,32 @@ describe 'User Cluster', :js do
end
end
end
end
context
'rbac_clusters feature flag is enabled'
do
before
do
before
do
stub_feature_flags
(
rbac_clusters:
true
)
fill_in
'cluster_name'
,
with:
'dev-cluster'
fill_in
'cluster_name'
,
with:
'dev-cluster'
fill_in
'cluster_platform_kubernetes_attributes_api_url'
,
with:
'http://example.com'
fill_in
'cluster_platform_kubernetes_attributes_api_url'
,
with:
'http://example.com'
fill_in
'cluster_platform_kubernetes_attributes_token'
,
with:
'my-token'
fill_in
'cluster_platform_kubernetes_attributes_token'
,
with:
'my-token'
end
subject
{
click_button
'Add Kubernetes cluster'
}
it_behaves_like
'valid cluster user form'
context
'rbac_clusters feature flag is enabled'
do
before
do
stub_feature_flags
(
rbac_clusters:
true
)
check
'cluster_platform_kubernetes_attributes_authorization_type'
check
'cluster_platform_kubernetes_attributes_authorization_type'
click_button
'Add Kubernetes cluster'
end
end
it
'user sees a cluster details page'
do
it_behaves_like
'valid cluster user form'
expect
(
page
).
to
have_content
(
'Kubernetes cluster integration'
)
expect
(
page
.
find_field
(
'cluster[name]'
).
value
).
to
eq
(
'dev-cluster'
)
it
'user sees a cluster details page with RBAC enabled'
do
expect
(
page
.
find_field
(
'cluster[platform_kubernetes_attributes][api_url]'
).
value
)
subject
.
to
have_content
(
'http://example.com'
)
expect
(
page
.
find_field
(
'cluster[platform_kubernetes_attributes][token]'
).
value
)
.
to
have_content
(
'my-token'
)
expect
(
page
.
find_field
(
'cluster[platform_kubernetes_attributes][authorization_type]'
,
disabled:
true
)).
to
be_checked
expect
(
page
.
find_field
(
'cluster[platform_kubernetes_attributes][authorization_type]'
,
disabled:
true
)).
to
be_checked
end
end
end
end
end
context
'when user filled form with invalid parameters'
do
context
'when user filled form with invalid parameters'
do
before
do
before
do
...
...
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