summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/kubernetes/helm/init_command_spec.rb
blob: d538ed12a079127cc715e60b84553e2a4f0a9bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Kubernetes::Helm::InitCommand do
  subject(:init_command) { described_class.new(name: application.name, files: files, rbac: rbac) }

  let(:application) { create(:clusters_applications_helm) }
  let(:rbac) { false }
  let(:files) { {} }

  it_behaves_like 'helm command generator' do
    let(:commands) do
      <<~EOS
      helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem
      EOS
    end
  end

  context 'on a rbac-enabled cluster' do
    let(:rbac) { true }

    it_behaves_like 'helm command generator' do
      let(:commands) do
        <<~EOS
        helm init --tiller-tls --tiller-tls-verify --tls-ca-cert /data/helm/helm/config/ca.pem --tiller-tls-cert /data/helm/helm/config/cert.pem --tiller-tls-key /data/helm/helm/config/key.pem --service-account tiller
        EOS
      end
    end
  end

  it_behaves_like 'helm command' do
    let(:command) { init_command }
  end
end