2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
RSpec.shared_examples 'cluster application helm specs' do |application_name|
|
2020-11-24 15:15:51 +05:30
|
|
|
let(:application) { create(application_name) } # rubocop:disable Rails/SaveBang
|
2018-12-13 13:39:08 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
describe '#uninstall_command' do
|
|
|
|
subject { application.uninstall_command }
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
it { is_expected.to be_an_instance_of(Gitlab::Kubernetes::Helm::V3::DeleteCommand) }
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
it 'has files' do
|
|
|
|
expect(subject.files).to eq(application.files)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is rbac' do
|
|
|
|
expect(subject).to be_rbac
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on a non rbac enabled cluster' do
|
|
|
|
before do
|
|
|
|
application.cluster.platform_kubernetes.abac!
|
|
|
|
end
|
|
|
|
|
|
|
|
it { is_expected.not_to be_rbac }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
describe '#files' do
|
|
|
|
subject { application.files }
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
it 'does not include cert files' do
|
|
|
|
expect(subject).not_to include(:'ca.pem', :'cert.pem', :'key.pem')
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
context 'when cluster does not have helm installed' do
|
|
|
|
let(:application) { create(application_name, :no_helm_installed) }
|
2020-04-08 14:13:33 +05:30
|
|
|
|
|
|
|
it 'does not include cert files' do
|
|
|
|
expect(subject).not_to include(:'ca.pem', :'cert.pem', :'key.pem')
|
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|