Skip to content

Commit

Permalink
[Transform] fix testManyTranformsUsingHlrc for certain locales (#66330)
Browse files Browse the repository at this point in the history
use root locale to prevent creation of invalid id's
  • Loading branch information
Hendrik Muhs committed Dec 15, 2020
1 parent a460564 commit 8cec42a
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.time.Instant;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -380,7 +381,10 @@ public void testManyTranformsUsingHlrc() throws IOException {
int numberOfTransforms = randomIntBetween(1_500, 4_000);
for (int i = 0; i < numberOfTransforms; ++i) {
AcknowledgedResponse response = restClient.transform()
.putTransform(new PutTransformRequest(configBuilder.setId(String.format("t-%05d", i)).build()), RequestOptions.DEFAULT);
.putTransform(
new PutTransformRequest(configBuilder.setId(String.format(Locale.ROOT, "t-%05d", i)).build()),
RequestOptions.DEFAULT
);
assertTrue(response.isAcknowledged());
}

Expand All @@ -405,21 +409,21 @@ public void testManyTranformsUsingHlrc() throws IOException {
assertEquals(size, configs.size());
assertEquals(size, stats.size());

assertThat(configs.get(0).getId(), equalTo(String.format("t-%05d", from)));
assertThat(configs.get(configs.size() - 1).getId(), equalTo(String.format("t-%05d", from + size - 1)));
assertThat(stats.get(0).getId(), equalTo(String.format("t-%05d", from)));
assertThat(stats.get(stats.size() - 1).getId(), equalTo(String.format("t-%05d", from + size - 1)));
assertThat(configs.get(0).getId(), equalTo(String.format(Locale.ROOT, "t-%05d", from)));
assertThat(configs.get(configs.size() - 1).getId(), equalTo(String.format(Locale.ROOT, "t-%05d", from + size - 1)));
assertThat(stats.get(0).getId(), equalTo(String.format(Locale.ROOT, "t-%05d", from)));
assertThat(stats.get(stats.size() - 1).getId(), equalTo(String.format(Locale.ROOT, "t-%05d", from + size - 1)));

if (size > 2) {
int randomElement = randomIntBetween(1, size - 1);
assertThat(configs.get(randomElement).getId(), equalTo(String.format("t-%05d", from + randomElement)));
assertThat(stats.get(randomElement).getId(), equalTo(String.format("t-%05d", from + randomElement)));
assertThat(configs.get(randomElement).getId(), equalTo(String.format(Locale.ROOT, "t-%05d", from + randomElement)));
assertThat(stats.get(randomElement).getId(), equalTo(String.format(Locale.ROOT, "t-%05d", from + randomElement)));
}
}

for (int i = 0; i < numberOfTransforms; ++i) {
AcknowledgedResponse response = restClient.transform()
.deleteTransform(new DeleteTransformRequest(String.format("t-%05d", i)), RequestOptions.DEFAULT);
.deleteTransform(new DeleteTransformRequest(String.format(Locale.ROOT, "t-%05d", i)), RequestOptions.DEFAULT);
assertTrue(response.isAcknowledged());
}
}
Expand Down

0 comments on commit 8cec42a

Please sign in to comment.