100 lines
3.4 KiB
Gherkin
100 lines
3.4 KiB
Gherkin
Feature: Config CLI commands
|
|
As a developer
|
|
I want to manage configuration via CLI
|
|
So that I can set, get, and list runtime configuration values
|
|
|
|
Background:
|
|
Given a clean config CLI test environment
|
|
|
|
# --- SET ---
|
|
Scenario: Set a configuration value
|
|
When I run config set "log_level" "DEBUG"
|
|
Then the config set should succeed
|
|
And the config set output should contain key "log_level"
|
|
And the config set output should contain value "DEBUG"
|
|
|
|
Scenario: Set a configuration value with dot-path
|
|
When I run config set "server.port" "9090"
|
|
Then the config set should succeed
|
|
And the config set output should contain key "server_port"
|
|
|
|
Scenario: Set an unknown key fails
|
|
When I run config set "nonexistent_key" "value"
|
|
Then the config set should fail with unknown key error
|
|
|
|
# --- GET ---
|
|
Scenario: Get a configuration value
|
|
When I run config get "log_level"
|
|
Then the config get should succeed
|
|
And the config get output should contain key "log_level"
|
|
And the config get output should show the resolution chain
|
|
|
|
Scenario: Get a value after setting it
|
|
Given I have set config "log_level" to "WARNING"
|
|
When I run config get "log_level"
|
|
Then the config get should succeed
|
|
|
|
Scenario: Get with dot-path alias
|
|
When I run config get "server.port"
|
|
Then the config get should succeed
|
|
And the config get output should contain key "server_port"
|
|
|
|
Scenario: Get an unknown key fails
|
|
When I run config get "totally_bogus_key"
|
|
Then the config get should fail with unknown key error
|
|
|
|
# --- LIST ---
|
|
Scenario: List all configuration values
|
|
When I run config list
|
|
Then the config list should succeed
|
|
And the config list output should contain multiple settings
|
|
|
|
Scenario: List with key regex filter
|
|
When I run config list "log.*"
|
|
Then the config list should succeed
|
|
And every listed key should match "log.*"
|
|
|
|
Scenario: List with value regex filter
|
|
When I run config list with --filter-values "INFO"
|
|
Then the config list should succeed
|
|
|
|
Scenario: List with invalid key regex fails
|
|
When I run config list with invalid regex "[invalid"
|
|
Then the config list should fail with regex error
|
|
|
|
Scenario: List with invalid value regex fails
|
|
When I run config list with invalid value regex "[bad"
|
|
Then the config list should fail with regex error
|
|
|
|
# --- SECRET MASKING ---
|
|
Scenario: Secret values are masked by default
|
|
When I run config list
|
|
Then secret keys should show masked values
|
|
|
|
Scenario: Show-secrets reveals secret values
|
|
When I run config list with --show-secrets
|
|
Then secret keys should show actual values
|
|
|
|
# --- RESOLUTION CHAIN ---
|
|
Scenario: Resolution chain shows default source
|
|
When I run config get key "log_level" formatted as "json"
|
|
Then the resolution chain should include "default" source
|
|
|
|
# --- SET/GET ROUNDTRIP ---
|
|
Scenario: Set and get roundtrip
|
|
Given I have set config "debug_enabled" to "true"
|
|
When I run config get key "debug_enabled" formatted as "json"
|
|
Then the config get should succeed
|
|
And the get value source should be "config_file"
|
|
|
|
# --- FORMAT ---
|
|
Scenario: Config list with JSON format
|
|
When I run config list with format "json"
|
|
Then the config list should succeed
|
|
And the output should be valid JSON
|
|
|
|
Scenario: Config get with JSON format
|
|
When I run config get key "env" formatted as "json"
|
|
Then the config get should succeed
|
|
And the output should be valid JSON
|