[tests-only][full-ci]test(cli): add clean-orphaned-grants CLI test scenarios#12470
[tests-only][full-ci]test(cli): add clean-orphaned-grants CLI test scenarios#12470anon-pradip wants to merge 4 commits into
Conversation
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
0529324 to
95f3f47
Compare
DeepDiver1975
left a comment
There was a problem hiding this comment.
Reviewed as tests-only — looks good overall. The 4 scenarios build real ocis shares clean-orphaned-grants invocations (correct --service-account-id/secret, --space-id, --force, --dry-run=false flags) through CliHelper::runCommand, and every asserted output substring maps to an actual print statement in ocis/pkg/command/shares.go (pre-flight mode/scope/force lines, == Primary scan ==, Summary:, Orphans:/Reverse orphans: counts). The flag-specific assertions (scope: limiting scan to space, 1 target space(s), flags: --force active) keep the scenarios genuinely distinct and exercise different branches. No hard sleeps, no cross-scenario ordering deps, and the assertion steps (the command output should contain, the command should be successful) are the existing harness steps that decode the JSON response and assert on real stdout — not no-ops. CI is fully green, including the cliCommands acceptance job.
One observation (non-blocking): all scenarios assert Orphans: 0 candidate(s) / Reverse orphans: 0 candidate(s) and none set up a genuinely orphaned grant, so the count is effectively pinned at 0 in every path (incl. the "space with shares" case, where a legitimately-shared file correctly yields a non-orphan grant). These tests confirm the command runs, accepts its flags, scopes correctly, and reports cleanly on a healthy system, but they do not exercise the detection/removal path (count going N→0). A follow-up that orphans a grant and asserts it gets cleaned would strengthen coverage — but that requires corrupting share-manager state, so the current scope is reasonable for acceptance tests.
mergeable=MERGEABLE; the BLOCKED merge state is just the required-review gate.
🤖 Generated with Claude Code
96bf6e2 to
3a9bb42
Compare
3a9bb42 to
d62c1c1
Compare
d62c1c1 to
7d558e8
Compare
Description
Add acceptance tests for
ocis shares clean-orphaned-grantsCLI command.Changes
New feature file
tests/acceptance/features/cliCommands/cleanOrphanedGrants.featurewith 4 scenarios:New step definitions in
CliContext.phpGiven the administrator has configured service account credentialsWhen the administrator runs clean-orphaned-grants in non-dry-run modeWhen the administrator runs clean-orphaned-grants for space :spaceName owned by :userWhen the administrator runs clean-orphaned-grants with force flagRelated Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: