summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/kubernetes/helm/v2/reset_command_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/kubernetes/helm/v2/reset_command_spec.rb')
-rw-r--r--spec/lib/gitlab/kubernetes/helm/v2/reset_command_spec.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/lib/gitlab/kubernetes/helm/v2/reset_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/v2/reset_command_spec.rb
new file mode 100644
index 00000000000..9e580cea397
--- /dev/null
+++ b/spec/lib/gitlab/kubernetes/helm/v2/reset_command_spec.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Kubernetes::Helm::V2::ResetCommand do
+ subject(:reset_command) { described_class.new(name: name, rbac: rbac, files: files) }
+
+ let(:rbac) { true }
+ let(:name) { 'helm' }
+ let(:files) { {} }
+
+ it_behaves_like 'helm command generator' do
+ let(:commands) do
+ <<~EOS
+ helm reset
+ kubectl delete replicaset -n gitlab-managed-apps -l name\\=tiller
+ kubectl delete clusterrolebinding tiller-admin
+ EOS
+ end
+ end
+
+ context 'when there is a ca.pem file' do
+ let(:files) { { 'ca.pem': 'some file content' } }
+
+ it_behaves_like 'helm command generator' do
+ let(:commands) do
+ <<~EOS1.squish + "\n" + <<~EOS2
+ helm reset
+ --tls
+ --tls-ca-cert /data/helm/helm/config/ca.pem
+ --tls-cert /data/helm/helm/config/cert.pem
+ --tls-key /data/helm/helm/config/key.pem
+ EOS1
+ kubectl delete replicaset -n gitlab-managed-apps -l name\\=tiller
+ kubectl delete clusterrolebinding tiller-admin
+ EOS2
+ end
+ end
+ end
+
+ describe '#pod_name' do
+ subject { reset_command.pod_name }
+
+ it { is_expected.to eq('uninstall-helm') }
+ end
+
+ it_behaves_like 'helm command' do
+ let(:command) { reset_command }
+ end
+end