126 lines
3.8 KiB
Gherkin
126 lines
3.8 KiB
Gherkin
Feature: Configuration Module Coverage
|
|
As a developer
|
|
I want to test the configuration management system
|
|
So that coverage includes all config loading and validation
|
|
|
|
Background:
|
|
Given the configuration system is initialized
|
|
And I have access to configuration files
|
|
|
|
Scenario: Configuration manager initialization
|
|
When I create a new ConfigurationManager
|
|
Then it should initialize with empty config
|
|
And the schema validator should be created
|
|
|
|
Scenario: Basic configuration file loading
|
|
Given I have a simple configuration file "basic_config.yaml":
|
|
"""
|
|
agents:
|
|
- name: test_agent
|
|
type: llm
|
|
config:
|
|
model: gpt-3.5-turbo
|
|
"""
|
|
When I load the configuration file
|
|
Then the config should contain agent definitions
|
|
And the configuration should be valid
|
|
|
|
Scenario: Multiple configuration file merging
|
|
Given I have configuration file "config1.yaml":
|
|
"""
|
|
agents:
|
|
- name: agent1
|
|
type: llm
|
|
"""
|
|
And I have configuration file "config2.yaml":
|
|
"""
|
|
agents:
|
|
- name: agent2
|
|
type: tool
|
|
"""
|
|
When I load both configuration files
|
|
Then both agents should be present in the merged config
|
|
And the configuration structure should be preserved
|
|
|
|
Scenario: Environment variable interpolation
|
|
Given I have a configuration file "env_config.yaml":
|
|
"""
|
|
agents:
|
|
- name: test_agent
|
|
config:
|
|
api_key: ${OPENAI_API_KEY}
|
|
model: ${LLM_MODEL:gpt-3.5-turbo}
|
|
"""
|
|
And environment variable "OPENAI_API_KEY" is set to "test-key"
|
|
When I load the configuration with interpolation
|
|
Then the api_key should be "test-key"
|
|
And the model should use the default value "gpt-3.5-turbo"
|
|
|
|
Scenario: Configuration validation errors
|
|
Given I have an invalid config file "invalid_config.yaml":
|
|
"""
|
|
invalid_structure: true
|
|
missing_required_fields: yes
|
|
"""
|
|
When I attempt to load the invalid configuration
|
|
Then a ConfigurationError should be raised
|
|
And the error should describe the validation issues
|
|
|
|
Scenario: Configuration path-based access
|
|
Given I have a nested configuration:
|
|
"""
|
|
agents:
|
|
llm_agent:
|
|
config:
|
|
model: gpt-4
|
|
temperature: 0.7
|
|
"""
|
|
When I access the configuration using path notation
|
|
Then I should be able to get "agents.llm_agent.config.model"
|
|
And it should return "gpt-4"
|
|
|
|
Scenario: Additional configuration methods testing
|
|
Given I have a nested configuration:
|
|
"""
|
|
agents:
|
|
test_agent:
|
|
type: llm
|
|
config:
|
|
model: gpt-4
|
|
temperature: 0.7
|
|
routes:
|
|
main_route:
|
|
type: stream
|
|
cleveragents:
|
|
default_router: main_route
|
|
"""
|
|
When I test additional configuration methods
|
|
Then all methods should work correctly
|
|
And exports should produce valid results
|
|
|
|
Scenario: Environment variable edge cases
|
|
Given I set environment variable "TEST_BOOL" to "false"
|
|
And I set environment variable "TEST_NUMBER" to "123.45"
|
|
And I have a configuration file "env_edge_cases.yaml":
|
|
"""
|
|
agents:
|
|
test_agent:
|
|
type: llm
|
|
config:
|
|
enabled: ${TEST_BOOL}
|
|
score: ${TEST_NUMBER}
|
|
fallback: ${MISSING_VAR:default123}
|
|
routes:
|
|
main_route:
|
|
type: stream
|
|
cleveragents:
|
|
default_router: main_route
|
|
"""
|
|
When I load the configuration from "env_edge_cases.yaml"
|
|
Then the configuration should be loaded successfully
|
|
And type conversions should work correctly
|
|
|
|
Scenario: Schema validation comprehensive
|
|
Given I have a comprehensive test configuration
|
|
When I perform comprehensive validation testing
|
|
Then all validation scenarios should be covered |