forked from cleveragents/cleveragents-core
43 lines
2.1 KiB
Gherkin
43 lines
2.1 KiB
Gherkin
Feature: Cleanup CLI uncovered branches
|
|
Cover missed lines and branches in cleveragents.cli.commands.cleanup:
|
|
L49-50 (inner OSError in _detect_active_plan_ids),
|
|
L52-58 (outer OSError),
|
|
L87→94 (scan with no stale items),
|
|
L128-131 (purge dry-run with stale items),
|
|
L139→143 (purge confirmation prompt accepted).
|
|
|
|
Scenario: scan reports no stale resources when report is empty
|
|
Given cleanup cli branch mock service returns empty report
|
|
When cleanup cli branch I invoke scan via main app
|
|
Then cleanup cli branch exit code is 0
|
|
And cleanup cli branch output contains "No stale resources found"
|
|
|
|
Scenario: purge dry-run lists stale items when present
|
|
Given cleanup cli branch mock service returns report with stale items
|
|
When cleanup cli branch I invoke purge dry-run via main app
|
|
Then cleanup cli branch exit code is 0
|
|
And cleanup cli branch output contains "Would clean:"
|
|
And cleanup cli branch output contains "/tmp/fake-sandbox"
|
|
|
|
Scenario: detect active plan ids handles inner OSError on stat
|
|
Given cleanup cli branch a service whose sandbox dir stat raises OSError
|
|
When cleanup cli branch I call detect active plan ids
|
|
Then cleanup cli branch the result is an empty frozenset
|
|
|
|
Scenario: detect active plan ids handles outer OSError from get sandbox dirs
|
|
Given cleanup cli branch a service whose get sandbox dirs raises OSError
|
|
When cleanup cli branch I call detect active plan ids
|
|
Then cleanup cli branch the result is an empty frozenset
|
|
And cleanup cli branch a warning was printed about active plans
|
|
|
|
Scenario: detect active plan ids returns empty frozenset for empty dir list
|
|
Given cleanup cli branch a service with no sandbox dirs
|
|
When cleanup cli branch I call detect active plan ids
|
|
Then cleanup cli branch the result is an empty frozenset
|
|
|
|
Scenario: purge with confirmation prompt accepted proceeds to purge
|
|
Given cleanup cli branch mock service returns purge report
|
|
When cleanup cli branch I invoke purge with confirmation y via main app
|
|
Then cleanup cli branch exit code is 0
|
|
And cleanup cli branch output contains "Cleanup Complete"
|