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
c36d7842
Commit
c36d7842
authored
Nov 27, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aling shared_exmaples to "same behavior between KubernetesService and Platform::Kubernetes"
parent
53da3d97
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
37 additions
and
86 deletions
+37
-86
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
spec/controllers/projects/branches_controller_spec.rb
spec/controllers/projects/branches_controller_spec.rb
+3
-3
spec/features/auto_deploy_spec.rb
spec/features/auto_deploy_spec.rb
+3
-3
spec/features/projects/environments/environment_spec.rb
spec/features/projects/environments/environment_spec.rb
+3
-3
spec/features/projects/environments/environments_spec.rb
spec/features/projects/environments/environments_spec.rb
+3
-3
spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb
spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb
+3
-3
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+3
-3
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+3
-3
spec/models/clusters/platforms/kubernetes_spec.rb
spec/models/clusters/platforms/kubernetes_spec.rb
+0
-49
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+6
-6
spec/models/project_spec.rb
spec/models/project_spec.rb
+3
-3
spec/support/prometheus/additional_metrics_shared_examples.rb
.../support/prometheus/additional_metrics_shared_examples.rb
+3
-3
spec/workers/reactive_caching_worker_spec.rb
spec/workers/reactive_caching_worker_spec.rb
+3
-3
No files found.
app/views/projects/edit.html.haml
View file @
c36d7842
...
...
@@ -147,7 +147,7 @@
%ul
%li
Be careful. Renaming a project's repository can have unintended side effects.
%li
You will need to update your local repositories to point to the new location.
-
if
@project
.
deployment_platform
.
any
?
-
if
@project
.
deployment_platform
.
present
?
%li
Your deployment services will be broken, you will need to manually fix the services after renaming.
=
f
.
submit
'Rename project'
,
class:
"btn btn-warning"
-
if
can?
(
current_user
,
:change_namespace
,
@project
)
...
...
spec/controllers/projects/branches_controller_spec.rb
View file @
c36d7842
...
...
@@ -113,7 +113,7 @@ describe Projects::BranchesController do
expect
(
response
).
to
redirect_to
project_tree_path
(
project
,
branch
)
end
shared_examples
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
do
shared_examples
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
do
it
'redirects to autodeploy setup page'
do
result
=
{
status: :success
,
branch:
double
(
name:
branch
)
}
...
...
@@ -136,7 +136,7 @@ describe Projects::BranchesController do
project
.
services
<<
build
(
:kubernetes_service
)
end
it_behaves_like
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
end
context
'when user configured kubernetes from CI/CD > Clusters'
do
...
...
@@ -144,7 +144,7 @@ describe Projects::BranchesController do
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
end
it_behaves_like
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
end
end
...
...
spec/features/auto_deploy_spec.rb
View file @
c36d7842
...
...
@@ -4,7 +4,7 @@ describe 'Auto deploy' do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
shared_examples
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
do
shared_examples
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
do
context
'when no deployment service is active'
do
before
do
project
.
kubernetes_service
.
update!
(
active:
false
)
...
...
@@ -56,7 +56,7 @@ describe 'Auto deploy' do
sign_in
user
end
it_behaves_like
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
end
context
'when user configured kubernetes from CI/CD > Clusters'
do
...
...
@@ -66,6 +66,6 @@ describe 'Auto deploy' do
sign_in
user
end
it_behaves_like
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
end
end
spec/features/projects/environments/environment_spec.rb
View file @
c36d7842
...
...
@@ -101,7 +101,7 @@ feature 'Environment' do
end
context
'with terminal'
do
shared_examples
'
correct behavior with terminal
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
context
'for project master'
do
let
(
:role
)
{
:master
}
...
...
@@ -135,14 +135,14 @@ feature 'Environment' do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
,
:test_repo
)
}
it_behaves_like
'
correct behavior with terminal
'
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
'
correct behavior with terminal
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
end
...
...
spec/features/projects/environments/environments_spec.rb
View file @
c36d7842
...
...
@@ -208,7 +208,7 @@ feature 'Environments page', :js do
end
context
'when kubernetes terminal is available'
do
shared_examples
'
correct behavior with terminal
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
context
'for project master'
do
let
(
:role
)
{
:master
}
...
...
@@ -229,14 +229,14 @@ feature 'Environments page', :js do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
,
:test_repo
)
}
it_behaves_like
'
correct behavior with terminal
'
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
'
correct behavior with terminal
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
end
end
...
...
spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb
View file @
c36d7842
...
...
@@ -4,7 +4,7 @@ describe Gitlab::Ci::Build::Policy::Kubernetes do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
context
'when kubernetes service is active'
do
shared_examples
'
correct behavior for satisfied_by?
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
it
'is satisfied by a kubernetes pipeline'
do
expect
(
described_class
.
new
(
'active'
))
.
to
be_satisfied_by
(
pipeline
)
...
...
@@ -14,14 +14,14 @@ describe Gitlab::Ci::Build::Policy::Kubernetes do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior for satisfied_by?
'
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
'
correct behavior for satisfied_by?
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
end
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
c36d7842
...
...
@@ -178,7 +178,7 @@ module Gitlab
end
context
'when kubernetes is active'
do
shared_examples
'
correct behavior for kubernetes policy
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
it
'returns seeds for kubernetes dependent job'
do
seeds
=
subject
.
stage_seeds
(
pipeline
)
...
...
@@ -192,7 +192,7 @@ module Gitlab
let
(
:project
)
{
create
(
:kubernetes_project
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
it_behaves_like
'
correct behavior for kubernetes policy
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
context
'when user configured kubernetes from CI/CD > Clusters'
do
...
...
@@ -200,7 +200,7 @@ module Gitlab
let
(
:project
)
{
cluster
.
project
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
it_behaves_like
'
correct behavior for kubernetes policy
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
end
...
...
spec/models/ci/pipeline_spec.rb
View file @
c36d7842
...
...
@@ -557,7 +557,7 @@ describe Ci::Pipeline, :mailer do
describe
'#has_kubernetes_active?'
do
context
'when kubernetes is active'
do
shared_examples
'
correct behavior with has_kubernetes_active?
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
it
'returns true'
do
expect
(
pipeline
).
to
have_kubernetes_active
end
...
...
@@ -566,14 +566,14 @@ describe Ci::Pipeline, :mailer do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior with has_kubernetes_active?
'
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
'
correct behavior with has_kubernetes_active?
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
end
...
...
spec/models/clusters/platforms/kubernetes_spec.rb
View file @
c36d7842
...
...
@@ -92,55 +92,6 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
end
end
describe
'after_save from Clusters::Cluster'
do
# context 'when platform_kubernetes is being cerated' do
# let(:enabled) { true }
# let(:project) { create(:project) }
# let(:cluster) { build(:cluster, provider_type: :gcp, platform_type: :kubernetes, platform_kubernetes: platform, provider_gcp: provider, enabled: enabled, projects: [project]) }
# let(:platform) { build(:cluster_platform_kubernetes, :configured) }
# let(:provider) { build(:cluster_provider_gcp) }
# let(:kubernetes_service) { project.kubernetes_service }
# it 'updates KubernetesService' do
# cluster.save!
# expect(kubernetes_service.active).to eq(enabled)
# expect(kubernetes_service.api_url).to eq(platform.api_url)
# expect(kubernetes_service.namespace).to eq(platform.namespace)
# expect(kubernetes_service.ca_pem).to eq(platform.ca_cert)
# end
# end
# context 'when platform_kubernetes has been created' do
# let(:enabled) { false }
# let!(:project) { create(:project) }
# let!(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
# let(:platform) { cluster.platform }
# let(:kubernetes_service) { project.kubernetes_service }
# it 'updates KubernetesService' do
# cluster.update(enabled: enabled)
# expect(kubernetes_service.active).to eq(enabled)
# end
# end
# context 'when kubernetes_service has been configured without cluster integration' do
# let!(:project) { create(:project) }
# let(:cluster) { build(:cluster, provider_type: :gcp, platform_type: :kubernetes, platform_kubernetes: platform, provider_gcp: provider, projects: [project]) }
# let(:platform) { build(:cluster_platform_kubernetes, :configured, api_url: 'https://111.111.111.111') }
# let(:provider) { build(:cluster_provider_gcp) }
# before do
# create(:kubernetes_service, project: project)
# end
# it 'raises an error' do
# expect { cluster.save! }.to raise_error('Kubernetes service already configured')
# end
# end
end
describe
'#actual_namespace'
do
subject
{
kubernetes
.
actual_namespace
}
...
...
spec/models/environment_spec.rb
View file @
c36d7842
...
...
@@ -327,7 +327,7 @@ describe Environment do
context
'when the enviroment is available'
do
context
'with a deployment service'
do
shared_examples
'
correct behavior for has_terminals?
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
context
'and a deployment'
do
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
)
}
it
{
is_expected
.
to
be_truthy
}
...
...
@@ -341,14 +341,14 @@ describe Environment do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior for has_terminals?
'
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
'
correct behavior for has_terminals?
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
end
end
...
...
@@ -376,7 +376,7 @@ describe Environment do
allow
(
environment
).
to
receive
(
:has_terminals?
).
and_return
(
true
)
end
shared_examples
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
do
shared_examples
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
do
it
'returns the terminals from the deployment service'
do
expect
(
project
.
deployment_platform
)
.
to
receive
(
:terminals
).
with
(
environment
)
...
...
@@ -389,14 +389,14 @@ describe Environment do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n 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
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
end
end
...
...
spec/models/project_spec.rb
View file @
c36d7842
...
...
@@ -2002,7 +2002,7 @@ describe Project do
end
context
'when project has a deployment service'
do
shared_examples
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
do
shared_examples
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
do
it
'returns variables from this service'
do
expect
(
project
.
deployment_variables
).
to
include
(
{
key:
'KUBE_TOKEN'
,
value:
project
.
deployment_platform
.
token
,
public:
false
}
...
...
@@ -2013,14 +2013,14 @@ describe Project do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n 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
'
correct behavior o
n KubernetesService and Platform::Kubernetes'
it_behaves_like
'
same behavior betwee
n KubernetesService and Platform::Kubernetes'
end
end
end
...
...
spec/support/prometheus/additional_metrics_shared_examples.rb
View file @
c36d7842
...
...
@@ -41,7 +41,7 @@ RSpec.shared_examples 'additional metrics query' do
end
describe
'project has Kubernetes service'
do
shared_examples
'
correct behavior with metric
s'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernete
s'
do
let
(
:environment
)
{
create
(
:environment
,
slug:
'environment-slug'
,
project:
project
)
}
let
(
:kube_namespace
)
{
project
.
deployment_platform
.
actual_namespace
}
...
...
@@ -57,14 +57,14 @@ RSpec.shared_examples 'additional metrics query' do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior with metric
s'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernete
s'
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 metric
s'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernete
s'
end
end
...
...
spec/workers/reactive_caching_worker_spec.rb
View file @
c36d7842
...
...
@@ -5,7 +5,7 @@ describe ReactiveCachingWorker do
subject
{
described_class
.
new
.
perform
(
"KubernetesService"
,
service
.
id
)
}
describe
'#perform'
do
shared_examples
'
correct behavior with perform
'
do
shared_examples
'
same behavior between KubernetesService and Platform::Kubernetes
'
do
it
'calls #exclusively_update_reactive_cache!'
do
expect_any_instance_of
(
KubernetesService
).
to
receive
(
:exclusively_update_reactive_cache!
)
...
...
@@ -16,14 +16,14 @@ describe ReactiveCachingWorker do
context
'when user configured kubernetes from Integration > Kubernetes'
do
let
(
:project
)
{
create
(
:kubernetes_project
)
}
it_behaves_like
'
correct behavior with perform
'
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
'
correct behavior with perform
'
it_behaves_like
'
same behavior between KubernetesService and Platform::Kubernetes
'
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