diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/models/clusters | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/models/clusters')
12 files changed, 45 insertions, 19 deletions
diff --git a/spec/models/clusters/agent_token_spec.rb b/spec/models/clusters/agent_token_spec.rb index ad9dd11b24e..9110fdeda52 100644 --- a/spec/models/clusters/agent_token_spec.rb +++ b/spec/models/clusters/agent_token_spec.rb @@ -14,5 +14,10 @@ RSpec.describe Clusters::AgentToken do expect(agent_token.token).to be_present end + + it 'is at least 50 characters' do + agent_token = create(:cluster_agent_token) + expect(agent_token.token.length).to be >= 50 + end end end diff --git a/spec/models/clusters/applications/cert_manager_spec.rb b/spec/models/clusters/applications/cert_manager_spec.rb index 7ca7f533a27..3044260a000 100644 --- a/spec/models/clusters/applications/cert_manager_spec.rb +++ b/spec/models/clusters/applications/cert_manager_spec.rb @@ -40,7 +40,7 @@ RSpec.describe Clusters::Applications::CertManager do subject { cert_manager.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with cert_manager arguments' do expect(subject.name).to eq('certmanager') @@ -90,7 +90,7 @@ RSpec.describe Clusters::Applications::CertManager do describe '#uninstall_command' do subject { cert_manager.uninstall_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::DeleteCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::DeleteCommand) } it 'is initialized with cert_manager arguments' do expect(subject.name).to eq('certmanager') diff --git a/spec/models/clusters/applications/crossplane_spec.rb b/spec/models/clusters/applications/crossplane_spec.rb index a41c5f6586b..7082576028b 100644 --- a/spec/models/clusters/applications/crossplane_spec.rb +++ b/spec/models/clusters/applications/crossplane_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Clusters::Applications::Crossplane do subject { crossplane.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with crossplane arguments' do expect(subject.name).to eq('crossplane') diff --git a/spec/models/clusters/applications/elastic_stack_spec.rb b/spec/models/clusters/applications/elastic_stack_spec.rb index 62123ffa542..74cacd486b0 100644 --- a/spec/models/clusters/applications/elastic_stack_spec.rb +++ b/spec/models/clusters/applications/elastic_stack_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Clusters::Applications::ElasticStack do subject { elastic_stack.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with elastic stack arguments' do expect(subject.name).to eq('elastic-stack') @@ -57,7 +57,7 @@ RSpec.describe Clusters::Applications::ElasticStack do it 'includes a preinstall script' do expect(subject.preinstall).not_to be_empty - expect(subject.preinstall.first).to include("delete") + expect(subject.preinstall.first).to include("helm uninstall") end end @@ -69,7 +69,7 @@ RSpec.describe Clusters::Applications::ElasticStack do it 'includes a preinstall script' do expect(subject.preinstall).not_to be_empty - expect(subject.preinstall.first).to include("delete") + expect(subject.preinstall.first).to include("helm uninstall") end end @@ -123,7 +123,7 @@ RSpec.describe Clusters::Applications::ElasticStack do subject { elastic_stack.uninstall_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::DeleteCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::DeleteCommand) } it 'is initialized with elastic stack arguments' do expect(subject.name).to eq('elastic-stack') diff --git a/spec/models/clusters/applications/fluentd_spec.rb b/spec/models/clusters/applications/fluentd_spec.rb index 3bda3e99ec1..ccdf6b0e40d 100644 --- a/spec/models/clusters/applications/fluentd_spec.rb +++ b/spec/models/clusters/applications/fluentd_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Clusters::Applications::Fluentd do describe '#install_command' do subject { fluentd.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with fluentd arguments' do expect(subject.name).to eq('fluentd') diff --git a/spec/models/clusters/applications/helm_spec.rb b/spec/models/clusters/applications/helm_spec.rb index 6d2ecaa6d47..ad1ebd4966a 100644 --- a/spec/models/clusters/applications/helm_spec.rb +++ b/spec/models/clusters/applications/helm_spec.rb @@ -56,7 +56,7 @@ RSpec.describe Clusters::Applications::Helm do subject { application.issue_client_cert } it 'returns a new cert' do - is_expected.to be_kind_of(Gitlab::Kubernetes::Helm::Certificate) + is_expected.to be_kind_of(Gitlab::Kubernetes::Helm::V2::Certificate) expect(subject.cert_string).not_to eq(application.ca_cert) expect(subject.key_string).not_to eq(application.ca_key) end @@ -67,7 +67,7 @@ RSpec.describe Clusters::Applications::Helm do subject { helm.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InitCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V2::InitCommand) } it 'is initialized with 1 arguments' do expect(subject.name).to eq('helm') @@ -104,7 +104,7 @@ RSpec.describe Clusters::Applications::Helm do subject { helm.uninstall_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::ResetCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V2::ResetCommand) } it 'has name' do expect(subject.name).to eq('helm') diff --git a/spec/models/clusters/applications/ingress_spec.rb b/spec/models/clusters/applications/ingress_spec.rb index 196d57aff7b..1bc1a4343aa 100644 --- a/spec/models/clusters/applications/ingress_spec.rb +++ b/spec/models/clusters/applications/ingress_spec.rb @@ -131,7 +131,7 @@ RSpec.describe Clusters::Applications::Ingress do describe '#install_command' do subject { ingress.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with ingress arguments' do expect(subject.name).to eq('ingress') diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb index 3cf24f1a9ef..e7de2d24334 100644 --- a/spec/models/clusters/applications/jupyter_spec.rb +++ b/spec/models/clusters/applications/jupyter_spec.rb @@ -52,7 +52,7 @@ RSpec.describe Clusters::Applications::Jupyter do subject { jupyter.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with 4 arguments' do expect(subject.name).to eq('jupyter') diff --git a/spec/models/clusters/applications/knative_spec.rb b/spec/models/clusters/applications/knative_spec.rb index b14161ce8e6..41b4ec86233 100644 --- a/spec/models/clusters/applications/knative_spec.rb +++ b/spec/models/clusters/applications/knative_spec.rb @@ -119,7 +119,7 @@ RSpec.describe Clusters::Applications::Knative do shared_examples 'a command' do it 'is an instance of Helm::InstallCommand' do - expect(subject).to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) + expect(subject).to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) end it 'is initialized with knative arguments' do @@ -171,7 +171,7 @@ RSpec.describe Clusters::Applications::Knative do describe '#uninstall_command' do subject { knative.uninstall_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::DeleteCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::DeleteCommand) } it "removes knative deployed services before uninstallation" do 2.times do |i| diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb index b450900bee6..032de6aa7c2 100644 --- a/spec/models/clusters/applications/prometheus_spec.rb +++ b/spec/models/clusters/applications/prometheus_spec.rb @@ -148,7 +148,7 @@ RSpec.describe Clusters::Applications::Prometheus do subject { prometheus.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with 3 arguments' do expect(subject.name).to eq('prometheus') @@ -195,7 +195,7 @@ RSpec.describe Clusters::Applications::Prometheus do subject { prometheus.uninstall_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::DeleteCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::DeleteCommand) } it 'has the application name' do expect(subject.name).to eq('prometheus') @@ -236,7 +236,7 @@ RSpec.describe Clusters::Applications::Prometheus do let(:prometheus) { build(:clusters_applications_prometheus) } let(:values) { prometheus.values } - it { is_expected.to be_an_instance_of(::Gitlab::Kubernetes::Helm::PatchCommand) } + it { is_expected.to be_an_instance_of(::Gitlab::Kubernetes::Helm::V3::PatchCommand) } it 'is initialized with 3 arguments' do expect(patch_command.name).to eq('prometheus') diff --git a/spec/models/clusters/applications/runner_spec.rb b/spec/models/clusters/applications/runner_spec.rb index ef916c73e0b..43e2eab3b9d 100644 --- a/spec/models/clusters/applications/runner_spec.rb +++ b/spec/models/clusters/applications/runner_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Clusters::Applications::Runner do subject { gitlab_runner.install_command } - it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::InstallCommand) } + it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::InstallCommand) } it 'is initialized with 4 arguments' do expect(subject.name).to eq('runner') diff --git a/spec/models/clusters/cluster_spec.rb b/spec/models/clusters/cluster_spec.rb index dd9b96f39ad..ed74a841044 100644 --- a/spec/models/clusters/cluster_spec.rb +++ b/spec/models/clusters/cluster_spec.rb @@ -540,6 +540,27 @@ RSpec.describe Clusters::Cluster, :use_clean_rails_memory_store_caching do end end end + + describe 'helm_major_version can only be 2 or 3' do + using RSpec::Parameterized::TableSyntax + + where(:helm_major_version, :expect_valid) do + 2 | true + 3 | true + 4 | false + -1 | false + end + + with_them do + let(:cluster) { build(:cluster, helm_major_version: helm_major_version) } + + it { is_expected.to eq(expect_valid) } + end + end + end + + it 'has default helm_major_version 3' do + expect(create(:cluster).helm_major_version).to eq(3) end describe '.ancestor_clusters_for_clusterable' do |