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 core specs' do |application_name|
|
2018-03-27 19:54:05 +05:30
|
|
|
it { is_expected.to belong_to(:cluster) }
|
|
|
|
it { is_expected.to validate_presence_of(:cluster) }
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
describe '#can_uninstall?' do
|
|
|
|
it 'calls allowed_to_uninstall?' do
|
|
|
|
expect(subject).to receive(:allowed_to_uninstall?).and_return(true)
|
|
|
|
|
|
|
|
expect(subject.can_uninstall?).to be_truthy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
describe '#name' do
|
|
|
|
it 'is .application_name' do
|
|
|
|
expect(subject.name).to eq(described_class.application_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'is recorded in Clusters::Cluster::APPLICATIONS' do
|
|
|
|
expect(Clusters::Cluster::APPLICATIONS[subject.name]).to eq(described_class)
|
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
describe '.association_name' do
|
|
|
|
it { expect(described_class.association_name).to eq(:"application_#{subject.name}") }
|
|
|
|
end
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
describe '#helm_command_module' do
|
|
|
|
using RSpec::Parameterized::TableSyntax
|
|
|
|
|
|
|
|
where(:helm_major_version, :expected_helm_command_module) do
|
|
|
|
2 | Gitlab::Kubernetes::Helm::V2
|
|
|
|
3 | Gitlab::Kubernetes::Helm::V3
|
|
|
|
end
|
|
|
|
|
|
|
|
with_them do
|
|
|
|
subject { described_class.new(cluster: cluster).helm_command_module }
|
|
|
|
|
|
|
|
let(:cluster) { build(:cluster, helm_major_version: helm_major_version)}
|
|
|
|
|
|
|
|
it { is_expected.to eq(expected_helm_command_module) }
|
|
|
|
end
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|