forked from HAL9000/cleveragents-core
106 lines
5.1 KiB
Gherkin
106 lines
5.1 KiB
Gherkin
Feature: Configuration Core Module Coverage
|
|
As a developer
|
|
I want to test all edge cases and error conditions in the configuration module
|
|
So that we achieve 90%+ code coverage for config.py
|
|
|
|
Background:
|
|
Given the configuration system is initialized for core testing
|
|
|
|
Scenario: Configuration file loading with None content
|
|
Given I have a configuration file "empty.yaml" with None content
|
|
When I load the configuration files
|
|
Then the None content should be skipped
|
|
And the configuration should remain empty
|
|
|
|
Scenario: Configuration file loading with non-dict content
|
|
Given I have a configuration file "non_dict.yaml" with list content
|
|
When I attempt to load the configuration files
|
|
Then a ConfigurationError should be raised with message about YAML dictionary
|
|
|
|
Scenario: Configuration file loading with YAML parsing error
|
|
Given I have a configuration file "invalid_yaml.yaml" with malformed YAML
|
|
When I attempt to load the configuration files
|
|
Then a ConfigurationError should be raised with YAML parsing error
|
|
|
|
Scenario: Configuration file loading with file access error
|
|
Given I have a configuration file path that doesn't exist
|
|
When I attempt to load the configuration files
|
|
Then a ConfigurationError should be raised with file loading error
|
|
|
|
Scenario: Schema validation with general exception
|
|
Given I have a configuration manager with mocked schema validator
|
|
When the schema validator raises a general exception
|
|
Then a ConfigurationError should be raised with validation failed message
|
|
|
|
Scenario: Configuration setting with empty path
|
|
Given I have a configuration manager
|
|
When I attempt to set configuration with empty path
|
|
Then a ConfigurationError should be raised with empty path message
|
|
|
|
Scenario: Configuration setting with non-dict parent
|
|
Given I have a configuration manager with nested structure
|
|
When I attempt to set configuration where parent is not a dict
|
|
Then a ConfigurationError should be raised with parent not dictionary message
|
|
|
|
Scenario: Configuration setting with non-dict intermediate parent
|
|
Given I have a configuration manager with scalar values
|
|
When I attempt to set configuration with non-dict final parent
|
|
Then a ConfigurationError should be raised with final parent not dictionary message
|
|
|
|
Scenario: Environment variable interpolation with missing variable
|
|
Given I have configuration with missing environment variable
|
|
When I perform environment variable interpolation
|
|
Then a ConfigurationError should be raised with environment variable not set message
|
|
|
|
Scenario: Environment variable interpolation with default value type conversions
|
|
Given I have configuration with environment variables and default values
|
|
When I perform environment variable interpolation
|
|
Then boolean defaults should be converted to strings
|
|
And integer defaults should remain as strings
|
|
And float defaults should remain as strings
|
|
And string defaults should remain unchanged
|
|
|
|
Scenario: String to type conversion with boolean values
|
|
Given I have configuration with string boolean values
|
|
When I perform environment variable interpolation
|
|
Then true strings should be converted to boolean True
|
|
And false strings should be converted to boolean False
|
|
|
|
Scenario: String to type conversion with numeric values
|
|
Given I have configuration with string numeric values
|
|
When I perform environment variable interpolation
|
|
Then integer strings should be converted to integers
|
|
And float strings should be converted to floats
|
|
|
|
Scenario: Schema validation with agent config not dict
|
|
Given I have configuration with agent config not as dict
|
|
When I validate the configuration for core testing
|
|
Then a ConfigurationError should be raised with agent config must be dictionary message
|
|
|
|
Scenario: Schema validation with non-dict agent configuration
|
|
Given I have configuration with non-dict agent entry
|
|
When I validate the configuration for core testing
|
|
Then a ConfigurationError should be raised with agent configuration must be dictionary message
|
|
|
|
Scenario: Deep merge with nested dictionaries
|
|
Given I have two configurations with nested dictionary structures
|
|
When I perform deep merge
|
|
Then nested dictionaries should be properly merged
|
|
And values from second config should override first config
|
|
And new keys should be added
|
|
|
|
Scenario: Configuration get with various path scenarios
|
|
Given I have a configuration manager with test data
|
|
When I test get method with various paths
|
|
Then empty path should return entire config
|
|
And non-existent paths should return None or default
|
|
And nested paths should return correct values
|
|
And paths with non-dict intermediates should return default
|
|
|
|
Scenario: Configuration interpolation with complex nested structures
|
|
Given I have configuration with nested lists and dictionaries
|
|
And environment variables are set for interpolation
|
|
When I perform environment variable interpolation
|
|
Then variables in lists should be interpolated
|
|
And variables in nested dictionaries should be interpolated
|
|
And non-string values should remain unchanged |