31472b5413
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m8s
CI / integration_tests (pull_request) Successful in 9m33s
CI / unit_tests (pull_request) Successful in 10m12s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m18s
CI / e2e_tests (pull_request) Successful in 19m51s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 15s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 3m18s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m57s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m10s
CI / unit_tests (push) Failing after 6m58s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 9m15s
CI / coverage (push) Successful in 12m26s
CI / e2e_tests (push) Successful in 23m11s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Successful in 28m31s
CI / benchmark-regression (pull_request) Successful in 54m53s
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate. ISSUES CLOSED: #1232
88 lines
4.5 KiB
Gherkin
88 lines
4.5 KiB
Gherkin
Feature: FsDirectoryHandler uncovered-line coverage
|
|
Exercise code paths in fs_directory.py that lack test coverage:
|
|
delete with empty path (L133), delete subdirectory (L143),
|
|
diff with missing files on either side (L197, L204),
|
|
create_checkpoint with no sandbox (L287-289),
|
|
rollback_to with no sandbox (L329-331),
|
|
rollback_to with missing checkpoint (L336-339),
|
|
rollback_to .git skipping and directory handling (L347,349,357,360),
|
|
and discard_checkpoints (L374-381).
|
|
|
|
Scenario: Delete with empty path raises PermissionError
|
|
Given fsdcov a temp directory with a file "hello.txt"
|
|
When fsdcov I delete with an empty path
|
|
Then fsdcov a PermissionError is raised with message "Cannot delete the resource root"
|
|
|
|
Scenario: Delete a subdirectory removes it via rmtree
|
|
Given fsdcov a temp directory with a subdirectory "subdir" containing "inner.txt"
|
|
When fsdcov I delete subdirectory "subdir"
|
|
Then fsdcov the delete result is successful
|
|
And fsdcov the subdirectory "subdir" no longer exists
|
|
|
|
Scenario: Diff when a file exists only in the other location
|
|
Given fsdcov a temp directory "dir_a" with no files
|
|
And fsdcov a temp directory "dir_b" with file "only_b.txt" containing "new content"
|
|
When fsdcov I diff dir_a against dir_b
|
|
Then fsdcov the diff shows changes with insertions
|
|
|
|
Scenario: Diff when a file exists only in the resource location
|
|
Given fsdcov a temp directory "dir_a" with file "only_a.txt" containing "old content"
|
|
And fsdcov a temp directory "dir_b" with no files
|
|
When fsdcov I diff dir_a against dir_b
|
|
Then fsdcov the diff shows changes with deletions
|
|
|
|
Scenario: create_checkpoint raises RuntimeError when sandbox is None
|
|
Given fsdcov a handler and a resource with location
|
|
And fsdcov a sandbox manager that returns None for get_sandbox
|
|
When fsdcov I call create_checkpoint
|
|
Then fsdcov a RuntimeError is raised with message "No active sandbox"
|
|
|
|
Scenario: create_checkpoint raises RuntimeError when sandbox context is None
|
|
Given fsdcov a handler and a resource with location
|
|
And fsdcov a sandbox manager that returns sandbox with no context
|
|
When fsdcov I call create_checkpoint
|
|
Then fsdcov a RuntimeError is raised with message "No active sandbox"
|
|
|
|
Scenario: rollback_to raises RuntimeError when sandbox is None
|
|
Given fsdcov a handler and a resource with location
|
|
And fsdcov a sandbox manager that returns None for get_sandbox
|
|
When fsdcov I call rollback_to with checkpoint "ckpt-1"
|
|
Then fsdcov a RuntimeError is raised with message "No active sandbox"
|
|
|
|
Scenario: rollback_to raises RuntimeError when sandbox context is None
|
|
Given fsdcov a handler and a resource with location
|
|
And fsdcov a sandbox manager that returns sandbox with no context
|
|
When fsdcov I call rollback_to with checkpoint "ckpt-1"
|
|
Then fsdcov a RuntimeError is raised with message "No active sandbox"
|
|
|
|
Scenario: rollback_to returns failure for unknown checkpoint
|
|
Given fsdcov a handler and a resource with location
|
|
And fsdcov a sandbox manager with a valid sandbox
|
|
When fsdcov I call rollback_to with checkpoint "nonexistent-ckpt"
|
|
Then fsdcov the rollback result is unsuccessful with message "not found or expired"
|
|
|
|
Scenario: rollback_to returns failure for expired checkpoint path
|
|
Given fsdcov a handler with a checkpoint pointing to a deleted path
|
|
And fsdcov a sandbox manager with a valid sandbox
|
|
When fsdcov I call rollback_to with the expired checkpoint
|
|
Then fsdcov the rollback result is unsuccessful with message "not found or expired"
|
|
|
|
Scenario: rollback_to skips .git and restores dirs and files
|
|
Given fsdcov a handler with a real checkpoint snapshot
|
|
And fsdcov a sandbox with .git dir and other content
|
|
When fsdcov I call rollback_to with the real checkpoint
|
|
Then fsdcov the rollback result is successful
|
|
And fsdcov the .git directory is preserved in the sandbox
|
|
And fsdcov the snapshot content is restored in the sandbox
|
|
|
|
Scenario: discard_checkpoints removes matching checkpoints
|
|
Given fsdcov a handler with two checkpoints for plan "plan-abc"
|
|
When fsdcov I call discard_checkpoints with plan_id "plan-abc"
|
|
Then fsdcov discard_checkpoints returns 2
|
|
And fsdcov no checkpoints remain for plan "plan-abc"
|
|
|
|
Scenario: discard_checkpoints with empty plan_id removes all
|
|
Given fsdcov a handler with checkpoints for different plans
|
|
When fsdcov I call discard_checkpoints with empty plan_id
|
|
Then fsdcov all checkpoints are removed
|