Files
cleveragents-core/features/repositories_coverage_boost.feature
T
Jeffrey Phillips Freeman 36c571db83
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 30s
CI / security (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 16s
CI / integration_tests (pull_request) Successful in 5m12s
CI / build (pull_request) Successful in 16s
CI / lint (push) Successful in 13s
CI / typecheck (push) Successful in 29s
CI / security (push) Successful in 23s
CI / quality (push) Successful in 16s
CI / unit_tests (pull_request) Successful in 13m42s
CI / integration_tests (push) Successful in 4m53s
CI / build (push) Successful in 16s
CI / unit_tests (push) Successful in 15m9s
CI / coverage (pull_request) Successful in 7m58s
CI / coverage (push) Successful in 8m14s
CI / docker (pull_request) Successful in 9s
CI / docker (push) Successful in 8s
feat(repo): add resource repositories
2026-02-16 21:35:54 +00:00

138 lines
7.0 KiB
Gherkin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@phase1 @domain @repository @coverage_boost
Feature: Repository coverage boost for actions, plans, and resources
As a developer ensuring high test coverage
I want to exercise uncovered repository branches
So that the persistence layer is thoroughly tested
Background:
Given a fresh in-memory database with full lifecycle schema
And an action repository using the session factory
And a lifecycle plan repository using the session factory
# ---------------------------------------------------------------------------
# ActionRepository.update non-existent action raises DatabaseError
# ---------------------------------------------------------------------------
@action_update @error_handling
Scenario: Updating a non-existent action raises DatabaseError with "not found for update"
Given a valid action object named "local/ghost-action"
When the action is updated without being persisted first
Then a DatabaseError mentioning "not found for update" should be raised
# ---------------------------------------------------------------------------
# ActionRepository.update with arguments (including default_value) and invariants
# ---------------------------------------------------------------------------
@action_update
Scenario: Updating an action replaces its child arguments and invariants
Given a valid action object named "local/updatable-with-children"
And the action has been persisted in the database
When the action arguments are replaced with new arguments including defaults
And the action invariants are set to new invariant texts
And the action is updated via the repository
Then the update should succeed without error
And retrieving the action should show the new arguments
And retrieving the action should show the new invariants
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.get_by_name
# ---------------------------------------------------------------------------
@plan_read
Scenario: A lifecycle plan is retrieved by its namespaced name
Given a valid action object named "local/plan-action-lookup"
And the action has been persisted in the database
And a lifecycle plan domain object linked to "local/plan-action-lookup"
And the lifecycle plan has been persisted in the database
When the lifecycle plan is looked up by namespaced name
Then the returned plan should match the original plan identity
@plan_read
Scenario: Looking up a non-existent plan by name returns nothing
When a lifecycle plan is looked up by name "local/nonexistent-plan"
Then no lifecycle plan should be returned
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.update PlanNotFoundError
# ---------------------------------------------------------------------------
@plan_update @error_handling
Scenario: Updating a non-existent lifecycle plan raises PlanNotFoundError
Given a valid action object named "local/plan-action-missing"
And the action has been persisted in the database
And a lifecycle plan domain object linked to "local/plan-action-missing"
When the lifecycle plan is updated without being persisted first
Then a PlanNotFoundError should be raised
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.update with project_links, arguments, invariants
# ---------------------------------------------------------------------------
@plan_update
Scenario: Updating a plan replaces project links, arguments, and invariants
Given a valid action object named "local/plan-action-update"
And the action has been persisted in the database
And a lifecycle plan domain object linked to "local/plan-action-update"
And the lifecycle plan has been persisted in the database
When the plan is updated with project links, arguments, and invariants
Then the plan update should succeed without error
And retrieving the plan should show the new project links
And retrieving the plan should show the new plan arguments
And retrieving the plan should show the new plan invariants
# ---------------------------------------------------------------------------
# LifecyclePlanRepository.list_plans filtered by phase
# ---------------------------------------------------------------------------
@plan_list
Scenario: Listing plans filtered by phase returns only matching plans
Given a valid action object named "local/plan-action-phase"
And the action has been persisted in the database
And lifecycle plans in different phases linked to "local/plan-action-phase"
When plans are listed filtered by phase "strategize"
Then only the strategize-phase plans should be returned
# ---------------------------------------------------------------------------
# ResourceTypeRepository create, get, list_types
# ---------------------------------------------------------------------------
@resource_type
Scenario: A resource type is created and retrieved by name
Given a resource type repository using the session factory
And a valid resource type domain object named "test/my-git-checkout"
When the resource type is created through the repository
Then the resource type should be retrievable by name "test/my-git-checkout"
@resource_type @error_handling
Scenario: Creating a duplicate resource type raises DuplicateResourceTypeError
Given a resource type repository using the session factory
And a valid resource type domain object named "test/dup-type"
And the resource type has been persisted in the database
When the same resource type is created again
Then a DuplicateResourceTypeError should be raised
# ---------------------------------------------------------------------------
# ResourceRepository create, get, get_by_name, list_resources by type
# ---------------------------------------------------------------------------
@resource
Scenario: A resource is created and retrieved by ID and name
Given a resource type repository using the session factory
And a resource repository using the session factory
And a valid resource type domain object named "test/res-type-a"
And the resource type has been persisted in the database
And a valid resource domain object of type "test/res-type-a"
When the resource is created through the repository
Then the resource should be retrievable by its ID
And the resource should be retrievable by its namespaced name
@resource
Scenario: Resources are listed by type name
Given a resource type repository using the session factory
And a resource repository using the session factory
And a valid resource type domain object named "test/list-type"
And the resource type has been persisted in the database
And multiple resources of type "test/list-type" have been created
When resources are listed by type "test/list-type"
Then all resources of that type should be returned