-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-28957: Enhance TestHiveMetaStoreAuthorizer #5819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the TestHiveMetaStoreAuthorizer tests to verify that proper privilege objects are generated and filter contexts are applied as expected. Key changes include switching from the DummyHiveAuthorizerFactory to a dedicated MockHiveAuthorizerFactory, adding additional authorization failure checks with explicit fail messages, and introducing a new mock filter hook (MockMetaStoreFilterHook) to validate ownership-based filtering in metadata operations.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java | Updated tests to use a mock authorizer, added privilege capture and ownership filtering tests, and modified configuration to use the new mock classes. |
ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/MockMetaStoreFilterHook.java | Introduced a mock filter hook implementation to verify that filtering logic based on ownership behaves as expected. |
...ache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java
Outdated
Show resolved
Hide resolved
private static final Logger LOG = LoggerFactory.getLogger(MockMetaStoreFilterHook.class); | ||
private static final String AUTHORIZED_OWNER = TestHiveMetaStoreAuthorizer.authorizedUser; | ||
|
||
public MockMetaStoreFilterHook(Configuration conf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conf variable is unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding @SuppressWarnings("unused") annotation here to document that this is intentional; I keep the conf parameters to follow the established MetaStoreFilterHook interface contract. What do you think? Should we delete it or keep it? Thanks a lot
...g/apache/hadoop/hive/ql/security/authorization/plugin/metastore/MockMetaStoreFilterHook.java
Show resolved
Hide resolved
...ache/hadoop/hive/ql/security/authorization/plugin/metastore/TestHiveMetaStoreAuthorizer.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1
Pending green automated tests |
|
What changes were proposed in this pull request?
Enhance TestHiveMetaStoreAuthorizer to verify that the correct privilege objects are created for each operation and ensure the appropriate filter contexts are constructed and applied
Why are the changes needed?
Existing TestHiveMetaStoreAuthorizer uses DummyHiveAuthorizerFactory, which bypasses validation of the real HiveMetaStoreAuthorizer's filtering behavior.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Regression tests, unit tests