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
1d7e3ef1
Commit
1d7e3ef1
authored
Nov 27, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duplicate spec for Platform::Kubernetes with kubernetes_project
parent
5324383d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
44 deletions
+102
-44
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+28
-24
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+21
-7
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+16
-3
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+19
-6
spec/workers/reactive_caching_worker_spec.rb
spec/workers/reactive_caching_worker_spec.rb
+18
-4
No files found.
spec/controllers/projects/branches_controller_spec.rb
View file @
1d7e3ef1
...
@@ -113,6 +113,7 @@ describe Projects::BranchesController do
...
@@ -113,6 +113,7 @@ describe Projects::BranchesController do
expect
(
response
).
to
redirect_to
project_tree_path
(
project
,
branch
)
expect
(
response
).
to
redirect_to
project_tree_path
(
project
,
branch
)
end
end
context
'when user configured kubernetes from Integration > Kubernetes'
do
it
'redirects to autodeploy setup page'
do
it
'redirects to autodeploy setup page'
do
result
=
{
status: :success
,
branch:
double
(
name:
branch
)
}
result
=
{
status: :success
,
branch:
double
(
name:
branch
)
}
...
@@ -130,7 +131,9 @@ describe Projects::BranchesController do
...
@@ -130,7 +131,9 @@ describe Projects::BranchesController do
expect
(
response
.
location
).
to
include
(
project_new_blob_path
(
project
,
branch
))
expect
(
response
.
location
).
to
include
(
project_new_blob_path
(
project
,
branch
))
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
end
end
end
context
'when user configured kubernetes from CI/CD > Clusters'
do
it
'redirects to autodeploy setup page'
do
it
'redirects to autodeploy setup page'
do
result
=
{
status: :success
,
branch:
double
(
name:
branch
)
}
result
=
{
status: :success
,
branch:
double
(
name:
branch
)
}
...
@@ -149,6 +152,7 @@ describe Projects::BranchesController do
...
@@ -149,6 +152,7 @@ describe Projects::BranchesController do
expect
(
response
).
to
have_gitlab_http_status
(
302
)
expect
(
response
).
to
have_gitlab_http_status
(
302
)
end
end
end
end
end
context
'without issue feature access'
do
context
'without issue feature access'
do
before
do
before
do
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
1d7e3ef1
...
@@ -178,9 +178,7 @@ module Gitlab
...
@@ -178,9 +178,7 @@ module Gitlab
end
end
context
'when kubernetes is active'
do
context
'when kubernetes is active'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
shared_examples
'correct behavior for kubernetes policy'
do
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
it
'returns seeds for kubernetes dependent job'
do
it
'returns seeds for kubernetes dependent job'
do
seeds
=
subject
.
stage_seeds
(
pipeline
)
seeds
=
subject
.
stage_seeds
(
pipeline
)
...
@@ -190,6 +188,22 @@ module Gitlab
...
@@ -190,6 +188,22 @@ module Gitlab
end
end
end
end
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
it_behaves_like
'correct behavior for kubernetes policy'
end
context
'when user configured kubernetes from CI/CD > Clusters'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:project
,
:provided_by_gcp
)
}
let
(
:project
)
{
cluster
.
project
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
it_behaves_like
'correct behavior for kubernetes policy'
end
end
context
'when kubernetes is not active'
do
context
'when kubernetes is not active'
do
it
'does not return seeds for kubernetes dependent job'
do
it
'does not return seeds for kubernetes dependent job'
do
seeds
=
subject
.
stage_seeds
(
pipeline
)
seeds
=
subject
.
stage_seeds
(
pipeline
)
...
...
spec/models/ci/pipeline_spec.rb
View file @
1d7e3ef1
...
@@ -557,13 +557,26 @@ describe Ci::Pipeline, :mailer do
...
@@ -557,13 +557,26 @@ describe Ci::Pipeline, :mailer do
describe
'#has_kubernetes_active?'
do
describe
'#has_kubernetes_active?'
do
context
'when kubernetes is active'
do
context
'when kubernetes is active'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
shared_examples
'correct behavior with has_kubernetes_active?'
do
it
'returns true'
do
it
'returns true'
do
expect
(
pipeline
).
to
have_kubernetes_active
expect
(
pipeline
).
to
have_kubernetes_active
end
end
end
end
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'correct behavior with has_kubernetes_active?'
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
'correct behavior with has_kubernetes_active?'
end
end
context
'when kubernetes is not active'
do
context
'when kubernetes is not active'
do
it
'returns false'
do
it
'returns false'
do
expect
(
pipeline
).
not_to
have_kubernetes_active
expect
(
pipeline
).
not_to
have_kubernetes_active
...
...
spec/models/environment_spec.rb
View file @
1d7e3ef1
...
@@ -327,8 +327,7 @@ describe Environment do
...
@@ -327,8 +327,7 @@ describe Environment do
context
'when the enviroment is available'
do
context
'when the enviroment is available'
do
context
'with a deployment service'
do
context
'with a deployment service'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
shared_examples
'correct behavior for has_terminals?'
do
context
'and a deployment'
do
context
'and a deployment'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
be_truthy
}
...
@@ -339,6 +338,20 @@ describe Environment do
...
@@ -339,6 +338,20 @@ describe Environment do
end
end
end
end
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'correct behavior for has_terminals?'
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
'correct behavior for has_terminals?'
end
end
context
'without a deployment service'
do
context
'without a deployment service'
do
it
{
is_expected
.
to
be_falsy
}
it
{
is_expected
.
to
be_falsy
}
end
end
...
...
spec/workers/reactive_caching_worker_spec.rb
View file @
1d7e3ef1
require
'spec_helper'
require
'spec_helper'
describe
ReactiveCachingWorker
do
describe
ReactiveCachingWorker
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
let
(
:service
)
{
project
.
deployment_service
}
let
(
:service
)
{
project
.
deployment_service
}
subject
{
described_class
.
new
.
perform
(
"KubernetesService"
,
service
.
id
)
}
subject
{
described_class
.
new
.
perform
(
"KubernetesService"
,
service
.
id
)
}
describe
'#perform'
do
describe
'#perform'
do
shared_examples
'correct behavior with perform'
do
it
'calls #exclusively_update_reactive_cache!'
do
it
'calls #exclusively_update_reactive_cache!'
do
expect_any_instance_of
(
KubernetesService
).
to
receive
(
:exclusively_update_reactive_cache!
)
expect_any_instance_of
(
KubernetesService
).
to
receive
(
:exclusively_update_reactive_cache!
)
subject
subject
end
end
end
end
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'correct behavior with perform'
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
'correct behavior with perform'
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