diff --git a/app/models/manageiq/providers/container_manager/orchestration_stack.rb b/app/models/manageiq/providers/container_manager/orchestration_stack.rb index 15f5b5fa236..0b5469b2b03 100644 --- a/app/models/manageiq/providers/container_manager/orchestration_stack.rb +++ b/app/models/manageiq/providers/container_manager/orchestration_stack.rb @@ -22,6 +22,11 @@ def self.status_class "#{name}::Status".constantize end + def retire_now(requester = nil) + update_attributes(:retirement_requester => requester) + finish_retirement + end + def raw_status failed = resources.any? { |obj| obj.resource_status == 'failed' } if failed diff --git a/spec/factories/orchestration_stack.rb b/spec/factories/orchestration_stack.rb index 933c1f0c8da..180b9b02ee6 100644 --- a/spec/factories/orchestration_stack.rb +++ b/spec/factories/orchestration_stack.rb @@ -85,4 +85,6 @@ factory :orchestration_stack_vmware_cloud, :parent => :orchestration_stack, :class => "ManageIQ::Providers::Vmware::CloudManager::OrchestrationStack" do end + + factory :orchestration_stack_container, :parent => :orchestration_stack, :class => "ManageIQ::Providers::ContainerManager::OrchestrationStack" end diff --git a/spec/models/manageiq/providers/container_manager/orchestration_stack_spec.rb b/spec/models/manageiq/providers/container_manager/orchestration_stack_spec.rb new file mode 100644 index 00000000000..bffced763a2 --- /dev/null +++ b/spec/models/manageiq/providers/container_manager/orchestration_stack_spec.rb @@ -0,0 +1,10 @@ +describe ManageIQ::Providers::ContainerManager::OrchestrationStack do + let(:stack) { FactoryGirl.create(:orchestration_stack_container) } + + describe '#retire_now' do + it 'retires the orchestration stack' do + expect(stack).to receive(:finish_retirement).once + stack.retire_now + end + end +end