diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /spec/lib/gitlab/kubernetes | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'spec/lib/gitlab/kubernetes')
-rw-r--r-- | spec/lib/gitlab/kubernetes/kube_client_spec.rb | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/spec/lib/gitlab/kubernetes/kube_client_spec.rb b/spec/lib/gitlab/kubernetes/kube_client_spec.rb index 90c11f29855..7b6d143dda9 100644 --- a/spec/lib/gitlab/kubernetes/kube_client_spec.rb +++ b/spec/lib/gitlab/kubernetes/kube_client_spec.rb @@ -9,7 +9,7 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do let(:api_url) { 'https://kubernetes.example.com/prefix' } let(:kubeclient_options) { { auth_options: { bearer_token: 'xyz' } } } - let(:client) { described_class.new(api_url, kubeclient_options) } + let(:client) { described_class.new(api_url, **kubeclient_options) } before do stub_kubeclient_discover(api_url) @@ -133,7 +133,7 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do end it 'falls back to default options, but allows overriding' do - client = Gitlab::Kubernetes::KubeClient.new(api_url, {}) + client = described_class.new(api_url) defaults = Gitlab::Kubernetes::KubeClient::DEFAULT_KUBECLIENT_OPTIONS expect(client.kubeclient_options[:timeouts]).to eq(defaults[:timeouts]) @@ -347,6 +347,34 @@ RSpec.describe Gitlab::Kubernetes::KubeClient do end end + describe '#get_ingresses' do + let(:extensions_client) { client.extensions_client } + let(:networking_client) { client.networking_client } + + include_examples 'redirection not allowed', 'get_ingresses' + include_examples 'dns rebinding not allowed', 'get_ingresses' + + it 'delegates to the extensions client' do + expect(extensions_client).to receive(:get_ingresses) + + client.get_ingresses + end + + context 'extensions does not have deployments for Kubernetes 1.22+ clusters' do + before do + WebMock + .stub_request(:get, api_url + '/apis/extensions/v1beta1') + .to_return(kube_response(kube_1_22_extensions_v1beta1_discovery_body)) + end + + it 'delegates to the apps client' do + expect(networking_client).to receive(:get_ingresses) + + client.get_ingresses + end + end + end + describe 'istio API group' do let(:istio_client) { client.istio_client } |