Skip to content

Commit

Permalink
update recency_emphasis to be greater than 1 in test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Jackie Han <[email protected]>
  • Loading branch information
jackiehanyang committed Jan 29, 2025
1 parent e33ff46 commit 3e06458
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
24 changes: 12 additions & 12 deletions src/test/java/org/opensearch/ad/model/AnomalyDetectorTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public void testInvalidShingleSize() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -376,7 +376,7 @@ public void testNullDetectorName() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -414,7 +414,7 @@ public void testBlankDetectorName() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -452,7 +452,7 @@ public void testNullTimeField() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -490,7 +490,7 @@ public void testNullIndices() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -528,7 +528,7 @@ public void testEmptyIndices() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -566,7 +566,7 @@ public void testNullDetectionInterval() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -730,7 +730,7 @@ public void testGetShingleSize() throws IOException {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -766,7 +766,7 @@ public void testGetShingleSizeReturnsDefaultValue() throws IOException {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
seasonalityIntervals,
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -832,7 +832,7 @@ public void testNullFeatureAttributes() throws IOException {
TestHelpers.randomUser(),
null,
null,
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -866,7 +866,7 @@ public void testValidateResultIndex() throws IOException {
TestHelpers.randomUser(),
null,
null,
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomIntBetween(1, TimeSeriesSettings.MAX_SHINGLE_SIZE * TimeSeriesSettings.SEASONALITY_TO_SHINGLE_RATIO),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -1069,7 +1069,7 @@ public void testNullFixedValue() throws IOException {
TestHelpers.randomUser(),
null,
new ImputationOption(ImputationMethod.FIXED_VALUES, null),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/opensearch/ad/rest/ADRestTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public static Response createAnomalyDetector(
null,
// we don't release imputation until 2.17. Disable it in bwc first.
null, // TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void testCreateAnomalyDetectorWithDuplicateName() throws Exception {
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -367,7 +367,7 @@ public void testUpdateAnomalyDetector_disableFlattenResultIndex_shouldDeletePipe
detector.getUser(),
detector.getCustomResultIndexOrAlias(),
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -434,7 +434,7 @@ public void testUpdateAnomalyDetectorFlattenResultIndexField() throws Exception
detector.getUser(),
detector.getCustomResultIndexOrAlias(),
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
detector.getRules(),
Expand Down Expand Up @@ -563,7 +563,7 @@ public void testUpdateAnomalyDetectorCategoryField() throws Exception {
detector.getUser(),
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -631,7 +631,7 @@ public void testUpdateAnomalyDetector() throws Exception {
detector.getUser(),
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -704,7 +704,7 @@ public void testUpdateAnomalyDetectorNameToExisting() throws Exception {
detector1.getUser(),
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -754,7 +754,7 @@ public void testUpdateAnomalyDetectorNameToNew() throws Exception {
detector.getUser(),
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -810,7 +810,7 @@ public void testUpdateAnomalyDetectorWithNotExistingIndex() throws Exception {
detector.getUser(),
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -1196,7 +1196,7 @@ public void testUpdateAnomalyDetectorWithRunningAdJob() throws Exception {
detector.getUser(),
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private AnomalyDetector randomAnomalyDetector(AnomalyDetector detector) {
detector.getUser(),
detector.getCustomResultIndexOrAlias(),
detector.getImputationOption(),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/opensearch/ad/rest/SecureADRestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void testUpdateApiFilterByEnabledForAdmin() throws IOException {
),
null,
aliceDetector.getImputationOption(),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -313,7 +313,7 @@ public void testUpdateApiFilterByEnabled() throws IOException {
),
null,
aliceDetector.getImputationOption(),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private AnomalyDetector randomDetector(List<String> indices, List<Feature> featu
null,
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -252,7 +252,7 @@ private AnomalyDetector randomHCDetector(List<String> indices, List<Feature> fea
null,
null,
TestHelpers.randomImputationOption(features),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testNullDetectorIdAndTaskAction() throws IOException {
randomUser(),
null,
TestHelpers.randomImputationOption(null),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void testValidateAnomalyDetectorWithInvalidDetectorName() throws IOExcept
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down Expand Up @@ -448,7 +448,7 @@ public void testValidateAnomalyDetectorWithDetectorNameTooLong() throws IOExcept
TestHelpers.randomUser(),
null,
TestHelpers.randomImputationOption(featureList),
randomIntBetween(1, 10000),
randomIntBetween(2, 10000),
randomInt(TimeSeriesSettings.MAX_SHINGLE_SIZE / 2),
randomIntBetween(1, 1000),
null,
Expand Down

0 comments on commit 3e06458

Please sign in to comment.