Skip to content

Commit

Permalink
cleanup: rename list of health check types
Browse files Browse the repository at this point in the history
split out readiness health check types into its own method
  • Loading branch information
ameowlia committed Jul 27, 2023
1 parent 0dbbb06 commit 2cfe394
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/models/helpers/health_check_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ class HealthCheckTypes
HTTP = 'http'.freeze
NONE = 'none'.freeze

def self.constants_to_array
def self.all_types
[
HTTP,
NONE,
PORT,
PROCESS,
]
end

def self.readiness_types
self.all_types - [NONE]
end
end
end
2 changes: 1 addition & 1 deletion app/models/runtime/constraints/health_check_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(process, health_check_timeout, health_check_invocation_timeout, h
@health_check_invocation_timeout = health_check_invocation_timeout
@health_check_type = health_check_type
@health_check_http_endpoint = health_check_http_endpoint
@valid_health_check_types = VCAP::CloudController::HealthCheckTypes.constants_to_array
@valid_health_check_types = VCAP::CloudController::HealthCheckTypes.all_types
@var_to_symbol = {
'timeout' => :health_check_timeout,
'type' => :health_check_type,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ReadinessHealthCheckPolicy < HealthCheckPolicy
def initialize(process, health_check_invocation_timeout, health_check_type, health_check_http_endpoint)
super(process, nil, health_check_invocation_timeout, health_check_type, health_check_http_endpoint)
@valid_health_check_types = VCAP::CloudController::HealthCheckTypes.constants_to_array - [VCAP::CloudController::HealthCheckTypes::NONE]
@valid_health_check_types = VCAP::CloudController::HealthCheckTypes.readiness_types
@var_to_symbol = {
'type' => :readiness_health_check_type,
'invocation_timeout' => :readiness_health_check_invocation_timeout,
Expand Down

0 comments on commit 2cfe394

Please sign in to comment.