Validate
This page contains the API documentation for the gradual.configs.validate module.
gradual.configs.validate
The validate module provides utility functions for validating stress testing configurations. It includes functions for checking minimum concurrency values and ensuring required properties are not empty.
Classes
Functions
validate_min_concurrency(min_concurrency, multiple)
Validate and adjust minimum concurrency value based on ramp-up mode.
This function ensures that minimum concurrency is valid when using multiplication-based ramp-up. It prevents zero concurrency scenarios that would result in no test execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_concurrency
|
int
|
The minimum concurrency value to validate |
required |
multiple
|
bool
|
Whether multiplication-based ramp-up is being used |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
The validated minimum concurrency value |
Note
If multiple is True and min_concurrency is 0, the function returns 1 to prevent zero concurrency scenarios.
Source code in src/gradual/configs/validate.py
assert_not_empty(prop, value, error_msg=None)
Assert that a configuration property has a non-empty value.
This function validates that required configuration properties are provided and not empty. It raises an InvalidConfigError if the validation fails.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prop
|
str
|
Name of the property being validated |
required |
value
|
Value to check for emptiness |
required | |
error_msg
|
str
|
Custom error message to use |
None
|
Raises:
| Type | Description |
|---|---|
InvalidConfigError
|
If the value is empty or None |