diff options
author | James Fargher <proglottis@gmail.com> | 2019-03-21 08:06:47 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-03-21 08:06:47 +0000 |
commit | 01aa1ef77beee21a588f8b6b27bd372fc7ed7c8d (patch) | |
tree | aa7054c30e2b4172d0d0d2b18ec9d09e064f3e92 /spec/lib | |
parent | 6a0702fe9382c2b3c4a72421054d46821a95c781 (diff) | |
download | gitlab-ce-01aa1ef77beee21a588f8b6b27bd372fc7ed7c8d.tar.gz |
Update dashboards to additionally use new environment selector
Deploy boards now will check for app.gitlab.com/env and
app.gitlab.com/app
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/kubernetes_spec.rb | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/spec/lib/gitlab/kubernetes_spec.rb b/spec/lib/gitlab/kubernetes_spec.rb index f326d57e9c6..57b570a9166 100644 --- a/spec/lib/gitlab/kubernetes_spec.rb +++ b/spec/lib/gitlab/kubernetes_spec.rb @@ -40,10 +40,40 @@ describe Gitlab::Kubernetes do describe '#filter_by_label' do it 'returns matching labels' do - matching_items = [kube_pod(app: 'foo')] + matching_items = [kube_pod(track: 'foo'), kube_deployment(track: 'foo')] + items = matching_items + [kube_pod, kube_deployment] + + expect(filter_by_label(items, 'track' => 'foo')).to eq(matching_items) + end + end + + describe '#filter_by_annotation' do + it 'returns matching labels' do + matching_items = [kube_pod(environment_slug: 'foo'), kube_deployment(environment_slug: 'foo')] + items = matching_items + [kube_pod, kube_deployment] + + expect(filter_by_annotation(items, 'app.gitlab.com/env' => 'foo')).to eq(matching_items) + end + end + + describe '#filter_by_project_environment' do + let(:matching_pod) { kube_pod(environment_slug: 'production', project_slug: 'my-cool-app') } + + it 'returns matching legacy env label' do + matching_pod['metadata']['annotations'].delete('app.gitlab.com/app') + matching_pod['metadata']['annotations'].delete('app.gitlab.com/env') + matching_pod['metadata']['labels']['app'] = 'production' + matching_items = [matching_pod] + items = matching_items + [kube_pod] + + expect(filter_by_project_environment(items, 'my-cool-app', 'production')).to eq(matching_items) + end + + it 'returns matching env label' do + matching_items = [matching_pod] items = matching_items + [kube_pod] - expect(filter_by_label(items, app: 'foo')).to eq(matching_items) + expect(filter_by_project_environment(items, 'my-cool-app', 'production')).to eq(matching_items) end end |