Files
cleveragents-core/features/server_cli_coverage_boost.feature
freemo a808c395f9
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 17s
CI / typecheck (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / unit_tests (pull_request) Successful in 2m46s
CI / integration_tests (pull_request) Successful in 3m16s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 5m6s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 16s
CI / build (push) Successful in 18s
CI / security (push) Successful in 32s
CI / typecheck (push) Successful in 35s
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Successful in 2m52s
CI / integration_tests (push) Successful in 3m8s
CI / docker (push) Successful in 39s
CI / coverage (push) Successful in 5m53s
CI / benchmark-publish (push) Successful in 16m55s
CI / benchmark-regression (pull_request) Successful in 33m0s
test(coverage): add Behave BDD tests to improve unit test coverage across 53 source modules
Add 53 new .feature files and corresponding step definition files targeting
uncovered lines identified in build/coverage.xml. Fix AmbiguousStep conflicts
in 7 pre-existing step files by disambiguating step text.

New tests cover: ACP clients/facade, actor CLI/config, application container,
ACMS service/strategies, async worker, automation profile CLI, autonomy
guardrail, bridge, change model, config CLI/service, context service,
cross-plan correction, database models, decision service, decomposition
clustering/service, discovery handler, langchain chat provider, langgraph
nodes, materializers, multi-project service, plan apply/CLI/lifecycle/model/
preflight/resume/service, PostgreSQL analyzer, project CLI/context CLI,
provider registry, reactive application/route, repositories, resolver handler,
resource registry service, resume model, retry patterns, sandbox protocol,
server CLI, skill CLI/service, skills registry, subplan execution/service,
system CLI, UKO loader, UoW, and YAML template engine.

Closes #645
2026-03-09 13:01:58 -04:00

104 lines
5.3 KiB
Gherkin

@phase2 @acp @server-cli-coverage
Feature: Server CLI command coverage boost
As a developer
I want full test coverage for server.py CLI commands
So that the server_connect (rich format), server_status, and resolve_server_mode
error paths are all exercised
# -----------------------------------------------------------------------
# resolve_server_mode exception paths (lines 58-59)
# -----------------------------------------------------------------------
Scenario: resolve_server_mode returns disabled when resolve raises ValueError
Given a mock config service that raises ValueError on resolve
When I call resolve_server_mode with the mock
Then the server mode should be "disabled"
Scenario: resolve_server_mode returns disabled when resolve raises KeyError
Given a mock config service that raises KeyError on resolve
When I call resolve_server_mode with the mock
Then the server mode should be "disabled"
# -----------------------------------------------------------------------
# server_connect — rich format output (lines 132-142)
# -----------------------------------------------------------------------
Scenario: server_connect renders Rich Panel when format is rich
Given a mock config service that accepts writes
When I call server_connect with url "https://rich.example.com" and rich format
Then the captured console output should contain "Server Connection (Stub)"
And the captured console output should contain "https://rich.example.com"
And the captured console output should contain "stubbed"
And the captured console output should contain "not yet implemented"
Scenario: server_connect rich output includes namespace and TLS verify
Given a mock config service that accepts writes
When I call server_connect with url "https://ns.example.com" namespace "my-team" tls_verify false and rich format
Then the captured console output should contain "my-team"
And the captured console output should contain "False"
# -----------------------------------------------------------------------
# server_status — full function, no URL configured (lines 157-204)
# -----------------------------------------------------------------------
Scenario: server_status with json format when no URL is configured
Given a mock config service that resolves with no server config
When I call server_status with format "json"
Then the echoed output should contain "disabled"
And the echoed output should contain "server_mode"
Scenario: server_status with plain format when no URL is configured
Given a mock config service that resolves with no server config
When I call server_status with format "plain"
Then the echoed output should contain "disabled"
# -----------------------------------------------------------------------
# server_status — URL is configured (stubbed mode)
# -----------------------------------------------------------------------
Scenario: server_status with json format when URL is configured
Given a mock config service that resolves with full server config
When I call server_status with format "json"
Then the echoed output should contain "stubbed"
And the echoed output should contain "https://configured.example.com"
And the echoed output should contain "production"
# -----------------------------------------------------------------------
# server_status — rich format rendering (lines 196-206)
# -----------------------------------------------------------------------
Scenario: server_status renders Rich Panel when format is rich and no URL
Given a mock config service that resolves with no server config
When I call server_status with format "rich"
Then the captured console output should contain "Server Status"
And the captured console output should contain "disabled"
And the captured console output should contain "(not configured)"
Scenario: server_status renders Rich Panel when format is rich and URL is configured
Given a mock config service that resolves with full server config
When I call server_status with format "rich"
Then the captured console output should contain "Server Status"
And the captured console output should contain "stubbed"
And the captured console output should contain "https://configured.example.com"
# -----------------------------------------------------------------------
# server_status — exception paths for namespace / tls-verify (lines 168-183)
# -----------------------------------------------------------------------
Scenario: server_status defaults namespace when resolve raises ValueError
Given a mock config service where namespace resolve raises ValueError
When I call server_status with format "json"
Then the echoed output should contain "default"
Scenario: server_status defaults tls_verify when resolve raises KeyError
Given a mock config service where tls-verify resolve raises KeyError
When I call server_status with format "json"
Then the echoed output should contain "true"
Scenario: server_status defaults all fields when all resolves raise exceptions
Given a mock config service where all resolves raise exceptions
When I call server_status with format "json"
Then the echoed output should contain "disabled"
And the echoed output should contain "null"
And the echoed output should contain "default"