Skip to content

Commit

Permalink
[ML] Update test thresholds to account for changes to memory control (#…
Browse files Browse the repository at this point in the history
…31289)

To avoid temporary failures, this also disables these tests until elastic/ml-cpp#122 is committed.
  • Loading branch information
tveasey authored Jun 13, 2018
1 parent 8c9360b commit 66f7dd2
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void cleanUpTest() {
cleanUp();
}

@AwaitsFix(bugUrl = "https://github.com/elastic/ml-cpp/pulls/122")
public void testTooManyPartitions() throws Exception {
Detector.Builder detector = new Detector.Builder("count", null);
detector.setPartitionFieldName("user");
Expand Down Expand Up @@ -77,11 +78,12 @@ public void testTooManyPartitions() throws Exception {
// Assert we haven't violated the limit too much
GetJobsStatsAction.Response.JobStats jobStats = getJobStats(job.getId()).get(0);
ModelSizeStats modelSizeStats = jobStats.getModelSizeStats();
assertThat(modelSizeStats.getModelBytes(), lessThan(35000000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(30000000L));
assertThat(modelSizeStats.getModelBytes(), lessThan(31500000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(24000000L));
assertThat(modelSizeStats.getMemoryStatus(), equalTo(ModelSizeStats.MemoryStatus.HARD_LIMIT));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/ml-cpp/pulls/122")
public void testTooManyByFields() throws Exception {
Detector.Builder detector = new Detector.Builder("count", null);
detector.setByFieldName("user");
Expand Down Expand Up @@ -122,11 +124,12 @@ public void testTooManyByFields() throws Exception {
// Assert we haven't violated the limit too much
GetJobsStatsAction.Response.JobStats jobStats = getJobStats(job.getId()).get(0);
ModelSizeStats modelSizeStats = jobStats.getModelSizeStats();
assertThat(modelSizeStats.getModelBytes(), lessThan(36000000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(30000000L));
assertThat(modelSizeStats.getModelBytes(), lessThan(31500000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(25000000L));
assertThat(modelSizeStats.getMemoryStatus(), equalTo(ModelSizeStats.MemoryStatus.HARD_LIMIT));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/ml-cpp/pulls/122")
public void testTooManyByAndOverFields() throws Exception {
Detector.Builder detector = new Detector.Builder("count", null);
detector.setByFieldName("department");
Expand Down Expand Up @@ -171,11 +174,12 @@ public void testTooManyByAndOverFields() throws Exception {
// Assert we haven't violated the limit too much
GetJobsStatsAction.Response.JobStats jobStats = getJobStats(job.getId()).get(0);
ModelSizeStats modelSizeStats = jobStats.getModelSizeStats();
assertThat(modelSizeStats.getModelBytes(), lessThan(36000000L));
assertThat(modelSizeStats.getModelBytes(), lessThan(31500000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(24000000L));
assertThat(modelSizeStats.getMemoryStatus(), equalTo(ModelSizeStats.MemoryStatus.HARD_LIMIT));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/ml-cpp/pulls/122")
public void testManyDistinctOverFields() throws Exception {
Detector.Builder detector = new Detector.Builder("sum", "value");
detector.setOverFieldName("user");
Expand Down Expand Up @@ -221,9 +225,9 @@ public void testManyDistinctOverFields() throws Exception {
// Assert we haven't violated the limit too much
GetJobsStatsAction.Response.JobStats jobStats = getJobStats(job.getId()).get(0);
ModelSizeStats modelSizeStats = jobStats.getModelSizeStats();
assertThat(modelSizeStats.getModelBytes(), lessThan(90000000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(75000000L));
assertThat(modelSizeStats.getMemoryStatus(), equalTo(ModelSizeStats.MemoryStatus.OK));
assertThat(modelSizeStats.getModelBytes(), lessThan(116000000L));
assertThat(modelSizeStats.getModelBytes(), greaterThan(90000000L));
assertThat(modelSizeStats.getMemoryStatus(), equalTo(ModelSizeStats.MemoryStatus.HARD_LIMIT));
}

private static Map<String, Object> createRecord(long timestamp, String user, String department) {
Expand Down

0 comments on commit 66f7dd2

Please sign in to comment.