-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Test] Allow configuring configDir for the Java test cluster #125094
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
Changes from 9 commits
280d89d
7fe0911
46b2849
a3bd7a2
942695e
df7c6e7
9592e91
0851c4d
d8bb5cd
0651da0
b69d60e
d6b7838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,11 +19,13 @@ | |
import org.elasticsearch.test.cluster.util.Version; | ||
import org.elasticsearch.test.cluster.util.resource.Resource; | ||
|
||
import java.nio.file.Path; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.function.Supplier; | ||
import java.util.stream.Collectors; | ||
|
||
public class LocalClusterSpec implements ClusterSpec { | ||
|
@@ -103,6 +105,7 @@ public static class LocalNodeSpec { | |
private final List<SystemPropertyProvider> systemPropertyProviders; | ||
private final Map<String, String> systemProperties; | ||
private final List<String> jvmArgs; | ||
private final Supplier<Path> configDirSupplier; | ||
|
||
private Version version; | ||
|
||
public LocalNodeSpec( | ||
|
@@ -124,7 +127,8 @@ public LocalNodeSpec( | |
Map<String, Resource> extraConfigFiles, | ||
List<SystemPropertyProvider> systemPropertyProviders, | ||
Map<String, String> systemProperties, | ||
List<String> jvmArgs | ||
List<String> jvmArgs, | ||
Supplier<Path> configDirSupplier | ||
) { | ||
this.cluster = cluster; | ||
this.name = name; | ||
|
@@ -145,6 +149,7 @@ public LocalNodeSpec( | |
this.systemPropertyProviders = systemPropertyProviders; | ||
this.systemProperties = systemProperties; | ||
this.jvmArgs = jvmArgs; | ||
this.configDirSupplier = configDirSupplier; | ||
} | ||
|
||
void setVersion(Version version) { | ||
|
@@ -203,6 +208,10 @@ public List<String> getJvmArgs() { | |
return jvmArgs; | ||
} | ||
|
||
public Supplier<Path> getConfigDirSupplier() { | ||
return configDirSupplier; | ||
} | ||
|
||
public boolean isSecurityEnabled() { | ||
return Boolean.parseBoolean(getSetting("xpack.security.enabled", getVersion().onOrAfter("8.0.0") ? "true" : "false")); | ||
} | ||
|
@@ -339,7 +348,8 @@ private LocalNodeSpec getFilteredSpec(SettingsProvider filteredProvider, Setting | |
n.extraConfigFiles, | ||
n.systemPropertyProviders, | ||
n.systemProperties, | ||
n.jvmArgs | ||
n.jvmArgs, | ||
n.configDirSupplier | ||
) | ||
) | ||
.toList(); | ||
|
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.
Why do we need to do this path -> file -> path conversion?
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.
The last conversion gives a String. The reason is that temporary directory created by Lucene temporariy directory, e.g.
LuceneTestCase#createTempDir
returns a LuceneFilterDirectory
which always works forresolve(String)
but throws forresolve(Path)
if the givenPath
argument is not also aFilterDirectory
. Since I changed the other PR to use Junit's TemporaryDirectory, this is no longer an issue for now. But I think it might be worthwhile to keep the change so that it does not just break if someone decides to use Lucene temporary in future?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.
I don't have super strong feelings about working around idiosyncrasies with lucene types. Can this be simplified to
relativePath.toString()
?