diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/models/clusters/applications/elastic_stack_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/models/clusters/applications/elastic_stack_spec.rb')
-rw-r--r-- | spec/models/clusters/applications/elastic_stack_spec.rb | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/spec/models/clusters/applications/elastic_stack_spec.rb b/spec/models/clusters/applications/elastic_stack_spec.rb index b0992c43d11..02ada219e32 100644 --- a/spec/models/clusters/applications/elastic_stack_spec.rb +++ b/spec/models/clusters/applications/elastic_stack_spec.rb @@ -19,10 +19,12 @@ describe Clusters::Applications::ElasticStack do it 'is initialized with elastic stack arguments' do expect(subject.name).to eq('elastic-stack') - expect(subject.chart).to eq('stable/elastic-stack') - expect(subject.version).to eq('1.9.0') + expect(subject.chart).to eq('elastic-stack/elastic-stack') + expect(subject.version).to eq('3.0.0') + expect(subject.repository).to eq('https://charts.gitlab.io') expect(subject).to be_rbac expect(subject.files).to eq(elastic_stack.files) + expect(subject.preinstall).to be_empty end context 'on a non rbac enabled cluster' do @@ -33,15 +35,75 @@ describe Clusters::Applications::ElasticStack do it { is_expected.not_to be_rbac } end + context 'on versions older than 2' do + before do + elastic_stack.status = elastic_stack.status_states[:updating] + elastic_stack.version = "1.9.0" + end + + it 'includes a preinstall script' do + expect(subject.preinstall).not_to be_empty + expect(subject.preinstall.first).to include("delete") + end + end + + context 'on versions older than 3' do + before do + elastic_stack.status = elastic_stack.status_states[:updating] + elastic_stack.version = "2.9.0" + end + + it 'includes a preinstall script' do + expect(subject.preinstall).not_to be_empty + expect(subject.preinstall.first).to include("delete") + end + end + context 'application failed to install previously' do let(:elastic_stack) { create(:clusters_applications_elastic_stack, :errored, version: '0.0.1') } it 'is initialized with the locked version' do - expect(subject.version).to eq('1.9.0') + expect(subject.version).to eq('3.0.0') end end end + describe '#chart_above_v2?' do + let(:elastic_stack) { create(:clusters_applications_elastic_stack, version: version) } + + subject { elastic_stack.chart_above_v2? } + + context 'on v1.9.0' do + let(:version) { '1.9.0' } + + it { is_expected.to be_falsy } + end + + context 'on v2.0.0' do + let(:version) { '2.0.0' } + + it { is_expected.to be_truthy } + end + end + + describe '#chart_above_v3?' do + let(:elastic_stack) { create(:clusters_applications_elastic_stack, version: version) } + + subject { elastic_stack.chart_above_v3? } + + context 'on v1.9.0' do + let(:version) { '1.9.0' } + + it { is_expected.to be_falsy } + end + + context 'on v3.0.0' do + let(:version) { '3.0.0' } + + it { is_expected.to be_truthy } + end + end + describe '#uninstall_command' do let!(:elastic_stack) { create(:clusters_applications_elastic_stack) } @@ -57,7 +119,7 @@ describe Clusters::Applications::ElasticStack do it 'specifies a post delete command to remove custom resource definitions' do expect(subject.postdelete).to eq([ - 'kubectl delete pvc --selector release\\=elastic-stack' + 'kubectl delete pvc --selector app\\=elastic-stack-elasticsearch-master --namespace gitlab-managed-apps' ]) end end |