Commit 55726ec5 authored by Zamir Martins Filho's avatar Zamir Martins Filho Committed by Jan Provaznik

Fix logic for ingress can_uninstall?

We want to be able to uninstall ingress
not based on jupyter installable but on
jupyter installed status
parent b7f09891
......@@ -50,7 +50,7 @@ module Clusters
end
def allowed_to_uninstall?
external_ip_or_hostname? && application_jupyter_nil_or_installable?
external_ip_or_hostname? && !application_jupyter_installed?
end
def install_command
......@@ -161,8 +161,8 @@ module Clusters
YAML.load_file(chart_values_file).deep_merge!(specification)
end
def application_jupyter_nil_or_installable?
cluster.application_jupyter.nil? || cluster.application_jupyter&.installable?
def application_jupyter_installed?
cluster.application_jupyter&.installed?
end
def modsecurity_snippet_content
......
---
title: Fix logic for ingress can_uninstall?
merge_request: 27729
author:
type: fixed
......@@ -21,27 +21,61 @@ describe Clusters::Applications::Ingress do
describe '#can_uninstall?' do
subject { ingress.can_uninstall? }
it 'returns true if external ip is set and no application exists' do
context 'with jupyter installed' do
before do
create(:clusters_applications_jupyter, :installed, cluster: ingress.cluster)
end
it 'returns false if external_ip_or_hostname? is true' do
ingress.external_ip = 'IP'
is_expected.to be_truthy
is_expected.to be_falsey
end
it 'returns false if application_jupyter_nil_or_installable? is false' do
create(:clusters_applications_jupyter, :installed, cluster: ingress.cluster)
it 'returns false if external_ip_or_hostname? is false' do
is_expected.to be_falsey
end
end
context 'with jupyter installable' do
before do
create(:clusters_applications_jupyter, :installable, cluster: ingress.cluster)
end
it 'returns true if external_ip_or_hostname? is true' do
ingress.external_ip = 'IP'
it 'returns false if application_elastic_stack_nil_or_installable? is false' do
create(:clusters_applications_elastic_stack, :installed, cluster: ingress.cluster)
is_expected.to be_truthy
end
it 'returns false if external_ip_or_hostname? is false' do
is_expected.to be_falsey
end
end
context 'with jupyter nil' do
it 'returns false if external_ip_or_hostname? is false' do
is_expected.to be_falsey
end
context 'if external_ip_or_hostname? is true' do
context 'with IP' do
before do
ingress.external_ip = 'IP'
end
it { is_expected.to be_truthy }
end
context 'with hostname' do
before do
ingress.external_hostname = 'example.com'
end
it { is_expected.to be_truthy }
end
end
end
end
describe '#make_installed!' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment