Skip to content
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 Path comparisons for Windows tests (#46503) #46569

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.apache.logging.log4j.core.appender.AbstractAppender;
import org.apache.lucene.index.SegmentInfos;
import org.elasticsearch.common.logging.Loggers;
import org.apache.lucene.util.Constants;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.core.internal.io.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
Expand Down Expand Up @@ -365,7 +364,7 @@ public void run() {
for (int i = 0; i < iters; i++) {
int shard = randomIntBetween(0, counts.length - 1);
try {
try (ShardLock autoCloses = env.shardLock(new ShardId("foo", "fooUUID", shard),
try (ShardLock autoCloses = env.shardLock(new ShardId("foo", "fooUUID", shard),
scaledRandomIntBetween(0, 10))) {
counts[shard].value++;
countsAtomic[shard].incrementAndGet();
Expand Down Expand Up @@ -395,7 +394,6 @@ public void run() {
}

public void testCustomDataPaths() throws Exception {
assumeFalse("Fails on Windows, see https://github.com/elastic/elasticsearch/issues/45333", Constants.WINDOWS);
String[] dataPaths = tmpPaths();
NodeEnvironment env = newNodeEnvironment(dataPaths, "/tmp", Settings.EMPTY);

Expand All @@ -411,7 +409,8 @@ public void testCustomDataPaths() throws Exception {
assertTrue("settings with path_data should have a custom data path", s2.hasCustomDataPath());

assertThat(env.availableShardPaths(sid), equalTo(env.availableShardPaths(sid)));
assertThat(env.resolveCustomLocation(s2, sid), equalTo(PathUtils.get("/tmp/foo/0/" + index.getUUID() + "/0")));
assertThat(env.resolveCustomLocation(s2, sid).toAbsolutePath(),
equalTo(PathUtils.get("/tmp/foo/0/" + index.getUUID() + "/0").toAbsolutePath()));

assertThat("shard paths with a custom data_path should contain only regular paths",
env.availableShardPaths(sid),
Expand All @@ -423,7 +422,8 @@ public void testCustomDataPaths() throws Exception {
IndexSettings s3 = new IndexSettings(s2.getIndexMetaData(), Settings.builder().build());

assertThat(env.availableShardPaths(sid), equalTo(env.availableShardPaths(sid)));
assertThat(env.resolveCustomLocation(s3, sid), equalTo(PathUtils.get("/tmp/foo/0/" + index.getUUID() + "/0")));
assertThat(env.resolveCustomLocation(s3, sid).toAbsolutePath(),
equalTo(PathUtils.get("/tmp/foo/0/" + index.getUUID() + "/0").toAbsolutePath()));

assertThat("shard paths with a custom data_path should contain only regular paths",
env.availableShardPaths(sid),
Expand Down