diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 03:08:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-13 03:08:05 +0300 |
commit | 47b8f79a0896f406008d5a7eda2781f8da301e91 (patch) | |
tree | 1f15328719ca1215a2bd0ec6650ece0ca59de3f4 /spec/lib/gitlab/kubernetes/helm | |
parent | 52fe64b740a4ddbd5b085386dfe40fea191174ea (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/kubernetes/helm')
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/delete_command_spec.rb | 53 | ||||
-rw-r--r-- | spec/lib/gitlab/kubernetes/helm/install_command_spec.rb | 84 |
2 files changed, 93 insertions, 44 deletions
diff --git a/spec/lib/gitlab/kubernetes/helm/delete_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/delete_command_spec.rb index 7e9853cf9ea..82e15864687 100644 --- a/spec/lib/gitlab/kubernetes/helm/delete_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/delete_command_spec.rb @@ -13,40 +13,57 @@ describe Gitlab::Kubernetes::Helm::DeleteCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade - for i in $(seq 1 30); do helm version && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only helm delete --purge app-name EOS end end - let(:tls_flags) do - <<~EOS.squish - --tls - --tls-ca-cert /data/helm/app-name/config/ca.pem - --tls-cert /data/helm/app-name/config/cert.pem - --tls-key /data/helm/app-name/config/key.pem - EOS - end - - context 'when there is a ca.pem file' do - let(:files) { { 'ca.pem': 'some file content' } } + context 'tillerless feature disabled' do + before do + stub_feature_flags(managed_apps_local_tiller: false) + end it_behaves_like 'helm commands' do let(:commands) do <<~EOS helm init --upgrade - for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) - #{helm_delete_command} + for i in $(seq 1 30); do helm version && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + helm delete --purge app-name EOS end + end - let(:helm_delete_command) do + context 'when there is a ca.pem file' do + let(:files) { { 'ca.pem': 'some file content' } } + + let(:tls_flags) do <<~EOS.squish - helm delete --purge app-name - #{tls_flags} + --tls + --tls-ca-cert /data/helm/app-name/config/ca.pem + --tls-cert /data/helm/app-name/config/cert.pem + --tls-key /data/helm/app-name/config/key.pem EOS end + + it_behaves_like 'helm commands' do + let(:commands) do + <<~EOS + helm init --upgrade + for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + #{helm_delete_command} + EOS + end + + let(:helm_delete_command) do + <<~EOS.squish + helm delete --purge app-name + #{tls_flags} + EOS + end + end end end diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb index a25b6b9a398..9c04e101e78 100644 --- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb @@ -23,22 +23,14 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do ) end - let(:tls_flags) do - <<~EOS.squish - --tls - --tls-ca-cert /data/helm/app-name/config/ca.pem - --tls-cert /data/helm/app-name/config/cert.pem - --tls-key /data/helm/app-name/config/key.pem - EOS - end - subject { install_command } it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade - for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only helm repo add app-name https://repository.example.com helm repo update #{helm_install_comand} @@ -50,7 +42,6 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do helm upgrade app-name chart-name --install --reset-values - #{tls_flags} --version 1.2.3 --set rbac.create\\=false,rbac.enabled\\=false --namespace gitlab-managed-apps @@ -59,8 +50,19 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do end end - context 'when rbac is true' do - let(:rbac) { true } + context 'tillerless feature disabled' do + before do + stub_feature_flags(managed_apps_local_tiller: false) + end + + let(:tls_flags) do + <<~EOS.squish + --tls + --tls-ca-cert /data/helm/app-name/config/ca.pem + --tls-cert /data/helm/app-name/config/cert.pem + --tls-key /data/helm/app-name/config/key.pem + EOS + end it_behaves_like 'helm commands' do let(:commands) do @@ -69,6 +71,36 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) helm repo add app-name https://repository.example.com helm repo update + #{helm_install_comand} + EOS + end + + let(:helm_install_comand) do + <<~EOS.squish + helm upgrade app-name chart-name + --install + --reset-values + #{tls_flags} + --version 1.2.3 + --set rbac.create\\=false,rbac.enabled\\=false + --namespace gitlab-managed-apps + -f /data/helm/app-name/config/values.yaml + EOS + end + end + end + + context 'when rbac is true' do + let(:rbac) { true } + + it_behaves_like 'helm commands' do + let(:commands) do + <<~EOS + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only + helm repo add app-name https://repository.example.com + helm repo update #{helm_install_command} EOS end @@ -78,7 +110,6 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do helm upgrade app-name chart-name --install --reset-values - #{tls_flags} --version 1.2.3 --set rbac.create\\=true,rbac.enabled\\=true --namespace gitlab-managed-apps @@ -94,8 +125,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade - for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only helm repo add app-name https://repository.example.com helm repo update /bin/date @@ -109,7 +141,6 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do helm upgrade app-name chart-name --install --reset-values - #{tls_flags} --version 1.2.3 --set rbac.create\\=false,rbac.enabled\\=false --namespace gitlab-managed-apps @@ -125,8 +156,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade - for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -140,7 +172,6 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do helm upgrade app-name chart-name --install --reset-values - #{tls_flags} --version 1.2.3 --set rbac.create\\=false,rbac.enabled\\=false --namespace gitlab-managed-apps @@ -156,8 +187,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade - for i in $(seq 1 30); do helm version && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -184,8 +216,9 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade - for i in $(seq 1 30); do helm version #{tls_flags} && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s) + export HELM_HOST="localhost:44134" + tiller -listen ${HELM_HOST} -alsologtostderr & + helm init --client-only helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -197,7 +230,6 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do helm upgrade app-name chart-name --install --reset-values - #{tls_flags} --set rbac.create\\=false,rbac.enabled\\=false --namespace gitlab-managed-apps -f /data/helm/app-name/config/values.yaml |