diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 15:08:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 15:08:49 +0300 |
commit | 9bf40d9fdc79fb09f67ac2b571467908758777ad (patch) | |
tree | d4f9eb07b6d4e37d79de2f8e4036fdf0bbe3d7a9 /spec/models/clusters | |
parent | 946b1e2fe93357d596f37d3978cf682b8b837925 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/clusters')
-rw-r--r-- | spec/models/clusters/applications/cert_manager_spec.rb | 52 | ||||
-rw-r--r-- | spec/models/clusters/platforms/kubernetes_spec.rb | 67 |
2 files changed, 67 insertions, 52 deletions
diff --git a/spec/models/clusters/applications/cert_manager_spec.rb b/spec/models/clusters/applications/cert_manager_spec.rb index 3044260a000..05ab8c4108e 100644 --- a/spec/models/clusters/applications/cert_manager_spec.rb +++ b/spec/models/clusters/applications/cert_manager_spec.rb @@ -49,13 +49,15 @@ RSpec.describe Clusters::Applications::CertManager do expect(subject.version).to eq('v0.10.1') expect(subject).to be_rbac expect(subject.files).to eq(cert_manager.files.merge(cluster_issuer_file)) - expect(subject.preinstall).to eq([ - 'kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.10/deploy/manifests/00-crds.yaml', - 'kubectl label --overwrite namespace gitlab-managed-apps certmanager.k8s.io/disable-validation=true' - ]) - expect(subject.postinstall).to eq([ - "for i in $(seq 1 90); do kubectl apply -f /data/helm/certmanager/config/cluster_issuer.yaml && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s)" - ]) + expect(subject.preinstall).to eq( + [ + 'kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.10/deploy/manifests/00-crds.yaml', + 'kubectl label --overwrite namespace gitlab-managed-apps certmanager.k8s.io/disable-validation=true' + ]) + expect(subject.postinstall).to eq( + [ + "for i in $(seq 1 90); do kubectl apply -f /data/helm/certmanager/config/cluster_issuer.yaml && s=0 && break || s=$?; sleep 1s; echo \"Retrying ($i)...\"; done; (exit $s)" + ]) end context 'for a specific user' do @@ -99,15 +101,16 @@ RSpec.describe Clusters::Applications::CertManager do end it 'specifies a post delete command to remove custom resource definitions' do - expect(subject.postdelete).to eq([ - 'kubectl delete secret -n gitlab-managed-apps letsencrypt-prod --ignore-not-found', - 'kubectl delete crd certificates.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd certificaterequests.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd challenges.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd clusterissuers.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd issuers.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd orders.certmanager.k8s.io --ignore-not-found' - ]) + expect(subject.postdelete).to eq( + [ + 'kubectl delete secret -n gitlab-managed-apps letsencrypt-prod --ignore-not-found', + 'kubectl delete crd certificates.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd certificaterequests.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd challenges.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd clusterissuers.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd issuers.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd orders.certmanager.k8s.io --ignore-not-found' + ]) end context 'secret key name is not found' do @@ -119,14 +122,15 @@ RSpec.describe Clusters::Applications::CertManager do end it 'does not try and delete the secret' do - expect(subject.postdelete).to eq([ - 'kubectl delete crd certificates.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd certificaterequests.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd challenges.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd clusterissuers.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd issuers.certmanager.k8s.io --ignore-not-found', - 'kubectl delete crd orders.certmanager.k8s.io --ignore-not-found' - ]) + expect(subject.postdelete).to eq( + [ + 'kubectl delete crd certificates.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd certificaterequests.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd challenges.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd clusterissuers.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd issuers.certmanager.k8s.io --ignore-not-found', + 'kubectl delete crd orders.certmanager.k8s.io --ignore-not-found' + ]) end end end diff --git a/spec/models/clusters/platforms/kubernetes_spec.rb b/spec/models/clusters/platforms/kubernetes_spec.rb index 7b9ff409edd..4ac2fd022ba 100644 --- a/spec/models/clusters/platforms/kubernetes_spec.rb +++ b/spec/models/clusters/platforms/kubernetes_spec.rb @@ -601,19 +601,27 @@ RSpec.describe Clusters::Platforms::Kubernetes do it 'creates a matching RolloutStatus' do expect(rollout_status).to be_kind_of(::Gitlab::Kubernetes::RolloutStatus) - expect(rollout_status.deployments.map(&:annotations)).to eq([ - { 'app.gitlab.com/app' => project.full_path_slug, 'app.gitlab.com/env' => 'env-000000' } - ]) - expect(rollout_status.instances).to eq([{ pod_name: "kube-pod", - stable: true, - status: "pending", - tooltip: "kube-pod (Pending)", - track: "stable" }, - { pod_name: "Not provided", - stable: true, - status: "pending", - tooltip: "Not provided (Pending)", - track: "stable" }]) + expect(rollout_status.deployments.map(&:annotations)).to eq( + [ + { 'app.gitlab.com/app' => project.full_path_slug, 'app.gitlab.com/env' => 'env-000000' } + ]) + expect(rollout_status.instances).to eq( + [ + { + pod_name: "kube-pod", + stable: true, + status: "pending", + tooltip: "kube-pod (Pending)", + track: "stable" + }, + { + pod_name: "Not provided", + stable: true, + status: "pending", + tooltip: "Not provided (Pending)", + track: "stable" + } + ]) end context 'with canary ingress' do @@ -720,11 +728,12 @@ RSpec.describe Clusters::Platforms::Kubernetes do end it 'returns a pending pod for each missing replica' do - expect(rollout_status.instances.map { |p| p.slice(:pod_name, :status) }).to eq([ - { pod_name: 'pod-a-1', status: 'running' }, - { pod_name: 'Not provided', status: 'pending' }, - { pod_name: 'Not provided', status: 'pending' } - ]) + expect(rollout_status.instances.map { |p| p.slice(:pod_name, :status) }).to eq( + [ + { pod_name: 'pod-a-1', status: 'running' }, + { pod_name: 'Not provided', status: 'pending' }, + { pod_name: 'Not provided', status: 'pending' } + ]) end end @@ -743,12 +752,13 @@ RSpec.describe Clusters::Platforms::Kubernetes do end it 'returns the correct track for the pending pods' do - expect(rollout_status.instances.map { |p| p.slice(:pod_name, :status, :track) }).to eq([ - { pod_name: 'pod-a-1', status: 'running', track: 'canary' }, - { pod_name: 'Not provided', status: 'pending', track: 'canary' }, - { pod_name: 'Not provided', status: 'pending', track: 'stable' }, - { pod_name: 'Not provided', status: 'pending', track: 'stable' } - ]) + expect(rollout_status.instances.map { |p| p.slice(:pod_name, :status, :track) }).to eq( + [ + { pod_name: 'pod-a-1', status: 'running', track: 'canary' }, + { pod_name: 'Not provided', status: 'pending', track: 'canary' }, + { pod_name: 'Not provided', status: 'pending', track: 'stable' }, + { pod_name: 'Not provided', status: 'pending', track: 'stable' } + ]) end end @@ -765,10 +775,11 @@ RSpec.describe Clusters::Platforms::Kubernetes do end it 'returns the correct number of pending pods' do - expect(rollout_status.instances.map { |p| p.slice(:pod_name, :status, :track) }).to eq([ - { pod_name: 'Not provided', status: 'pending', track: 'mytrack' }, - { pod_name: 'Not provided', status: 'pending', track: 'mytrack' } - ]) + expect(rollout_status.instances.map { |p| p.slice(:pod_name, :status, :track) }).to eq( + [ + { pod_name: 'Not provided', status: 'pending', track: 'mytrack' }, + { pod_name: 'Not provided', status: 'pending', track: 'mytrack' } + ]) end end |