Orchestrata Ultimate › Tests › Reference › kernel › test_config_manager

Tests reference — tests/kernel/test_config_manager.py

Module of tests/kernel, split out because the directory page would be too large.

Prose pending.

tests/kernel/test_config_manager.py

source · 67 tests · 923 lines

Tests for kernel.config_manager.

Covers: kernel.config_manager

Kind Name Line Description
function test_utc_now_returns_datetime 62 _utc_now returns a timezone-aware datetime.
function test_config_source_values 74 ConfigSource members have expected string values.
function test_config_change_to_dict 88 ConfigChange.to_dict serialises all fields.
function test_config_version_to_dict 119 ConfigVersion.to_dict serialises all fields.
function test_schema_validates_required_keys 144 Schema reports missing required keys.
function test_schema_validates_types 152 Schema reports type mismatches.
function test_schema_validates_custom_validator 160 Schema runs custom validators.
function test_schema_passes_validation 170 Schema returns no errors for valid config.
function test_schema_validator_exception 181 Schema captures exceptions from custom validators.
function test_config_value_properties 194 ConfigValue exposes value, source, encrypted, last_updated.
function test_config_value_update 203 update changes value, source and refreshes timestamp.
function test_constructor_defaults 246 ConfigManager uses sensible defaults when no arguments given.
function test_constructor_custom 255 ConfigManager respects custom arguments.
function test_set_and_get 276 set stores a value and get retrieves it.
function test_get_missing_returns_none 284 get returns None for missing keys.
function test_get_with_default 290 get returns provided default when key absent.
function test_get_all_includes_defaults 296 get_all merges explicit config with schema defaults.
function test_set_no_validate 306 set with validate=False bypasses per-key validation.
function test_get_typed_hits 321 get_typed returns value when type matches.
function test_get_typed_miss_returns_default 328 get_typed returns default when type mismatches.
function test_set_defaults 340 set_defaults populates _defaults and schema.key_defaults.
function test_validate_current_config 353 validate checks current config against schema.
function test_validate_before_apply_type 362 validate_before_apply checks type and custom validators.
function test_validate_before_apply_custom 374 validate_before_apply runs custom validator.
function test_load_from_yaml_success 388 load_from_yaml reads keys from a YAML file.
function test_load_from_yaml_missing_file 398 load_from_yaml returns False when file absent.
function test_load_from_yaml_bad_yaml 405 load_from_yaml returns False for invalid YAML.
function test_load_from_environment 419 load_from_environment picks up prefixed vars.
function test_load_from_environment_parsing 430 Environment values are parsed into bool/int/float/json/string.
function test_on_change_callback 452 on_change registers callbacks invoked on value change.
function test_on_change_callback_exception_logged 466 Callback exceptions are logged, not propagated.
function test_save_and_get_version 485 _save_version increments version; get_version retrieves it.
function test_rollback 497 rollback restores a previous version.
function test_rollback_no_versions 510 rollback returns False when no versions exist.
function test_rollback_missing_version 517 rollback returns False for non-existent version.
function test_diff_between_versions 531 diff reports added, removed, and changed keys.
function test_diff_missing_version 549 diff returns error when version not found.
function test_query_current 561 query_current returns all current config values.
function test_query_history 568 query_history returns version dicts.
function test_query_for_volk 578 query_for_volk extracts volk-specific and volk_type config.
function test_query_by_key_pattern 588 query_by_key filters by wildcard pattern.
function test_export_yaml 603 export_yaml returns a YAML string.
function test_export_yaml_to_file 612 export_yaml writes to disk when output_path given.
function test_export_json 621 export_json returns a JSON string.
function test_export_json_to_file 630 export_json writes to disk when output_path given.
function test_set_encrypted_and_get_decrypted 644 set_encrypted stores base64-wrapped value; get_decrypted reverses it.
function test_get_decrypted_missing_key 654 get_decrypted returns None for missing key.
function test_get_decrypted_plain_value 660 get_decrypted returns plain string when not encrypted.
function test_dry_run 672 dry_run returns validation result and diff without applying.
function test_dry_run_invalid 685 dry_run reports validation errors when schema violated.
function test_get_change_history 699 get_change_history returns recorded changes.
function test_get_change_history_filtered 709 get_change_history can filter by key.
function test_validate_compliance 724 validate_compliance runs arbitrary rule functions.
function test_validate_compliance_exception 737 Exceptions in compliance rules are logged and return False.
function test_generate_documentation 755 generate_documentation produces markdown with config table.
function test_generate_documentation_required_keys 765 Documentation includes required keys section.
function test_apply_template 779 apply_template loads a YAML template and substitutes variables.
function test_apply_template_missing 794 apply_template returns False when template file absent.
function test_reload_success 806 reload loads yaml, env, and validates.
function test_reload_validation_failure_rollback 821 reload rolls back when validation fails.
function test_load_from_redis_no_client 841 load_from_redis returns False when Redis client not set.
function test_persist_to_redis_no_client 847 persist_to_redis returns False when Redis client not set.
function test_load_from_redis_with_sync_client 853 load_from_redis reads config from a real synchronous Redis client.
function test_persist_to_redis_with_sync_client 871 persist_to_redis writes all config to a real sync Redis client.
function test_start_and_stop_file_watching 892 start_file_watching spawns a task; stop_file_watching cancels it.
function test_start_file_watching_idempotent 901 start_file_watching is a no-op when already running.
function test_create_and_restore_snapshot 916 _create_snapshot and _restore_snapshot round-trip config.