Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-06-21 23:45:06 +0300
committerMike Greiling <mike@pixelcog.com>2019-06-21 23:45:06 +0300
commitae4966f29a928212ce54e548a48098456b374336 (patch)
tree8e33959e3f1f291a31fb6c20f0d912be0880a967 /spec
parentc6f54ab12b5b276dadda0639ea647e9a2b4c1781 (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')
-rw-r--r--spec/lib/gitlab/kubernetes_spec.rb24
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' }