-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Support entitlements in internal cluster tests #130710
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: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/es-core-infra (Team:Core/Infra) |
…erTest to test, file permissions in internalClusterTest are stricter on the lucene tempDir
TODO: Improve Javadocs on final version to better guide DEVs what to do |
logger.debug("Unregistering node dirs: config [{}], dataDirs [{}], repoDirs [{}]", configDir, dataDirs, repoDirs); | ||
baseDirPaths.compute(BaseDir.CONFIG, baseDirModifier(paths -> paths.remove(configDir))); | ||
baseDirPaths.compute(BaseDir.DATA, baseDirModifier(paths -> paths.removeAll(dataDirs))); | ||
baseDirPaths.compute(BaseDir.SHARED_REPO, baseDirModifier(paths -> paths.removeAll(repoDirs))); |
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.
Huh, this baseDirModifier
pattern is kind of neat. The code ends up quite readable.
@@ -50,7 +50,7 @@ configure(childProjects.values()) { | |||
// Omit oddball libraries that aren't in server. | |||
def nonServerLibs = ['plugin-scanner'] | |||
if (false == nonServerLibs.contains(project.name)) { | |||
project.getTasks().withType(Test.class).matching(test -> ['test'].contains(test.name)).configureEach(test -> { | |||
project.getTasks().withType(Test.class).matching(test -> ['test', 'internalClusterTest'].contains(test.name)).configureEach(test -> { |
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 PR enables entitlement enforcement in
internalClusterTests
.To prevent an implicit grant-all if storing node homes inside the Java temp dir, the temporary folder of
ESTestCase
is configured separately from the Java temp dir ininternalClusterTests
(by means of the system propertytempDir
, seeTestRuleTemporaryFilesCleanup
)ReloadingDatabasesWhilePerformingGeoLookupsIT
frominternalClusterTest
totest
, file permissions ininternalClusterTest
only grant file permissions on node base dirs - but not for the entire Lucene test temp dir overall.This adds support to trivially allow test utility classes if annotated with
@WithoutEntitlements
by walking the entire stack. For example, seeSecurityTestUtils
which uses IOUtils to work with files.@EntitledTestUtilities
) on the test suite similar to@EntitledTestPackages
. This way stack walks can be limited to cases where such an annotation is present on the test suite.Relates to ES-11586
Relates to ES-12042