Commit 54c70a77 authored by Shinya Maeda's avatar Shinya Maeda

Fix static analysys

parent f6d9dcf8
...@@ -134,6 +134,7 @@ module Clusters ...@@ -134,6 +134,7 @@ module Clusters
kubeclient.get_pods(namespace: actual_namespace).as_json kubeclient.get_pods(namespace: actual_namespace).as_json
rescue KubeException => err rescue KubeException => err
raise err unless err.error_code == 404 raise err unless err.error_code == 404
[] []
end end
......
...@@ -905,7 +905,7 @@ class Project < ActiveRecord::Base ...@@ -905,7 +905,7 @@ class Project < ActiveRecord::Base
# TODO: This will be extended for multiple enviroment clusters # TODO: This will be extended for multiple enviroment clusters
# TODO: Add super nice tests to check this interchangeability # TODO: Add super nice tests to check this interchangeability
def deployment_platform def deployment_platform
@deployment_platform ||= clusters.where(enabled: true).first&.platform_kubernetes @deployment_platform ||= clusters.find_by(enabled: true)&.platform_kubernetes
@deployment_platform ||= services.where(category: :deployment).reorder(nil).find_by(active: true) @deployment_platform ||= services.where(category: :deployment).reorder(nil).find_by(active: true)
end end
......
require 'spec_helper' require 'spec_helper'
feature 'Interchangeability between KubernetesService and Platform::Kubernetes' do feature 'Interchangeability between KubernetesService and Platform::Kubernetes' do
EXCEPT_METHODS = %i[test title description help fields initialize_properties namespace namespace= api_url api_url=] EXCEPT_METHODS = %i[test title description help fields initialize_properties namespace namespace= api_url api_url=].freeze
EXCEPT_METHODS_GREP_V = %w[_touched? _changed? _was] EXCEPT_METHODS_GREP_V = %w[_touched? _changed? _was].freeze
it 'Clusters::Platform::Kubernetes covers core interfaces in KubernetesService' do it 'Clusters::Platform::Kubernetes covers core interfaces in KubernetesService' do
expected_interfaces = KubernetesService.instance_methods(false) expected_interfaces = KubernetesService.instance_methods(false)
...@@ -10,7 +10,7 @@ feature 'Interchangeability between KubernetesService and Platform::Kubernetes' ...@@ -10,7 +10,7 @@ feature 'Interchangeability between KubernetesService and Platform::Kubernetes'
EXCEPT_METHODS_GREP_V.each do |g| EXCEPT_METHODS_GREP_V.each do |g|
expected_interfaces = expected_interfaces.grep_v(/#{Regexp.escape(g)}\z/) expected_interfaces = expected_interfaces.grep_v(/#{Regexp.escape(g)}\z/)
end end
expect(expected_interfaces - Clusters::Platforms::Kubernetes.instance_methods).to be_empty expect(expected_interfaces - Clusters::Platforms::Kubernetes.instance_methods).to be_empty
end end
end end
...@@ -225,7 +225,7 @@ feature 'Environments page', :js do ...@@ -225,7 +225,7 @@ feature 'Environments page', :js do
end end
end end
end end
context 'when user configured kubernetes from Integration > Kubernetes' do context 'when user configured kubernetes from Integration > Kubernetes' do
let(:project) { create(:kubernetes_project, :test_repo) } let(:project) { create(:kubernetes_project, :test_repo) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment