Commit 33a765c1 authored by Thong Kuah's avatar Thong Kuah Committed by Stan Hu

Teach Helm::Api about #uninstall

parent 43be4d54
...@@ -22,6 +22,13 @@ module Gitlab ...@@ -22,6 +22,13 @@ module Gitlab
alias_method :update, :install alias_method :update, :install
def uninstall(command)
namespace.ensure_exists!
delete_pod!(command.pod_name)
kubeclient.create_pod(command.pod_resource)
end
## ##
# Returns Pod phase # Returns Pod phase
# #
......
...@@ -33,6 +33,28 @@ describe Gitlab::Kubernetes::Helm::Api do ...@@ -33,6 +33,28 @@ describe Gitlab::Kubernetes::Helm::Api do
end end
end end
describe '#uninstall' do
before do
allow(client).to receive(:create_pod).and_return(nil)
allow(client).to receive(:delete_pod).and_return(nil)
allow(namespace).to receive(:ensure_exists!).once
end
it 'ensures the namespace exists before creating the POD' do
expect(namespace).to receive(:ensure_exists!).once.ordered
expect(client).to receive(:create_pod).once.ordered
subject.uninstall(command)
end
it 'removes an existing pod before installing' do
expect(client).to receive(:delete_pod).with('install-app-name', 'gitlab-managed-apps').once.ordered
expect(client).to receive(:create_pod).once.ordered
subject.uninstall(command)
end
end
describe '#install' do describe '#install' do
before do before do
allow(client).to receive(:create_pod).and_return(nil) allow(client).to receive(:create_pod).and_return(nil)
......
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