winterhazel opened a new pull request, #9107:
URL: https://github.com/apache/cloudstack/pull/9107

   ### Description
   
   The configuration update process mixes type validation with range validation 
in 
`com.cloud.configuration.ConfigurationManagerImpl#validateConfigurationValue`. 
To improve this process, this PR splits these validations into two methods 
(`validateValueType` and `validateValueRange`) and cleans up the code.
   
   Furthermore, this PR also fixes an issue that allows non-numeric values to 
be inserted into `Double` configurations, such as 
`zone.virtualnetwork.ipv6subnet.capacity.notificationthreshold`.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [X] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [X] Minor
   - [ ] Trivial
   
   
   ### How Has This Been Tested?
   
   I manually verified the behavior of trying to update configurations of the 
following types, and compared them with the previous version to ensure the 
result was expected:
   
   - `String` - `quota.currency.symbol` and `alert.email.addresses` (that is, 
one that does not have `null` as a valid value and another that does);
   - `Boolean` - `admin.is.allowed.to.deploy.anywhere`;
   - `Integer` - `storage.cleanup.interval`. (the validations for this type 
also apply to `Short` and `Long`);
   - `Float` - `cpu.overprovisioning.factor` (also applies to `Double`).
   
   | Number | Test | Result | Expected result (Y/N)? |
   | - | - | - | - |
   | 1 | Value `"null"` in a `String` that does not have `null` as a valid 
value | The value is updated in the database, but the default value is used | Y 
|
   | 2 | Value `"1"` in a `String` that does not have `null` as a valid value | 
Success | Y |
   | 3 | Value `"1.1"` in a `String` that does not have `null` as a valid value 
| Success | Y |
   | 4 | Value `"test"` in a `String` that does not have `null` as a valid 
value | Success | Y |
   | 5 | Value `"null"` in a `String` that has `null` as a valid value | 
Success | Y |
   | 6 | Value `"1"` in a `String` that has `null` as a valid value | Success | 
Y |
   | 7 | Value `"1.1"` in a `String` that has `null` as a valid value | Success 
| Y |
   | 8 | Value `"test"` in a `String` that has `null` as a valid value | 
Success | Y |
   | 9 | Value `"null"` in a `Boolean` | Exception | Y |
   | 10 | Value `"1"` in a `Boolean` | Exception | Y |
   | 11 | Value `"1.1"` in a `Boolean` | Exception | Y |
   | 12 | Value `"test"` in a `Boolean` | Exception | Y |
   | 13 | Value `"true"` in a `Boolean` | Success | Y |
   | 14 | Value `"false"` in a `Boolean` | Success | Y |
   | 15 | Value `"fALse"` in a `Boolean` | Exception | Y |
   | 16 | Value `"null"` in an `Integer` | Exception | Y |
   | 17 | Value `"1"` in an `Integer` | Success | Y |
   | 18 | Value `"1.1"` in an `Integer` | Exception | Y |
   | 19 | Value `"test"` in an `Integer` | Exception | Y |
   | 20 | Value `"null"` in a `Float` | Exception | Y |
   | 21 | Value `"1"` in a `Float` | Success | Y |
   | 22 | Value `"1.1"` in a `Float` | Success | Y |
   | 23 | Value `"test"` in a `Float` | Exception | Y |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to