mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary Adds tests for basic SLO api routes, including: 1. Find slos 2. Get slo by id 3. Get slo definitions 4. Get slo instances 5. Create slo 6. Delete slo 7. Update slo 8. Reset slo The create slo tests include some basic assertions that the resulting calculated SLO is correct. These tests do not cover: 1. SLOs in spaces 2. SLO permissions model Passed flaky test runner for 200 iterations: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/4595#_ --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: shahzad31 <shahzad31comp@gmail.com> Co-authored-by: Kevin Delemme <kdelemme@gmail.com>
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import { FtrProviderContext } from '../ftr_provider_context';
|
|
|
|
export function DataViewApiProvider({ getService }: FtrProviderContext) {
|
|
const supertest = getService('supertest');
|
|
|
|
return {
|
|
async create({ id, name, title }: { id: string; name: string; title: string }) {
|
|
const { body } = await supertest
|
|
.post(`/api/content_management/rpc/create`)
|
|
.set('kbn-xsrf', 'foo')
|
|
.set('x-elastic-internal-origin', 'foo')
|
|
.send({
|
|
contentTypeId: 'index-pattern',
|
|
data: {
|
|
fieldAttrs: '{}',
|
|
title,
|
|
timeFieldName: '@timestamp',
|
|
sourceFilters: '[]',
|
|
fields: '[]',
|
|
fieldFormatMap: '{}',
|
|
typeMeta: '{}',
|
|
runtimeFieldMap: '{}',
|
|
name,
|
|
},
|
|
options: { id },
|
|
version: 1,
|
|
});
|
|
return body;
|
|
},
|
|
|
|
async delete({ id }: { id: string }) {
|
|
const { body } = await supertest
|
|
.post(`/api/content_management/rpc/delete`)
|
|
.set('kbn-xsrf', 'foo')
|
|
.set('x-elastic-internal-origin', 'foo')
|
|
.send({
|
|
contentTypeId: 'index-pattern',
|
|
id,
|
|
options: { force: true },
|
|
version: 1,
|
|
});
|
|
return body;
|
|
},
|
|
};
|
|
}
|