-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Fix entitlements in internalClusterTest #131539
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
Fix entitlements in internalClusterTest #131539
Conversation
* Previously, entitlement checks got disabled when resetting the policy manager (which defaults to inactive). * The shared data dir is granted as additional data base directory. * Due to the lack of entitlement delegation and wipePendingDataDirectories using server's FileSystemUtils, node base directories won't be removed until after the test. * Disable entitlement checks for some command tests. * Disable entitlement checks for some tests requiring entitlement delegation.
Pinging @elastic/es-core-infra (Team:Core/Infra) |
libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java
Show resolved
Hide resolved
@@ -115,20 +134,31 @@ private static Collection<Path> dataDirs(Settings settings, Path homeDir) { | |||
: dataDirs.stream().map(TestEntitlementBootstrap::absolutePath).toList(); | |||
} | |||
|
|||
private static Path sharedDataDir(Settings settings) { |
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.
This is required for some tests, though it looks like we never grant PATH_SHARED_DATA_SETTING
in production.
Is this a test-only thing? Or is that a bug?
@@ -93,6 +94,7 @@ | |||
import static org.hamcrest.Matchers.startsWith; | |||
|
|||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0) | |||
@ESTestCase.WithoutEntitlements // commands don't run with entitlements enforced |
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.
It's a bit unfortunate how often we need to do this. Makes me wonder if there's a more general rule we could apply so that WithoutEntitlements
only needs to be used in exceptional cases. 🤔
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.
We're on the same page about what's needed. I'll proactively approve to avoid delays.
… entitlement delegation
…xInternalClusterTest
…xInternalClusterTest
…xInternalClusterTest
…xInternalClusterTest
…xInternalClusterTest
…xInternalClusterTest
Previously, entitlement checks got disabled when resetting the policy manager (which defaults to inactive). This change makes sure entitlements are correctly enabled during tests. Due to the lack of entitlement delegation (and usage of server's FileSystemUtils and similar in test code), there's a few remaining issues: - various tests have to run without entitlements - node base dirs cannot be removed immediately when shutting down the node due to pending cleanups (wipePendingDataDirectories) Due to Netty dependency issues (ES-12435), azure and inference tests have to run without entitlements.
💔 Backport failed
You can use sqren/backport to manually backport by running |
Previously, entitlement checks got disabled when resetting the policy manager (which defaults to inactive). This change makes sure entitlements are correctly enabled during tests. Due to the lack of entitlement delegation (and usage of server's FileSystemUtils and similar in test code), there's a few remaining issues: - various tests have to run without entitlements - node base dirs cannot be removed immediately when shutting down the node due to pending cleanups (wipePendingDataDirectories) Due to Netty dependency issues (ES-12435), azure and inference tests have to run without entitlements. (cherry picked from commit 5d72a3f) # Conflicts: # modules/repository-azure/src/internalClusterTest/java/org/elasticsearch/repositories/azure/AzureBlobStoreRepositoryTests.java
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
Previously, entitlement checks got disabled when resetting the policy manager (which defaults to inactive). This change makes sure entitlements are correctly enabled during tests. Due to the lack of entitlement delegation (and usage of server's FileSystemUtils and similar in test code), there's a few remaining issues: - various tests have to run without entitlements - node base dirs cannot be removed immediately when shutting down the node due to pending cleanups (wipePendingDataDirectories) Due to Netty dependency issues (ES-12435), azure and inference tests have to run without entitlements.
I'll follow up with better managing the lifecycle of test entitlement state, as discussed on Slack.