b4a514e0f4
CI / benchmark-regression (push) Failing after 34s
CI / tdd_quality_gate (push) Has been skipped
CI / push-validation (push) Successful in 1m5s
CI / helm (push) Successful in 1m6s
CI / build (push) Successful in 1m23s
CI / lint (push) Successful in 1m55s
CI / typecheck (push) Successful in 2m4s
CI / quality (push) Successful in 2m2s
CI / security (push) Successful in 2m2s
CI / integration_tests (push) Successful in 7m35s
CI / e2e_tests (push) Successful in 4m30s
CI / unit_tests (push) Successful in 9m19s
CI / docker (push) Successful in 1m47s
CI / coverage (push) Successful in 12m33s
CI / status-check (push) Successful in 3s
CI / benchmark-publish (push) Has been cancelled
Implements ADR-021 §Global CLI Flags and ADR-024 §Resolution Chain.
All three global options were missing from main_callback(), causing any
invocation with these flags to crash with 'No such option'.
Changes:
- src/cleveragents/cli/main.py
* Add _VERBOSITY_LOG_LEVELS tuple mapping verbose count to log levels
(0=CRITICAL/silent, 1=ERROR, 2=WARNING, 3=INFO, 4=DEBUG, 5+=DEBUG)
* Add --data-dir PATH option: validates path is a directory if it exists,
sets CLEVERAGENTS_DATA_DIR env var, resets Settings singleton
* Add --config-path PATH option: validates file exists and is a file,
sets CLEVERAGENTS_CONFIG_PATH env var for ConfigService to pick up
* Add -v (count=True) option: wires verbose count to configure_structlog
* Store all three values in ctx.obj for subcommand access
* Update _print_basic_help() to include the three new global options so
'cleveragents --help' (fast path) also lists them
* In the catch-all Exception handler, print the original exception
type+message directly to err_console so actionable details remain
visible even when log level is CRITICAL (e.g. 'No such option')
- src/cleveragents/application/services/config_service.py
* ConfigService.__init__ now checks CLEVERAGENTS_CONFIG_PATH env var
when no explicit config_path is passed, completing the resolution
chain for --config-path CLI override
Tests (all passing):
- features/cli_global_options.feature (21 Behave scenarios)
- features/steps/cli_global_options_steps.py
- robot/cli_global_options.robot (8 Robot Framework integration tests)
- robot/helper_cli_global_options.py
Quality gates: lint ✓ typecheck ✓ unit_tests ✓ integration_tests ✓
Coverage: 96.52% (threshold 96.5% ✓)
ISSUES CLOSED: #6785
80 lines
3.7 KiB
Plaintext
80 lines
3.7 KiB
Plaintext
*** Settings ***
|
|
Documentation Integration tests for CLI global options --data-dir, --config-path, and -v.
|
|
...
|
|
... Verifies that the spec-required global options are properly accepted
|
|
... and propagated end-to-end (issue #6785).
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${HELPER} ${CURDIR}/helper_cli_global_options.py
|
|
|
|
*** Test Cases ***
|
|
Data Dir Option Accepted With Valid Directory
|
|
[Documentation] Verify --data-dir is accepted without error for an existing directory.
|
|
${result}= Run Process ${PYTHON} ${HELPER} data-dir-accepted cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-data-dir-accepted-ok
|
|
|
|
Config Path Option Accepted With Valid File
|
|
[Documentation] Verify --config-path is accepted without error for an existing file.
|
|
${result}= Run Process ${PYTHON} ${HELPER} config-path-accepted cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-config-path-accepted-ok
|
|
|
|
Verbosity Flag Accepted
|
|
[Documentation] Verify -v flag is accepted without crashing.
|
|
${result}= Run Process ${PYTHON} ${HELPER} verbosity-accepted cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-verbosity-accepted-ok
|
|
|
|
Data Dir And Config Path Combined
|
|
[Documentation] Verify --data-dir and --config-path can be combined end-to-end.
|
|
${result}= Run Process ${PYTHON} ${HELPER} combined-options cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-combined-ok
|
|
|
|
Data Dir Overrides Settings Data Dir
|
|
[Documentation] Verify --data-dir properly overrides CLEVERAGENTS_DATA_DIR.
|
|
${result}= Run Process ${PYTHON} ${HELPER} data-dir-override cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-data-dir-override-ok
|
|
|
|
Config Path Overrides Config Service Path
|
|
[Documentation] Verify --config-path properly overrides the config service path.
|
|
${result}= Run Process ${PYTHON} ${HELPER} config-path-override cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-config-path-override-ok
|
|
|
|
Verbosity Sets Log Level Correctly
|
|
[Documentation] Verify -v count correctly maps to log levels.
|
|
${result}= Run Process ${PYTHON} ${HELPER} verbosity-levels cwd=${WORKSPACE}
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} cli-global-options-verbosity-levels-ok
|
|
|
|
Help Shows All Three Options
|
|
[Documentation] Verify --help output includes --data-dir, --config-path, and -v.
|
|
${result}= Run Process ${PYTHON} -m cleveragents --help
|
|
... timeout=60s on_timeout=kill
|
|
Log ${result.stdout}
|
|
Log ${result.stderr}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} --data-dir
|
|
Should Contain ${result.stdout} --config-path
|
|
Should Contain ${result.stdout} -v
|