Files
cleveragents-core/features/sandbox_manager_coverage_r3.feature
freemo 31472b5413 test(coverage): add Behave scenarios for 39 under-covered modules
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate.

ISSUES CLOSED: #1232
2026-03-31 21:47:12 +00:00

63 lines
3.7 KiB
Gherkin

Feature: Sandbox Manager Coverage Round 3
Exercises uncovered lines in SandboxManager:
- TransactionSandbox branch in commit_all (lines 287-295)
- resolve_sandbox_key validation (lines 567, 569)
- get_or_create_sandbox_for_resource validation (lines 606, 608, 610, 623)
Background:
Given smcov3 a sandbox factory instance
And smcov3 a sandbox manager with the factory
# -- TransactionSandbox non-rollbackable classification in commit_all ------
Scenario: commit_all classifies a TransactionSandbox as non-rollbackable
Given smcov3 a sandbox exists for plan "plan-t1" resource "res-t1" path "/tmp/r1" strategy "none"
And smcov3 the sandbox for plan "plan-t1" resource "res-t1" is replaced with a transaction sandbox mock
When smcov3 I commit all sandboxes for plan "plan-t1"
Then smcov3 the commit results should contain 1 successful result
And smcov3 no error should have been raised
Scenario: commit_all orders TransactionSandbox after rollbackable sandboxes
Given smcov3 a sandbox exists for plan "plan-t2" resource "res-r1" path "/tmp/r1" strategy "none"
And smcov3 the sandbox for plan "plan-t2" resource "res-r1" is replaced with a committable mock
And smcov3 a sandbox exists for plan "plan-t2" resource "res-t1" path "/tmp/t1" strategy "none"
And smcov3 the sandbox for plan "plan-t2" resource "res-t1" is replaced with a transaction sandbox mock
And smcov3 a sandbox exists for plan "plan-t2" resource "res-fail" path "/tmp/f1" strategy "none"
And smcov3 the sandbox for plan "plan-t2" resource "res-fail" will fail on commit
When smcov3 I commit all sandboxes for plan "plan-t2"
Then smcov3 the transaction sandbox mock for plan "plan-t2" resource "res-t1" should not have been committed
Scenario: commit_all with only a TransactionSandbox commits successfully
Given smcov3 a sandbox exists for plan "plan-t3" resource "res-t1" path "/tmp/t1" strategy "none"
And smcov3 the sandbox for plan "plan-t3" resource "res-t1" is replaced with a transaction sandbox mock
When smcov3 I commit all sandboxes for plan "plan-t3"
Then smcov3 the commit results should contain 1 successful result
# -- resolve_sandbox_key validation ----------------------------------------
Scenario: resolve_sandbox_key rejects None resource
When smcov3 I call resolve_sandbox_key with None resource
Then smcov3 a ValueError should have been raised with message "resource cannot be None"
Scenario: resolve_sandbox_key rejects None resource_registry
When smcov3 I call resolve_sandbox_key with None resource_registry
Then smcov3 a ValueError should have been raised with message "resource_registry cannot be None"
# -- get_or_create_sandbox_for_resource validation -------------------------
Scenario: get_or_create_sandbox_for_resource rejects empty plan_id
When smcov3 I call get_or_create_sandbox_for_resource with empty plan_id
Then smcov3 a ValueError should have been raised with message "plan_id cannot be empty"
Scenario: get_or_create_sandbox_for_resource rejects None resource
When smcov3 I call get_or_create_sandbox_for_resource with None resource
Then smcov3 a ValueError should have been raised with message "resource cannot be None"
Scenario: get_or_create_sandbox_for_resource rejects None resource_registry
When smcov3 I call get_or_create_sandbox_for_resource with None resource_registry
Then smcov3 a ValueError should have been raised with message "resource_registry cannot be None"
Scenario: get_or_create_sandbox_for_resource rejects boundary with no location
When smcov3 I call get_or_create_sandbox_for_resource with a boundary that has no location
Then smcov3 a ValueError should have been raised with message "has no location"