mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
initial api integration test for DFA map api (#86225)
This commit is contained in:
parent
8c5f64f07e
commit
5d2014dec5
1 changed files with 37 additions and 0 deletions
|
@ -235,5 +235,42 @@ export default ({ getService }: FtrProviderContext) => {
|
|||
expect(body.message).to.eql('Forbidden');
|
||||
});
|
||||
});
|
||||
|
||||
describe('GetDataFrameAnalyticsIdMap', () => {
|
||||
it('should return a map of objects leading up to analytics job id', async () => {
|
||||
const { body } = await supertest
|
||||
.get(`/api/ml/data_frame/analytics/map/${jobId}_1`)
|
||||
.auth(USER.ML_VIEWER, ml.securityCommon.getPasswordForUser(USER.ML_VIEWER))
|
||||
.set(COMMON_REQUEST_HEADERS)
|
||||
.expect(200);
|
||||
|
||||
expect(body).to.have.keys('elements', 'details', 'error');
|
||||
// Index node, 2 job nodes (with same source index), and 2 edge nodes to connect them
|
||||
expect(body.elements.length).to.eql(5);
|
||||
|
||||
for (const detailsId in body.details) {
|
||||
if (detailsId.includes('analytics')) {
|
||||
expect(body.details[detailsId]).to.have.keys('id', 'source', 'dest');
|
||||
} else if (detailsId.includes('index')) {
|
||||
const indexId = detailsId.replace('-index', '');
|
||||
expect(body.details[detailsId][indexId]).to.have.keys('aliases', 'mappings');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should return empty results and an error message if the job does not exist', async () => {
|
||||
const { body } = await supertest
|
||||
.get(`/api/ml/data_frame/analytics/map/${jobId}_fake`)
|
||||
.auth(USER.ML_VIEWER, ml.securityCommon.getPasswordForUser(USER.ML_VIEWER))
|
||||
.set(COMMON_REQUEST_HEADERS)
|
||||
.expect(200);
|
||||
|
||||
expect(body.elements.length).to.eql(0);
|
||||
expect(body.details).to.eql({});
|
||||
expect(body.error).to.eql(`No known job with id '${jobId}_fake'`);
|
||||
|
||||
expect(body).to.have.keys('elements', 'details', 'error');
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue