Skip to content

Commit

Permalink
Fix model bytes validation (#45508) (#45534)
Browse files Browse the repository at this point in the history
This PR adds `model_bytes` to the list of count details that are only validated to be present and re-enables the tests.
  • Loading branch information
pheyos authored Sep 12, 2019
1 parent a105b70 commit 70f26e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ export default function({ getService }: FtrProviderContext) {
expect(rows.filter(row => row.id === jobId)).to.have.length(1);
});

// FLAKY: https://github.com/elastic/kibana/issues/45450
it.skip('displays details for the created job in the job list', async () => {
it('displays details for the created job in the job list', async () => {
const expectedRow = {
id: jobId,
description: jobDescription,
Expand Down Expand Up @@ -199,7 +198,6 @@ export default function({ getService }: FtrProviderContext) {
const expectedModelSizeStats = {
job_id: jobId,
result_type: 'model_size_stats',
model_bytes: '1.8 MB',
model_bytes_exceeded: '0',
model_bytes_memory_limit: '20971520',
total_by_field_count: '59',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ export default function({ getService }: FtrProviderContext) {
expect(rows.filter(row => row.id === jobId)).to.have.length(1);
});

// FLAKY: https://github.com/elastic/kibana/issues/45447
it.skip('displays details for the created job in the job list', async () => {
it('displays details for the created job in the job list', async () => {
const expectedRow = {
id: jobId,
description: jobDescription,
Expand Down Expand Up @@ -179,7 +178,6 @@ export default function({ getService }: FtrProviderContext) {
const expectedModelSizeStats = {
job_id: jobId,
result_type: 'model_size_stats',
model_bytes: '47.6 KB',
model_bytes_exceeded: '0',
model_bytes_memory_limit: '15728640',
total_by_field_count: '3',
Expand Down
14 changes: 8 additions & 6 deletions x-pack/test/functional/services/machine_learning/job_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,23 @@ export function MachineLearningJobTableProvider({ getService }: FtrProviderConte
const countDetails = await this.parseJobCounts(jobId);
const counts = countDetails.counts;

// last_data_time holds a runtime timestamp and is hard to predict
// the property is only validated to be present and then removed
// so it doesn't make the counts object validation fail
// fields that have changing values are only validated
// to be present and then removed so they don't make
// the object validation fail
expect(counts).to.have.property('last_data_time');
delete counts.last_data_time;

expect(counts).to.eql(expectedCounts);

const modelSizeStats = countDetails.modelSizeStats;

// log_time holds a runtime timestamp and is hard to predict
// the property is only validated to be present and then removed
// so it doesn't make the modelSizeStats object validation fail
// fields that have changing values are only validated
// to be present and then removed so they don't make
// the object validation fail
expect(modelSizeStats).to.have.property('log_time');
delete modelSizeStats.log_time;
expect(modelSizeStats).to.have.property('model_bytes');
delete modelSizeStats.model_bytes;

expect(modelSizeStats).to.eql(expectedModelSizeStats);
}
Expand Down

0 comments on commit 70f26e9

Please sign in to comment.