9cace15d6e
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 20s
CI / typecheck (pull_request) Successful in 47s
CI / quality (pull_request) Successful in 48s
CI / build (pull_request) Successful in 15s
CI / helm (pull_request) Successful in 22s
CI / security (pull_request) Successful in 4m18s
CI / integration_tests (pull_request) Successful in 6m19s
CI / unit_tests (pull_request) Successful in 6m39s
CI / docker (pull_request) Successful in 1m32s
CI / coverage (pull_request) Successful in 12m6s
CI / e2e_tests (pull_request) Successful in 19m6s
CI / status-check (pull_request) Successful in 2s
CI / quality (push) Successful in 45s
CI / build (push) Successful in 17s
CI / helm (push) Successful in 23s
CI / lint (push) Successful in 3m16s
CI / integration_tests (push) Successful in 3m50s
CI / typecheck (push) Successful in 3m54s
CI / security (push) Successful in 4m4s
CI / unit_tests (push) Successful in 8m31s
CI / docker (push) Successful in 1m22s
CI / coverage (push) Successful in 12m12s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 21m14s
CI / status-check (push) Successful in 2s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (pull_request) Successful in 59m1s
E2E test for Specification Workflow Example 18: Container with Remote Repo Clone using the trusted automation profile. Exercises the full container-instance workflow per the spec: - Registers a container-instance resource with --clone-into flag (new CLI flag added to resource add for REPO_URL:CONTAINER_PATH). - Two-step project creation: project create + project link-resource. - Dynamic LLM actor selection (Anthropic/OpenAI) matching available API keys. - Plan use with --execution-environment container, --execution-env-priority fallback, and --automation-profile trusted. - Full plan lifecycle: strategize, execute, diff, apply, status. - Positive assertions: non-empty output, plan ID presence, terminal state verification, container/clone evidence logging. - Negative assertions: Traceback and INTERNAL error checks. - ULID regex uses Crockford base32 character set. - Unique suffix for resource/project names (parallel CI safe). - Skip If No LLM Keys guard for graceful degradation. - CHANGELOG.md updated. ISSUES CLOSED: #764
244 lines
10 KiB
Gherkin
244 lines
10 KiB
Gherkin
Feature: Resource CLI error path coverage
|
|
As a developer
|
|
I want the resource CLI error handling paths thoroughly tested
|
|
So that resource.py has high code coverage
|
|
|
|
Background:
|
|
Given a fresh in-memory resource registry
|
|
|
|
# ---- type_add error paths ----
|
|
|
|
Scenario: type add with --update flag on existing type
|
|
Given built-in types are bootstrapped
|
|
Given a valid custom resource type YAML file
|
|
And I run resource type add with the config file
|
|
When I run resource type add with the config file using update flag
|
|
Then the resource command should fail
|
|
And the resource output should contain "already exists"
|
|
|
|
Scenario: type add with non-existent config triggers FileNotFoundError
|
|
When I run resource type add with a nonexistent config file
|
|
Then the resource command should fail
|
|
And the resource output should contain "not found"
|
|
|
|
Scenario: type add with validation error
|
|
Given a custom resource type YAML file with invalid schema
|
|
When I run resource type add with the config file
|
|
Then the resource command should fail
|
|
|
|
Scenario: type add with non-rich format
|
|
Given a valid custom resource type YAML file
|
|
When I run resource type add with the config file and format "json"
|
|
Then the resource output should be valid JSON
|
|
|
|
# ---- type_remove error paths ----
|
|
|
|
Scenario: type remove confirmation prompt aborted
|
|
Given a valid custom resource type YAML file
|
|
And I run resource type add with the config file
|
|
When I run resource type remove "test/custom-type" without yes flag
|
|
Then the resource command should fail
|
|
|
|
Scenario: type remove non-existent type raises NotFoundError
|
|
When I run resource type remove "nonexistent/type" with yes flag
|
|
Then the resource command should fail
|
|
And the resource output should contain "not found"
|
|
|
|
Scenario: type remove with resources referencing custom type
|
|
Given a valid custom resource type YAML file
|
|
And I run resource type add with the config file
|
|
And I add a resource referencing custom type "test/custom-type"
|
|
When I run resource type remove "test/custom-type" with yes flag
|
|
Then the resource command should fail
|
|
And the resource output should contain "Cannot remove"
|
|
|
|
# ---- type_show error paths ----
|
|
|
|
Scenario: type show non-rich format
|
|
Given built-in types are bootstrapped
|
|
When I run resource type show "git-checkout" using format "yaml"
|
|
Then the resource output should contain "name"
|
|
|
|
Scenario: type show with plain format
|
|
Given built-in types are bootstrapped
|
|
When I run resource type show "git-checkout" using format "plain"
|
|
Then the resource output should contain "git-checkout"
|
|
|
|
# ---- type_list non-rich format ----
|
|
|
|
Scenario: type list with yaml format
|
|
Given built-in types are bootstrapped
|
|
When I run resource type list with format "yaml"
|
|
Then the resource output should contain "name"
|
|
|
|
Scenario: type list with plain format
|
|
Given built-in types are bootstrapped
|
|
When I run resource type list with format "plain"
|
|
Then the resource output should contain "git-checkout"
|
|
|
|
# ---- resource_add error paths ----
|
|
|
|
Scenario: resource add with non-rich format
|
|
Given built-in types are bootstrapped
|
|
When I run resource add formatted as "json" type "git-checkout" name "local/fmt-test" path "/tmp/fmt"
|
|
Then the resource output should be valid JSON
|
|
|
|
Scenario: resource add with description and branch
|
|
Given built-in types are bootstrapped
|
|
When I run resource add with extras type "git-checkout" name "local/branch-test" path "/tmp/b" branch "main" description "My repo"
|
|
Then the resource output should contain "local/branch-test"
|
|
|
|
Scenario: resource add with validation error for non-existent type
|
|
When I run resource add "nonexistent" "local/test" with path "/tmp"
|
|
Then the resource command should fail
|
|
And the resource output should contain "not found"
|
|
|
|
# ---- resource_list error paths ----
|
|
|
|
Scenario: resource list with non-rich format
|
|
Given built-in types are bootstrapped
|
|
And I run resource add "git-checkout" "local/list-fmt" with path "/tmp/lfmt"
|
|
When I run resource list with format "json"
|
|
Then the resource output should be valid JSON
|
|
|
|
Scenario: resource list with long description truncation
|
|
Given built-in types are bootstrapped
|
|
And I add a resource with a long description
|
|
When I run resource list
|
|
Then the resource output should contain "local/long-desc"
|
|
|
|
# ---- resource_show error paths ----
|
|
|
|
Scenario: resource show with non-rich format
|
|
Given built-in types are bootstrapped
|
|
And I run resource add "git-checkout" "local/show-fmt" with path "/tmp/sfmt"
|
|
When I run resource show "local/show-fmt" using format "json"
|
|
Then the resource output should be valid JSON
|
|
|
|
Scenario: resource show with empty properties
|
|
Given built-in types are bootstrapped
|
|
And I run resource add "git-checkout" "local/no-props" with path "/tmp/np"
|
|
When I run resource show "local/no-props" using default format
|
|
Then the resource output should contain "local/no-props"
|
|
|
|
# ---- resource_remove error paths ----
|
|
|
|
Scenario: resource remove confirmation prompt aborted
|
|
Given built-in types are bootstrapped
|
|
And I run resource add "git-checkout" "local/no-confirm" with path "/tmp/nc"
|
|
When I run resource remove "local/no-confirm" without yes flag
|
|
Then the resource command should fail
|
|
|
|
Scenario: resource remove non-existent resource raises NotFoundError
|
|
When I run resource remove "nonexistent" with yes flag
|
|
Then the resource command should fail
|
|
And the resource output should contain "not found"
|
|
|
|
# ---- CleverAgentsError catch-all paths ----
|
|
|
|
Scenario: type list raises CleverAgentsError
|
|
Given a service that raises CleverAgentsError on list_types
|
|
When I run resource type list
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: type show raises CleverAgentsError
|
|
Given a service that raises CleverAgentsError on show_type
|
|
When I run resource type show "anything" using default format
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: type add raises CleverAgentsError
|
|
Given a valid custom resource type YAML file
|
|
And a service that raises CleverAgentsError on register_type
|
|
When I run resource type add with the config file
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: type remove raises CleverAgentsError
|
|
Given a service that raises CleverAgentsError on show_type
|
|
When I run resource type remove "anything" with yes flag
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: resource add ValidationError
|
|
Given a service that raises ValidationError on register_resource
|
|
When I run resource add "git-checkout" "local/test" with path "/tmp"
|
|
Then the resource command should fail
|
|
And the resource output should contain "Validation error"
|
|
|
|
Scenario: resource add CleverAgentsError
|
|
Given a service that raises CleverAgentsError on register_resource
|
|
When I run resource add "git-checkout" "local/test" with path "/tmp"
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: resource list raises CleverAgentsError
|
|
Given a service that raises CleverAgentsError on list_resources
|
|
When I run resource list
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: resource show raises CleverAgentsError
|
|
Given a service that raises CleverAgentsError on show_resource
|
|
When I run resource show "anything" using default format
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
Scenario: resource remove raises CleverAgentsError
|
|
Given a service that raises CleverAgentsError on show_resource
|
|
When I run resource remove "anything" with yes flag
|
|
Then the resource command should fail
|
|
And the resource output should contain "Error"
|
|
|
|
# ---- Additional path coverage ----
|
|
|
|
Scenario: type show with rich format shows panel for type without cli_args
|
|
Given a type without cli_args is registered
|
|
When I run resource type show "test/no-args" using default format
|
|
Then the resource output should contain "test/no-args"
|
|
|
|
Scenario: resource show with truly empty properties
|
|
Given built-in types are bootstrapped
|
|
And I add a resource with empty properties
|
|
When I run resource show "local/empty-props" using default format
|
|
Then the resource output should contain "local/empty-props"
|
|
And the resource output should contain "none"
|
|
|
|
Scenario: resource remove succeeds with session delete
|
|
Given built-in types are bootstrapped
|
|
And I run resource add "git-checkout" "local/to-delete" with path "/tmp/del"
|
|
When I run resource remove "local/to-delete" with yes flag
|
|
Then the resource output should contain "Removed resource"
|
|
|
|
Scenario: type add FileNotFoundError catch
|
|
When I run resource type add with path to missing file
|
|
Then the resource command should fail
|
|
And the resource output should contain "not found"
|
|
|
|
# ---- --clone-into flag coverage ----
|
|
|
|
Scenario: resource add container-instance with --clone-into stores clone_into property
|
|
Given built-in types are bootstrapped
|
|
When I run resource add "container-instance" "local/clone-test" with clone-into "https://github.com/acme/api.git:/workspace"
|
|
Then the resource output should contain "local/clone-test"
|
|
And the resource output should contain "Added resource"
|
|
|
|
Scenario: resource add with --clone-into on non-container type fails
|
|
Given built-in types are bootstrapped
|
|
When I run resource add "git-checkout" "local/bad-clone" with clone-into "https://github.com/acme/api.git:/workspace"
|
|
Then the resource command should fail
|
|
And the resource output should contain "Validation error"
|
|
|
|
Scenario: resource add with --clone-into in invalid format fails
|
|
Given built-in types are bootstrapped
|
|
When I run resource add "container-instance" "local/bad-fmt" with clone-into "no-colon-separator"
|
|
Then the resource command should fail
|
|
And the resource output should contain "Validation error"
|
|
|
|
Scenario: resource add with --clone-into missing path segment fails
|
|
Given built-in types are bootstrapped
|
|
When I run resource add "container-instance" "local/bad-path" with clone-into "https://github.com/acme/api.git:"
|
|
Then the resource command should fail
|
|
And the resource output should contain "Validation error"
|