Skip to content

Commit

Permalink
[ML] Transform test fix for testCreateLatestFunction (#66293)
Browse files Browse the repository at this point in the history
closes #66292
  • Loading branch information
benwtrent authored Dec 15, 2020
1 parent f41cee8 commit 940bd86
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
import org.elasticsearch.test.AbstractXContentTestCase;

import java.io.IOException;
import java.util.ArrayList;
import java.util.function.Predicate;

public class LatestConfigTests extends AbstractXContentTestCase<LatestConfig> {

public static LatestConfig randomLatestConfig() {
return new LatestConfig(randomList(5, () -> randomAlphaOfLengthBetween(1, 10)), randomAlphaOfLengthBetween(1, 10));
return new LatestConfig(
new ArrayList<>(randomUnique(() -> randomAlphaOfLengthBetween(1, 10), randomIntBetween(1, 10))),
randomAlphaOfLengthBetween(1, 10)
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.xpack.core.transform.transforms.latest.LatestConfig;

import java.io.IOException;
import java.util.ArrayList;

import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
Expand All @@ -33,7 +34,10 @@ public class LatestConfigTests
extends AbstractResponseTestCase<LatestConfig, org.elasticsearch.client.transform.transforms.latest.LatestConfig> {

public static LatestConfig randomLatestConfig() {
return new LatestConfig(randomList(1, 10, () -> randomAlphaOfLengthBetween(1, 10)), randomAlphaOfLengthBetween(1, 10));
return new LatestConfig(
new ArrayList<>(randomUnique(() -> randomAlphaOfLengthBetween(1, 10), randomIntBetween(1, 10))),
randomAlphaOfLengthBetween(1, 10)
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.elasticsearch.xpack.core.transform.transforms.AbstractSerializingTransformTestCase;

import java.io.IOException;
import java.util.ArrayList;

import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
Expand All @@ -25,7 +26,10 @@
public class LatestConfigTests extends AbstractSerializingTransformTestCase<LatestConfig> {

public static LatestConfig randomLatestConfig() {
return new LatestConfig(randomList(1, 10, () -> randomAlphaOfLengthBetween(1, 10)), randomAlphaOfLengthBetween(1, 10));
return new LatestConfig(
new ArrayList<>(randomUnique(() -> randomAlphaOfLengthBetween(1, 10), randomIntBetween(1, 10))),
randomAlphaOfLengthBetween(1, 10)
);
}

@Override
Expand Down

0 comments on commit 940bd86

Please sign in to comment.