2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.shared_examples 'cluster application initial status specs' do
|
|
|
|
describe '#status' do
|
|
|
|
let(:cluster) { create(:cluster, :provided_by_gcp) }
|
|
|
|
|
|
|
|
subject { described_class.new(cluster: cluster) }
|
|
|
|
|
|
|
|
context 'local tiller feature flag is disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(managed_apps_local_tiller: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets a default status' do
|
|
|
|
expect(subject.status_name).to be(:not_installable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'local tiller feature flag is enabled' do
|
|
|
|
before do
|
2020-06-23 00:09:42 +05:30
|
|
|
stub_feature_flags(managed_apps_local_tiller: cluster.clusterable)
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets a default status' do
|
|
|
|
expect(subject.status_name).to be(:installable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when application helm is scheduled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(managed_apps_local_tiller: false)
|
|
|
|
|
|
|
|
create(:clusters_applications_helm, :scheduled, cluster: cluster)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'defaults to :not_installable' do
|
|
|
|
expect(subject.status_name).to be(:not_installable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when application helm is installed' do
|
|
|
|
before do
|
|
|
|
create(:clusters_applications_helm, :installed, cluster: cluster)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'sets a default status' do
|
|
|
|
expect(subject.status_name).to be(:installable)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|