diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-06-21 23:45:06 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-06-21 23:45:06 +0300 |
commit | ae4966f29a928212ce54e548a48098456b374336 (patch) | |
tree | 8e33959e3f1f291a31fb6c20f0d912be0880a967 /spec/lib/gitlab/kubernetes_spec.rb | |
parent | c6f54ab12b5b276dadda0639ea647e9a2b4c1781 (diff) |
Select deployments that only has the app label
As Auto DevOps deployments both label and annotations, that will be
included in the deploy board so need to warn at all.
Diffstat (limited to 'spec/lib/gitlab/kubernetes_spec.rb')
-rw-r--r-- | spec/lib/gitlab/kubernetes_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/kubernetes_spec.rb b/spec/lib/gitlab/kubernetes_spec.rb index 45369b91ed6..a7ea942960b 100644 --- a/spec/lib/gitlab/kubernetes_spec.rb +++ b/spec/lib/gitlab/kubernetes_spec.rb @@ -67,6 +67,30 @@ describe Gitlab::Kubernetes do end end + describe '#filter_by_legacy_label' do + let(:non_matching_pod) { kube_pod(environment_slug: 'production', project_slug: 'my-cool-app') } + + let(:non_matching_pod_2) do + kube_pod(environment_slug: 'production', project_slug: 'my-cool-app').tap do |pod| + pod['metadata']['labels']['app'] = 'production' + end + end + + let(:matching_pod) do + kube_pod.tap do |pod| + pod['metadata']['annotations'].delete('app.gitlab.com/env') + pod['metadata']['annotations'].delete('app.gitlab.com/app') + pod['metadata']['labels']['app'] = 'production' + end + end + + it 'returns matching labels' do + items = [non_matching_pod, non_matching_pod_2, matching_pod] + + expect(filter_by_legacy_label(items, 'my-cool-app', 'production')).to contain_exactly(matching_pod) + end + end + describe '#to_kubeconfig' do let(:token) { 'TOKEN' } let(:ca_pem) { 'PEM' } |