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
| : dataDirs.stream().map(TestEntitlementBootstrap::absolutePath).toList(); | ||
| } | ||
|
|
||
| private static Path sharedDataDir(Settings settings) { |
There was a problem hiding this comment.
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?
| 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.
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. 🤔
prdoyle
left a comment
There was a problem hiding this comment.
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.
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)
…cularityError. We've seen this previously (and predictably) in elastic#131539 due to logging Exceptions in isTriviallyAllowed. elastic#133269 shows exactly the same symptoms. Fixes elastic#133269 Fixes elastic#133267 Fixes elastic#133268
…cularityError. (elastic#134431) We've seen this previously (and predictably) in elastic#131539 due to logging Exceptions in isTriviallyAllowed. elastic#133269 shows exactly the same symptoms. Fixes elastic#133269 Fixes elastic#133267 Fixes elastic#133268
…cularityError. (elastic#134431) We've seen this previously (and predictably) in elastic#131539 due to logging Exceptions in isTriviallyAllowed. elastic#133269 shows exactly the same symptoms. Fixes elastic#133269 Fixes elastic#133267 Fixes elastic#133268
I'll follow up with better managing the lifecycle of test entitlement state, as discussed on Slack.