ushahid88 opened a new pull request, #9335:
URL: https://github.com/apache/gravitino/pull/9335
…ng Fixes #9306
This PR adds a missing unit test for the RemoveRoleFromGroup CLI command.
The test covers the scenario where a user attempts to remove a role from a
group that does not exist, and the GravitinoClient throws a
NoSuchGroupException.
The new test ensures that the CLI behaves consistently with other command
implementations
when encountering a “missing group” error.
### What the Test Covers
- Creates a spy of RemoveRoleFromGroup to override client construction.
- Mocks GravitinoClient to throw NoSuchGroupException when
revokeRolesFromGroup is called.
- Ensures the command:
- Exits with code **-1** (using `Main.useExit = false`)
- Prints **ErrorMessages.UNKNOWN_GROUP** to stderr
- Wraps the error in a RuntimeException, consistent with CLI error handling
### Why This Is Needed
Other CLI commands (CreateGroup, DeleteGroup, RemoveAllRoles…) already have
coverage verifying their error handling. This test brings RemoveRoleFromGroup
in line with those patterns and ensures regressions are caught early.
### Additional Notes
- The test resets `System.err` and `Main.useExit` to avoid interaction with
other tests.
- UTF-8 decoding is used explicitly to satisfy ErrorProne rules and match the
project-wide charset expectations on UNIX-based build agents.
### Fixes
Fixes #9306
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]