kibana/x-pack/test/api_integration/apis/watcher/watcher.ts
Walter Rafelsberger 11acc025b5
[ML] Rename index pattern references to data view. (#171627)
Renames references to index pattern to data views.

- Updates references in `data-test-subj` attributes for data frame
analytics.
- Renames methods in the ` ml.testResources` service used in tests.
- `IndexPattern` references in testing code referring to single indices
were renamed to use `IndexName`. For variable names still using
`IndexPattern` they were prefixed with e.g. `esIndexPattern` to avoid
ambiguity with the legacy data view name.

Note there are still references in the state management code of the data
frame analytics creation wizard, this wasn't picked up in this PR since
it focuses mostly on test related code.
2023-11-23 08:17:26 +01:00

47 lines
1.4 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 expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const log = getService('log');
const supertest = getService('supertest');
const transform = getService('transform');
describe('watcher', () => {
before(async () => {
try {
await transform.testResources.createDataViewIfNeeded('ft_ecommerce', 'order_date');
} catch (error) {
log.debug('[Setup error] Error creating index pattern');
throw error;
}
});
after(async () => {
try {
await transform.testResources.deleteDataViewByTitle('ft_ecommerce');
} catch (error) {
log.debug('[Cleanup error] Error deleting index pattern');
throw error;
}
});
describe('POST /api/watcher/indices/index_patterns', () => {
it('returns list of index patterns', async () => {
const response = await supertest
.get('/api/watcher/indices/index_patterns')
.set('kbn-xsrf', 'kibana')
.expect(200);
expect(response.body).to.contain('ft_ecommerce');
});
});
});
}