Skip to content
Snippets Groups Projects
Commit 53e2987b authored by Pirate Praveen's avatar Pirate Praveen
Browse files

Replace KubeException with Kubeclient::HttpError (kubeclient 3.0)

parent 0b246d57
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -134,7 +134,7 @@ module Clusters
kubeclient = build_kubeclient!
 
kubeclient.get_pods(namespace: actual_namespace).as_json
rescue KubeException => err
rescue Kubeclient::HttpError => err
raise err unless err.error_code == 404
 
[]
Loading
Loading
Loading
Loading
@@ -197,7 +197,7 @@ class KubernetesService < DeploymentService
kubeclient = build_kubeclient!
 
kubeclient.get_pods(namespace: actual_namespace).as_json
rescue KubeException => err
rescue Kubeclient::HttpError => err
raise err unless err.error_code == 404
 
[]
Loading
Loading
Loading
Loading
@@ -32,7 +32,7 @@ module Ci
kubeclient = build_kubeclient!
 
kubeclient.get_secrets.as_json
rescue KubeException => err
rescue Kubeclient::HttpError => err
raise err unless err.error_code == 404
 
[]
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ module Clusters
else
check_timeout
end
rescue KubeException => ke
rescue Kubeclient::HttpError => ke
app.make_errored!("Kubernetes error: #{ke.message}") unless app.errored?
end
 
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module Clusters
 
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue KubeException => ke
rescue Kubeclient::HttpError => ke
app.make_errored!("Kubernetes error: #{ke.message}")
rescue StandardError
app.make_errored!("Can't start installation process")
Loading
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module Gitlab
 
def exists?
@client.get_namespace(name)
rescue ::KubeException => ke
rescue ::Kubeclient::HttpError => ke
raise ke unless ke.error_code == 404
 
false
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ describe Gitlab::Kubernetes::Namespace do
 
describe '#exists?' do
context 'when namespace do not exits' do
let(:exception) { ::KubeException.new(404, "namespace #{name} not found", nil) }
let(:exception) { ::Kubeclient::HttpError.new(404, "namespace #{name} not found", nil) }
 
it 'returns false' do
expect(client).to receive(:get_namespace).with(name).once.and_raise(exception)
Loading
Loading
Loading
Loading
@@ -252,7 +252,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
stub_kubeclient_pods(status: 500)
end
 
it { expect { subject }.to raise_error(KubeException) }
it { expect { subject }.to raise_error(Kubeclient::HttpError) }
end
 
context 'when kubernetes responds with 404s' do
Loading
Loading
Loading
Loading
@@ -370,7 +370,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
stub_kubeclient_pods(status: 500)
end
 
it { expect { subject }.to raise_error(KubeException) }
it { expect { subject }.to raise_error(Kubeclient::HttpError) }
end
 
context 'when kubernetes responds with 404s' do
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@ describe Clusters::Applications::InstallService do
 
context 'when k8s cluster communication fails' do
before do
error = KubeException.new(500, 'system failure', nil)
error = Kubeclient::HttpError.new(500, 'system failure', nil)
expect(helm_client).to receive(:install).with(install_command).and_raise(error)
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment