diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/services/pod_logs/kubernetes_service_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
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 |