You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add loadbalancing option hash, and hash_header/hash_balance. Add validations
* Add basic options validation to manifest_routes_update_message
* Add basic tests for manifest route updates
* Simplify validations, improve error messages, adjust tests
* Add validation for hash balance being a float
* Have consistent validations in manifest_routes_updates_message and route_options_message
* Minor refactoring
* Add check for hash_balance value being 0 or >=1.1
* Transform hash_balance to string in the route model before saving
* Validate the route merged with the route update from the message.
* Attempt to forward errors in route_update validation to the client
* Add route options changes to app event
* Add new hash options to mnifest route
* Add new hash options to route properties presenter
* Move additional validation to route model
* Move final options cleanup to route model
* Proper error validation and forwarding
* Forward proper error message on route updates
* Add some logging to find the manifest issue
* Add more logging
* Logging in app_manifest_message
* Test a few things
* Test a few things pt 2
* Test a few things pt 3
* Test a few things pt 4
* Test a few things pt 5
* Test a few things pt 6
* Cleanup logging
* Use symbolized_keys in route_update
* WIP
* Add more validations and tests
* Add more tests for route_update
* Add more tests
* Some test fixes and cleanup
* Use blank? instead of nil? for loadbalancing check
* Fix rubocop issues
* Fix rubocop spec issues
* Refactor to resolve rubocop complexity findings
* Remove test file
* Move all route option message tests from validator spec to new spec file
* Introduce stub config in validator spec to fix execution of standalone spec test
* Fix typos and validation logic
* Fix validation function name inconsistencies
* Fix remaining issues found in review
* revert change to validators spec
error!("Invalid domain. Domain '#{domain.name}' is not available in organization '#{space.organization.name}'.")iferror.errors.on(:domain)&.include?(:invalid_relation)
71
+
validation_error_domain!(error,space,domain)
72
+
validation_error_quota!(error,space)
73
+
validation_error_route!(error)
74
+
validation_error_routing_api!(error)
75
+
validation_error_host!(error,host,domain)
76
+
validation_error_path!(error,host,path,domain)
77
+
validation_error_port!(error,host,port,domain)
72
78
73
-
error!("Routes quota exceeded for space '#{space.name}'.")iferror.errors.on(:space)&.include?(:total_routes_exceeded)
79
+
error!(error.message)
80
+
end
74
81
75
-
error!("Reserved route ports quota exceeded for space '#{space.name}'.")iferror.errors.on(:space)&.include?(:total_reserved_route_ports_exceeded)
errors.add(:base,message: "Route '#{route[:route]}': Hash balance must be either 0 or between 1.1 and 10.0")unlessbalance_float == 0 || balance_float.between?(1.1,10)
140
+
rescueArgumentError,TypeError
141
+
errors.add(:base,message: "Route '#{route[:route]}': Hash balance must be a numeric value")
inclusion: {in: VALID_LOADBALANCING_ALGORITHMS,message: "must be one of '#{RouteOptionsMessage::VALID_LOADBALANCING_ALGORITHMS.join(', ')}' if present"},
errors.add(:hash_header,'must be at most 128 characters')
59
+
end
60
+
61
+
defvalidate_hash_balance_value
62
+
returnifhash_balance.blank?
63
+
64
+
ifhash_balance.to_s.length > 16
65
+
errors.add(:hash_balance,'must be at most 16 characters')
66
+
return
67
+
end
68
+
69
+
validate_hash_balance_numeric
70
+
end
71
+
72
+
defvalidate_hash_balance_numeric
73
+
balance_float=Float(hash_balance)
74
+
# Must be either 0 or >= 1.1 and <= 10.0
75
+
errors.add(:hash_balance,'must be either 0 or between 1.1 and 10.0')unlessbalance_float == 0 || balance_float.between?(1.1,10)
76
+
rescueArgumentError,TypeError
77
+
errors.add(:hash_balance,'must be a numeric value')
78
+
end
79
+
80
+
defvalidate_hash_options_with_loadbalancing
81
+
# When loadbalancing is explicitly set to non-hash value, hash options are not allowed
82
+
errors.add(:base,'Hash header can only be set when loadbalancing is hash')ifhash_header.present? && loadbalancing.present? && loadbalancing != 'hash'
83
+
errors.add(:base,'Hash balance can only be set when loadbalancing is hash')ifhash_balance.present? && loadbalancing.present? && loadbalancing != 'hash'
0 commit comments