diff options
-rw-r--r-- | app/views/projects/edit.html.haml | 2 | ||||
-rw-r--r-- | spec/controllers/projects/branches_controller_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/auto_deploy_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/projects/environments/environment_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/projects/environments/environments_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/yaml_processor_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 6 | ||||
-rw-r--r-- | spec/models/clusters/platforms/kubernetes_spec.rb | 49 | ||||
-rw-r--r-- | spec/models/environment_spec.rb | 12 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/prometheus/additional_metrics_shared_examples.rb | 6 | ||||
-rw-r--r-- | spec/workers/reactive_caching_worker_spec.rb | 6 |
13 files changed, 37 insertions, 86 deletions
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index 52be8330813..71206f3a386 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -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) diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 91f8210964e..d731200f70f 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -113,7 +113,7 @@ describe Projects::BranchesController do expect(response).to redirect_to project_tree_path(project, branch) end - shared_examples 'correct behavior on KubernetesService and Platform::Kubernetes' do + shared_examples 'same behavior between 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 on KubernetesService and Platform::Kubernetes' + it_behaves_like 'same behavior between 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 on KubernetesService and Platform::Kubernetes' + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb index 240c5711a7b..453b31e0d77 100644 --- a/spec/features/auto_deploy_spec.rb +++ b/spec/features/auto_deploy_spec.rb @@ -4,7 +4,7 @@ describe 'Auto deploy' do let(:user) { create(:user) } let(:project) { create(:project, :repository) } - shared_examples 'correct behavior on KubernetesService and Platform::Kubernetes' do + shared_examples 'same behavior between 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 on KubernetesService and Platform::Kubernetes' + it_behaves_like 'same behavior between 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 on KubernetesService and Platform::Kubernetes' + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 3d64b404a84..dfcf97ad495 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -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 diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 1732d7f2a9f..8a7c9766f9e 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -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 diff --git a/spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb b/spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb index 3c143f5305b..4884d5f8ba4 100644 --- a/spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb +++ b/spec/lib/gitlab/ci/build/policy/kubernetes_spec.rb @@ -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 diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index 4f44f35205e..98880fe9f28 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -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 diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index c53942ed61c..4cf0088ac9c 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -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 diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index 7c5a17a4e95..53a4e545ff6 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -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 } diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb index dc71cf16f54..6f24a039998 100644 --- a/spec/models/environment_spec.rb +++ b/spec/models/environment_spec.rb @@ -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 on KubernetesService and Platform::Kubernetes' do + shared_examples 'same behavior between 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 on KubernetesService and Platform::Kubernetes' + 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 on KubernetesService and Platform::Kubernetes' + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index a28b15c9d7b..41483a8a05e 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2002,7 +2002,7 @@ describe Project do end context 'when project has a deployment service' do - shared_examples 'correct behavior on KubernetesService and Platform::Kubernetes' do + shared_examples 'same behavior between 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 on KubernetesService and Platform::Kubernetes' + 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 on KubernetesService and Platform::Kubernetes' + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end end diff --git a/spec/support/prometheus/additional_metrics_shared_examples.rb b/spec/support/prometheus/additional_metrics_shared_examples.rb index f3338259a77..dbbd4ad4d40 100644 --- a/spec/support/prometheus/additional_metrics_shared_examples.rb +++ b/spec/support/prometheus/additional_metrics_shared_examples.rb @@ -41,7 +41,7 @@ RSpec.shared_examples 'additional metrics query' do end describe 'project has Kubernetes service' do - shared_examples 'correct behavior with metrics' do + shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' 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 metrics' + 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 metrics' + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end diff --git a/spec/workers/reactive_caching_worker_spec.rb b/spec/workers/reactive_caching_worker_spec.rb index dd654c941bc..225d3e38542 100644 --- a/spec/workers/reactive_caching_worker_spec.rb +++ b/spec/workers/reactive_caching_worker_spec.rb @@ -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 |