Skip to content

Commit

Permalink
Used a shared repo path for all nodes of a given cluster (#93006) (#9…
Browse files Browse the repository at this point in the history
…3012)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
mark-vieira and elasticmachine committed Jan 17, 2023
1 parent f394687 commit b8af0f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,20 @@
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestRule;

@TimeoutSuite(millis = 40 * TimeUnits.MINUTE) // some of the windows test VMs are slow as hell
public class SmokeTestMultiNodeClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase {

private static TemporaryFolder repoDirectory = new TemporaryFolder();

private static ElasticsearchCluster cluster = ElasticsearchCluster.local()
@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.nodes(2)
.module("mapper-extras")
.module("ingest-common")
.setting("path.repo", () -> repoDirectory.getRoot().getPath())
// The first node does not have the ingest role so we're sure ingest requests are forwarded:
.node(0, n -> n.setting("node.roles", "[master,data,remote_cluster_client]"))
.feature(FeatureFlag.TIME_SERIES_MODE)
.build();

@ClassRule
// Ensure the shared repo dir is created before cluster start
public static TestRule ruleChain = RuleChain.outerRule(repoDirectory).around(cluster);

public SmokeTestMultiNodeClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class Node {
private final LocalNodeSpec spec;
private final Path workingDir;
private final Path distributionDir;
private final Path snapshotsDir;
private final Path repoDir;
private final Path dataDir;
private final Path logsDir;
private final Path configDir;
Expand All @@ -90,7 +90,7 @@ public Node(LocalNodeSpec spec) {
this.spec = spec;
this.workingDir = baseWorkingDir.resolve(spec.getCluster().getName()).resolve(spec.getName());
this.distributionDir = workingDir.resolve("distro"); // location of es distribution files, typically hard-linked
this.snapshotsDir = workingDir.resolve("repo");
this.repoDir = baseWorkingDir.resolve("repo");
this.dataDir = workingDir.resolve("data");
this.logsDir = workingDir.resolve("logs");
this.configDir = workingDir.resolve("config");
Expand Down Expand Up @@ -205,7 +205,7 @@ private void initializeWorkingDirectory() {
IOUtils.deleteWithRetry(distributionDir);
IOUtils.syncWithCopy(distributionDescriptor.getDistributionDir(), distributionDir);
}
Files.createDirectories(snapshotsDir);
Files.createDirectories(repoDir);
Files.createDirectories(dataDir);
Files.createDirectories(logsDir);
Files.createDirectories(tempDir);
Expand All @@ -228,9 +228,9 @@ private void writeConfiguration() {
try {
// Write settings to elasticsearch.yml
Map<String, String> finalSettings = new HashMap<>();
finalSettings.put("path.repo", workingDir.resolve("repo").toString());
finalSettings.put("path.data", workingDir.resolve("data").toString());
finalSettings.put("path.logs", workingDir.resolve("logs").toString());
finalSettings.put("path.repo", repoDir.toString());
finalSettings.put("path.data", dataDir.toString());
finalSettings.put("path.logs", logsDir.toString());
finalSettings.putAll(spec.resolveSettings());

Files.writeString(
Expand Down

0 comments on commit b8af0f0

Please sign in to comment.