diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-11-07 21:24:28 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-11-07 21:24:28 +0900 |
commit | b982a44abb53835276739d77f7fedc69d36c3dab (patch) | |
tree | 3f917e5f73be29bbba50a32d787fd6e1a61e450a | |
parent | bbdb0cf05141cdf9931e2aa673bf7a2ce5db0078 (diff) | |
parent | 68a9229502de26c191dbd56738828736876217f6 (diff) | |
download | gitlab-ce-b982a44abb53835276739d77f7fedc69d36c3dab.tar.gz |
Merge branch '38464-k8s-apps' of https://gitlab.com/gitlab-org/gitlab-ce into 38464-k8s-apps
-rw-r--r-- | lib/gitlab/import_export/import_export.yml | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 2 | ||||
-rw-r--r-- | spec/factories/clusters/applications/helm.rb | 7 | ||||
-rw-r--r-- | spec/lib/gitlab/import_export/all_models.yml | 16 | ||||
-rw-r--r-- | spec/services/clusters/applications/install_service_spec.rb | 12 |
5 files changed, 10 insertions, 29 deletions
diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml index a2b735957a3..263599831bf 100644 --- a/lib/gitlab/import_export/import_export.yml +++ b/lib/gitlab/import_export/import_export.yml @@ -54,8 +54,6 @@ project_tree: - :auto_devops - :triggers - :pipeline_schedules - - clusters: - - :application_helm - :services - :hooks - protected_branches: diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index 04d2fe94c2f..2b34ceb5831 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -8,8 +8,6 @@ module Gitlab triggers: 'Ci::Trigger', pipeline_schedules: 'Ci::PipelineSchedule', builds: 'Ci::Build', - clusters: 'Clusters::Cluster', - application_helm: 'Clusters::Applications::Helm', hooks: 'ProjectHook', merge_access_levels: 'ProtectedBranch::MergeAccessLevel', push_access_levels: 'ProtectedBranch::PushAccessLevel', diff --git a/spec/factories/clusters/applications/helm.rb b/spec/factories/clusters/applications/helm.rb index b63e26125d1..23818f19edf 100644 --- a/spec/factories/clusters/applications/helm.rb +++ b/spec/factories/clusters/applications/helm.rb @@ -1,29 +1,24 @@ FactoryGirl.define do factory :cluster_applications_helm, class: Clusters::Applications::Helm do - cluster factory: :cluster + cluster factory: %i(cluster provided_by_gcp) trait :installable do - cluster status 0 end trait :scheduled do - cluster status 1 end trait :installing do - cluster status 2 end trait :installed do - cluster status 3 end trait :errored do - cluster status(-1) status_reason 'something went wrong' end diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index 1bb80173704..bf1e97654e5 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -147,22 +147,6 @@ deploy_keys: - user - deploy_keys_projects - projects -clusters: -- application_helm -- cluster_projects -- projects -- user -- provider_gcp -- platform_kubernetes -cluster_projects: -- projects -- clusters -provider_gcp: -- cluster -platform_kubernetes: -- cluster -application_helm: -- cluster services: - project - service_hook diff --git a/spec/services/clusters/applications/install_service_spec.rb b/spec/services/clusters/applications/install_service_spec.rb index ae8dc7b2bd9..408f7e4354e 100644 --- a/spec/services/clusters/applications/install_service_spec.rb +++ b/spec/services/clusters/applications/install_service_spec.rb @@ -4,14 +4,20 @@ describe Clusters::Applications::InstallService do describe '#execute' do let(:application) { create(:cluster_applications_helm, :scheduled) } let(:service) { described_class.new(application) } + let(:helm_client) { instance_double(Gitlab::Kubernetes::Helm) } + + before do + allow(service).to receive(:helm_api).and_return(helm_client) + end context 'when there are no errors' do before do - expect_any_instance_of(Gitlab::Kubernetes::Helm).to receive(:install).with(application) + expect(helm_client).to receive(:install).with(application) allow(ClusterWaitForAppInstallationWorker).to receive(:perform_in).and_return(nil) end it 'make the application installing' do + expect(application.cluster).not_to be_nil service.execute expect(application).to be_installing @@ -27,7 +33,7 @@ describe Clusters::Applications::InstallService do context 'when k8s cluster communication fails' do before do error = KubeException.new(500, 'system failure', nil) - expect_any_instance_of(Gitlab::Kubernetes::Helm).to receive(:install).with(application).and_raise(error) + expect(helm_client).to receive(:install).with(application).and_raise(error) end it 'make the application errored' do @@ -43,7 +49,7 @@ describe Clusters::Applications::InstallService do it 'make the application errored' do expect(application).to receive(:make_installing!).once.and_raise(ActiveRecord::RecordInvalid) - expect_any_instance_of(Gitlab::Kubernetes::Helm).not_to receive(:install) + expect(helm_client).not_to receive(:install) service.execute |