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

[ML] Update test thresholds to account for changes to memory control #31289

Merged
merged 1 commit into from
Jun 13, 2018
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 @@ -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