diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-07 12:09:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-07 12:09:51 +0300 |
commit | d8803c7e40bd35d883ef007ddc56907bd837a748 (patch) | |
tree | e65de9306d46d111222b03ef29aafbe57adf86ac /spec/services/pod_logs/kubernetes_service_spec.rb | |
parent | b6a92c969b16549683ef276f1db7ba9a41dc85bb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/pod_logs/kubernetes_service_spec.rb')
-rw-r--r-- | spec/services/pod_logs/kubernetes_service_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/services/pod_logs/kubernetes_service_spec.rb b/spec/services/pod_logs/kubernetes_service_spec.rb index da89c7ee117..a1f7645323b 100644 --- a/spec/services/pod_logs/kubernetes_service_spec.rb +++ b/spec/services/pod_logs/kubernetes_service_spec.rb @@ -218,7 +218,7 @@ describe ::PodLogs::KubernetesService do end it 'returns error if pod_name was specified but does not exist' do - result = subject.send(:check_pod_name, pod_name: 'another_pod', pods: [pod_name]) + result = subject.send(:check_pod_name, pod_name: 'another-pod', pods: [pod_name]) expect(result[:status]).to eq(:error) expect(result[:message]).to eq('Pod does not exist') @@ -230,6 +230,13 @@ describe ::PodLogs::KubernetesService do expect(result[:status]).to eq(:error) expect(result[:message]).to eq('pod_name cannot be larger than 253 chars') end + + it 'returns error if pod_name is in invalid format' do + result = subject.send(:check_pod_name, pod_name: "Invalid_pod_name", pods: [pod_name]) + + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq('pod_name can contain only lowercase letters, digits, \'-\', and \'.\' and must start and end with an alphanumeric character') + end end describe '#check_container_name' do @@ -287,5 +294,16 @@ describe ::PodLogs::KubernetesService do expect(result[:status]).to eq(:error) expect(result[:message]).to eq('container_name cannot be larger than 253 chars') end + + it 'returns error if container_name is in invalid format' do + result = subject.send(:check_container_name, + container_name: "Invalid_container_name", + pod_name: pod_name, + raw_pods: raw_pods + ) + + expect(result[:status]).to eq(:error) + expect(result[:message]).to eq('container_name can contain only lowercase letters, digits, \'-\', and \'.\' and must start and end with an alphanumeric character') + end end end |