diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-08 17:36:21 +0000 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-09 10:08:20 +0000 |
commit | f852b23537d34c1e6a6106413fba17dae2d75784 (patch) | |
tree | 007945438d0a9b9beb53b6f7a10cb4e0f89aaf41 /spec/workers | |
parent | b991661080ced37f895542e721198dba7940c1fb (diff) | |
download | gitlab-ce-f852b23537d34c1e6a6106413fba17dae2d75784.tar.gz |
Fix error handling in cluster_platform_configure_worker
I have also extracted an issue in
https://gitlab.com/gitlab-org/gitlab-ce/issues/53738 to surface these
errors to users but now I am just fixing the bug where
kubernetes_namespace is undefined while handling this error
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/cluster_platform_configure_worker_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/workers/cluster_platform_configure_worker_spec.rb b/spec/workers/cluster_platform_configure_worker_spec.rb index 1a7ad8923f6..b51f6e07c6a 100644 --- a/spec/workers/cluster_platform_configure_worker_spec.rb +++ b/spec/workers/cluster_platform_configure_worker_spec.rb @@ -30,4 +30,18 @@ describe ClusterPlatformConfigureWorker, '#execute' do described_class.new.perform(123) end end + + context 'when kubeclient raises error' do + let(:cluster) { create(:cluster, :project) } + + it 'rescues and logs the error' do + allow_any_instance_of(Clusters::Gcp::Kubernetes::CreateOrUpdateNamespaceService).to receive(:execute).and_raise(::Kubeclient::HttpError.new(500, 'something baaaad happened', '')) + + expect(Rails.logger) + .to receive(:error) + .with("Failed to create/update Kubernetes namespace for cluster_id: #{cluster.id} with error: something baaaad happened") + + described_class.new.perform(cluster.id) + end + end end |