diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 09:09:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 09:09:38 +0300 |
commit | ed9165c2abda1dca048a8d3cb8030d906c0bbb0c (patch) | |
tree | 226d7ad6b9abdc8d2534c3025b488ce9a754dee6 /spec/services | |
parent | b4b9b3854eddd2a4829113ebfc1812c3a332a7d9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/pod_logs/base_service_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/pod_logs/kubernetes_service_spec.rb | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/spec/services/pod_logs/base_service_spec.rb b/spec/services/pod_logs/base_service_spec.rb index d93ea51eae1..fb53321352b 100644 --- a/spec/services/pod_logs/base_service_spec.rb +++ b/spec/services/pod_logs/base_service_spec.rb @@ -9,11 +9,13 @@ describe ::PodLogs::BaseService do let(:namespace) { 'autodevops-deploy-9-production' } let(:pod_name) { 'pod-1' } + let(:pod_name_2) { 'pod-2' } let(:container_name) { 'container-0' } let(:params) { {} } let(:raw_pods) do JSON.parse([ - kube_pod(name: pod_name) + kube_pod(name: pod_name), + kube_pod(name: pod_name_2) ].to_json, object_class: OpenStruct) end @@ -115,7 +117,7 @@ describe ::PodLogs::BaseService do result = subject.send(:get_pod_names, raw_pods: raw_pods) expect(result[:status]).to eq(:success) - expect(result[:pods]).to eq([pod_name]) + expect(result[:pods]).to eq([pod_name, pod_name_2]) end end end diff --git a/spec/services/pod_logs/kubernetes_service_spec.rb b/spec/services/pod_logs/kubernetes_service_spec.rb index 8ce79d4c318..ff0554bbe5c 100644 --- a/spec/services/pod_logs/kubernetes_service_spec.rb +++ b/spec/services/pod_logs/kubernetes_service_spec.rb @@ -9,16 +9,20 @@ describe ::PodLogs::KubernetesService do let(:namespace) { 'autodevops-deploy-9-production' } let(:pod_name) { 'pod-1' } + let(:pod_name_2) { 'pod-2' } let(:container_name) { 'container-0' } + let(:container_name_2) { 'foo-0' } let(:params) { {} } let(:raw_logs) do "2019-12-13T14:04:22.123456Z Log 1\n2019-12-13T14:04:23.123456Z Log 2\n" \ "2019-12-13T14:04:24.123456Z Log 3" end + let(:raw_pods) do JSON.parse([ - kube_pod(name: pod_name) + kube_pod(name: pod_name), + kube_pod(name: pod_name_2, container_name: container_name_2) ].to_json, object_class: OpenStruct) end @@ -220,12 +224,12 @@ describe ::PodLogs::KubernetesService do it 'returns success if container_name was not specified and there are containers' do result = subject.send(:check_container_name, - pod_name: pod_name, + pod_name: pod_name_2, raw_pods: raw_pods ) expect(result[:status]).to eq(:success) - expect(result[:container_name]).to eq(container_name) + expect(result[:container_name]).to eq(container_name_2) end it 'returns error if container_name was not specified and there are no containers on the pod' do |