565e7918a3
CI / typecheck (pull_request) Successful in 44s
CI / security (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 32s
CI / lint (pull_request) Successful in 3m28s
CI / helm (pull_request) Successful in 23s
CI / build (pull_request) Successful in 54s
CI / unit_tests (pull_request) Failing after 6m21s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Failing after 16m7s
CI / integration_tests (pull_request) Successful in 22m39s
CI / coverage (pull_request) Successful in 10m36s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m9s
Implemented an explicit --container-id option as an alternative to --image for container-instance resources and added comprehensive validation, data storage, and fast-path container resolution. - Added --container-id option to resource_add() in src/cleveragents/cli/commands/resource.py as an alternative to --image for container-instance resources - Enforced mutual exclusion: --container-id and --image are mutually exclusive; container-instance requires one or the other - Restricted --container-id to container-instance only (not devcontainer-instance) - Persisted container_id in resource properties when provided - Updated DevcontainerHandler._find_running_container() in src/cleveragents/resource/handlers/devcontainer.py to use the stored container_id as a fast path before falling back to docker label search - Added container_id to container-instance cli_args in src/cleveragents/application/services/_resource_registry_data.py - Created features/container_id_flag.feature and features/steps/container_id_flag_steps.py with 5 unit test scenarios - Created features/container_id_integration.feature and features/steps/container_id_integration_steps.py with 5 integration test scenarios Key design decisions: - Used isinstance(stored_id, str) guard in handler for Pyright type narrowing - Validation raises typer.Abort() for clean CLI error handling - No behavioral changes for devcontainer-instance resources ISSUES CLOSED: #2598
28 lines
1.6 KiB
Gherkin
28 lines
1.6 KiB
Gherkin
@container-id
|
|
Feature: container-instance --container-id flag
|
|
Verifies that resource add container-instance accepts --container-id
|
|
as an alternative to --image, enforces mutual exclusion, and that
|
|
the DevcontainerHandler fast path returns the stored container ID.
|
|
|
|
Scenario: Happy path - container-instance with --container-id stores the ID
|
|
Given a resource registry service for container_id
|
|
When I add a container-instance with container-id "abc123def456" for container_id
|
|
Then the container_id resource should have container_id "abc123def456"
|
|
|
|
Scenario: Mutual exclusion - providing both --container-id and --image fails
|
|
When I validate container-instance with both container-id "abc123" and image "ubuntu:latest" for container_id
|
|
Then container_id validation should fail with "mutually exclusive"
|
|
|
|
Scenario: Neither provided - container-instance without --image or --container-id fails
|
|
When I validate container-instance with neither container-id nor image for container_id
|
|
Then container_id validation should fail with "require either"
|
|
|
|
Scenario: Wrong type - --container-id on git-checkout fails
|
|
When I validate type "git-checkout" with container-id "abc123" for container_id
|
|
Then container_id validation should fail with "only valid for container-instance"
|
|
|
|
Scenario: Handler fast path - _find_running_container returns stored container_id
|
|
Given a resource with container_id "abc123def456" in properties for container_id
|
|
When I call _find_running_container for container_id
|
|
Then the container_id result should be "abc123def456"
|