[ML] Functional tests - refactor test resources (#63724)

This PR changes the way how test resources like indices and saved objects are used in ML and Transform functional tests. No actual test logic is changed.
This commit is contained in:
Robert Oskamp 2020-04-17 18:10:46 +02:00 committed by GitHub
parent fb1ff02ed3
commit 1992716086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 727 additions and 11720 deletions

View file

@ -28,7 +28,7 @@ export default ({ getService }: FtrProviderContext) => {
aggTypes: ['avg'], aggTypes: ['avg'],
duration: { start: 1560297859000, end: 1562975136000 }, duration: { start: 1560297859000, end: 1562975136000 },
fields: ['taxless_total_price'], fields: ['taxless_total_price'],
index: 'ecommerce', index: 'ft_ecommerce',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
timeField: 'order_date', timeField: 'order_date',
}, },
@ -44,7 +44,7 @@ export default ({ getService }: FtrProviderContext) => {
aggTypes: ['avg', 'sum'], aggTypes: ['avg', 'sum'],
duration: { start: 1560297859000, end: 1562975136000 }, duration: { start: 1560297859000, end: 1562975136000 },
fields: ['products.base_price', 'products.base_unit_price'], fields: ['products.base_price', 'products.base_unit_price'],
index: 'ecommerce', index: 'ft_ecommerce',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
timeField: 'order_date', timeField: 'order_date',
}, },
@ -60,7 +60,7 @@ export default ({ getService }: FtrProviderContext) => {
aggTypes: ['avg'], aggTypes: ['avg'],
duration: { start: 1560297859000, end: 1562975136000 }, duration: { start: 1560297859000, end: 1562975136000 },
fields: ['taxless_total_price'], fields: ['taxless_total_price'],
index: 'ecommerce', index: 'ft_ecommerce',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
splitField: 'customer_first_name.keyword', splitField: 'customer_first_name.keyword',
timeField: 'order_date', timeField: 'order_date',
@ -78,7 +78,7 @@ export default ({ getService }: FtrProviderContext) => {
duration: { start: 1560297859000, end: 1562975136000 }, duration: { start: 1560297859000, end: 1562975136000 },
fields: ['taxless_total_price'], fields: ['taxless_total_price'],
filters: [], filters: [],
index: 'ecommerce', index: 'ft_ecommerce',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
timeField: 'order_date', timeField: 'order_date',
}, },
@ -91,11 +91,8 @@ export default ({ getService }: FtrProviderContext) => {
describe('bucket span estimator', function() { describe('bucket span estimator', function() {
before(async () => { before(async () => {
await esArchiver.load('ml/ecommerce'); await esArchiver.loadIfNeeded('ml/ecommerce');
}); await ml.testResources.setKibanaTimeZoneToUTC();
after(async () => {
await esArchiver.unload('ml/ecommerce');
}); });
describe('with default settings', function() { describe('with default settings', function() {

View file

@ -22,7 +22,7 @@ export default ({ getService }: FtrProviderContext) => {
testTitleSuffix: 'when no partition field is provided with regular function', testTitleSuffix: 'when no partition field is provided with regular function',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
requestBody: { requestBody: {
indexPattern: 'ecommerce', indexPattern: 'ft_ecommerce',
analysisConfig: { analysisConfig: {
bucket_span: '15m', bucket_span: '15m',
detectors: [ detectors: [
@ -51,7 +51,7 @@ export default ({ getService }: FtrProviderContext) => {
testTitleSuffix: 'with 1 metric and 1 influencer same as split field', testTitleSuffix: 'with 1 metric and 1 influencer same as split field',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
requestBody: { requestBody: {
indexPattern: 'ecommerce', indexPattern: 'ft_ecommerce',
analysisConfig: { analysisConfig: {
bucket_span: '15m', bucket_span: '15m',
detectors: [ detectors: [
@ -77,7 +77,7 @@ export default ({ getService }: FtrProviderContext) => {
testTitleSuffix: 'with 3 influencers, split by city', testTitleSuffix: 'with 3 influencers, split by city',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
requestBody: { requestBody: {
indexPattern: 'ecommerce', indexPattern: 'ft_ecommerce',
analysisConfig: { analysisConfig: {
bucket_span: '15m', bucket_span: '15m',
detectors: [ detectors: [
@ -104,7 +104,7 @@ export default ({ getService }: FtrProviderContext) => {
'2 detectors split by city and manufacturer, 4 influencers, filtering by country code', '2 detectors split by city and manufacturer, 4 influencers, filtering by country code',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
requestBody: { requestBody: {
indexPattern: 'ecommerce', indexPattern: 'ft_ecommerce',
analysisConfig: { analysisConfig: {
bucket_span: '2d', bucket_span: '2d',
detectors: [ detectors: [
@ -148,11 +148,8 @@ export default ({ getService }: FtrProviderContext) => {
describe('calculate model memory limit', function() { describe('calculate model memory limit', function() {
before(async () => { before(async () => {
await esArchiver.load('ml/ecommerce'); await esArchiver.loadIfNeeded('ml/ecommerce');
}); await ml.testResources.setKibanaTimeZoneToUTC();
after(async () => {
await esArchiver.unload('ml/ecommerce');
}); });
for (const testData of testDataList) { for (const testData of testDataList) {

View file

@ -66,7 +66,7 @@ const analyzer = {
], ],
}; };
const defaultRequestBody = { const defaultRequestBody = {
indexPatternTitle: 'categorization_functional_test', indexPatternTitle: 'ft_categorization',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
size: 5, size: 5,
timeField: '@timestamp', timeField: '@timestamp',
@ -289,11 +289,8 @@ export default ({ getService }: FtrProviderContext) => {
describe('Categorization example endpoint - ', function() { describe('Categorization example endpoint - ', function() {
before(async () => { before(async () => {
await esArchiver.load('ml/categorization'); await esArchiver.loadIfNeeded('ml/categorization');
}); await ml.testResources.setKibanaTimeZoneToUTC();
after(async () => {
await esArchiver.unload('ml/categorization');
}); });
for (const testData of testDataList) { for (const testData of testDataList) {

View file

@ -50,6 +50,10 @@ export default ({ getService }: FtrProviderContext) => {
} }
describe('get_module', function() { describe('get_module', function() {
before(async () => {
await ml.testResources.setKibanaTimeZoneToUTC();
});
it('lists all modules', async () => { it('lists all modules', async () => {
const rspBody = await executeGetModuleRequest('', USER.ML_POWERUSER, 200); const rspBody = await executeGetModuleRequest('', USER.ML_POWERUSER, 200);
expect(rspBody).to.be.an(Array); expect(rspBody).to.be.an(Array);

View file

@ -7,6 +7,7 @@
import { FtrProviderContext } from '../../ftr_provider_context'; import { FtrProviderContext } from '../../ftr_provider_context';
export default function({ getService, loadTestFile }: FtrProviderContext) { export default function({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const ml = getService('ml'); const ml = getService('ml');
describe('Machine Learning', function() { describe('Machine Learning', function() {
@ -20,6 +21,14 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
after(async () => { after(async () => {
await ml.securityCommon.cleanMlUsers(); await ml.securityCommon.cleanMlUsers();
await ml.securityCommon.cleanMlRoles(); await ml.securityCommon.cleanMlRoles();
await ml.testResources.deleteIndexPattern('kibana_sample_data_logs');
await esArchiver.unload('ml/ecommerce');
await esArchiver.unload('ml/categorization');
await esArchiver.unload('ml/sample_logs');
await ml.testResources.resetKibanaTimeZone();
}); });
loadTestFile(require.resolve('./bucket_span_estimator')); loadTestFile(require.resolve('./bucket_span_estimator'));

View file

@ -32,7 +32,6 @@ export default ({ getService }: FtrProviderContext) => {
}, },
{ {
testTitleSuffix: 'for non existent index pattern', testTitleSuffix: 'for non existent index pattern',
sourceDataArchive: 'empty_kibana',
indexPattern: 'non-existent-index-pattern', indexPattern: 'non-existent-index-pattern',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
expected: { expected: {
@ -53,14 +52,16 @@ export default ({ getService }: FtrProviderContext) => {
} }
describe('module recognizer', function() { describe('module recognizer', function() {
before(async () => {
await ml.testResources.setKibanaTimeZoneToUTC();
});
for (const testData of testDataList) { for (const testData of testDataList) {
describe('lists matching modules', function() { describe('lists matching modules', function() {
before(async () => { before(async () => {
await esArchiver.load(testData.sourceDataArchive); if (testData.hasOwnProperty('sourceDataArchive')) {
}); await esArchiver.loadIfNeeded(testData.sourceDataArchive!);
}
after(async () => {
await esArchiver.unload(testData.sourceDataArchive);
}); });
it(testData.testTitleSuffix, async () => { it(testData.testTitleSuffix, async () => {

View file

@ -25,6 +25,7 @@ export default ({ getService }: FtrProviderContext) => {
{ {
testTitleSuffix: 'for sample logs dataset with prefix and startDatafeed false', testTitleSuffix: 'for sample logs dataset with prefix and startDatafeed false',
sourceDataArchive: 'ml/sample_logs', sourceDataArchive: 'ml/sample_logs',
indexPattern: { name: 'kibana_sample_data_logs', timeField: '@timestamp' },
module: 'sample_data_weblogs', module: 'sample_data_weblogs',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
requestBody: { requestBody: {
@ -58,7 +59,6 @@ export default ({ getService }: FtrProviderContext) => {
const testDataListNegative = [ const testDataListNegative = [
{ {
testTitleSuffix: 'for non existent index pattern', testTitleSuffix: 'for non existent index pattern',
sourceDataArchive: 'empty_kibana',
module: 'sample_data_weblogs', module: 'sample_data_weblogs',
user: USER.ML_POWERUSER, user: USER.ML_POWERUSER,
requestBody: { requestBody: {
@ -75,6 +75,7 @@ export default ({ getService }: FtrProviderContext) => {
{ {
testTitleSuffix: 'for unauthorized user', testTitleSuffix: 'for unauthorized user',
sourceDataArchive: 'ml/sample_logs', sourceDataArchive: 'ml/sample_logs',
indexPattern: { name: 'kibana_sample_data_logs', timeField: '@timestamp' },
module: 'sample_data_weblogs', module: 'sample_data_weblogs',
user: USER.ML_UNAUTHORIZED, user: USER.ML_UNAUTHORIZED,
requestBody: { requestBody: {
@ -118,14 +119,21 @@ export default ({ getService }: FtrProviderContext) => {
} }
describe('module setup', function() { describe('module setup', function() {
before(async () => {
await ml.testResources.setKibanaTimeZoneToUTC();
});
for (const testData of testDataListPositive) { for (const testData of testDataListPositive) {
describe('sets up module data', function() { describe('sets up module data', function() {
before(async () => { before(async () => {
await esArchiver.load(testData.sourceDataArchive); await esArchiver.loadIfNeeded(testData.sourceDataArchive);
await ml.testResources.createIndexPatternIfNeeded(
testData.indexPattern.name,
testData.indexPattern.timeField
);
}); });
after(async () => { after(async () => {
await esArchiver.unload(testData.sourceDataArchive);
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });
@ -199,11 +207,18 @@ export default ({ getService }: FtrProviderContext) => {
for (const testData of testDataListNegative) { for (const testData of testDataListNegative) {
describe('rejects request', function() { describe('rejects request', function() {
before(async () => { before(async () => {
await esArchiver.load(testData.sourceDataArchive); if (testData.hasOwnProperty('sourceDataArchive')) {
await esArchiver.loadIfNeeded(testData.sourceDataArchive!);
}
if (testData.hasOwnProperty('indexPattern')) {
await ml.testResources.createIndexPatternIfNeeded(
testData.indexPattern!.name as string,
testData.indexPattern!.timeField as string
);
}
}); });
after(async () => { after(async () => {
await esArchiver.unload(testData.sourceDataArchive);
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });

View file

@ -9,14 +9,17 @@ import { FtrProviderContext } from '../../functional/ftr_provider_context';
import { import {
MachineLearningAPIProvider, MachineLearningAPIProvider,
MachineLearningSecurityCommonProvider, MachineLearningSecurityCommonProvider,
MachineLearningTestResourcesProvider,
} from '../../functional/services/machine_learning'; } from '../../functional/services/machine_learning';
export function MachineLearningProvider(context: FtrProviderContext) { export function MachineLearningProvider(context: FtrProviderContext) {
const api = MachineLearningAPIProvider(context); const api = MachineLearningAPIProvider(context);
const securityCommon = MachineLearningSecurityCommonProvider(context); const securityCommon = MachineLearningSecurityCommonProvider(context);
const testResources = MachineLearningTestResourcesProvider(context);
return { return {
api, api,
securityCommon, securityCommon,
testResources,
}; };
} }

View file

@ -110,13 +110,13 @@ export default function({ getService }: FtrProviderContext) {
const testDataList = [ const testDataList = [
{ {
suiteTitle: 'with multiple metric detectors and custom datafeed settings', suiteTitle: 'with multiple metric detectors and custom datafeed settings',
jobSource: 'ecommerce', jobSource: 'ft_ecommerce',
jobId: `ec_advanced_1_${Date.now()}`, jobId: `ec_advanced_1_${Date.now()}`,
get jobIdClone(): string { get jobIdClone(): string {
return `${this.jobId}_clone`; return `${this.jobId}_clone`;
}, },
jobDescription: jobDescription:
'Create advanced job from ecommerce dataset with multiple metric detectors and custom datafeed settings', 'Create advanced job from ft_ecommerce dataset with multiple metric detectors and custom datafeed settings',
jobGroups: ['automated', 'ecommerce', 'advanced'], jobGroups: ['automated', 'ecommerce', 'advanced'],
get jobGroupsClone(): string[] { get jobGroupsClone(): string[] {
return [...this.jobGroups, 'clone']; return [...this.jobGroups, 'clone'];
@ -207,13 +207,13 @@ export default function({ getService }: FtrProviderContext) {
}, },
{ {
suiteTitle: 'with categorization detector and default datafeed settings', suiteTitle: 'with categorization detector and default datafeed settings',
jobSource: 'ecommerce', jobSource: 'ft_ecommerce',
jobId: `ec_advanced_2_${Date.now()}`, jobId: `ec_advanced_2_${Date.now()}`,
get jobIdClone(): string { get jobIdClone(): string {
return `${this.jobId}_clone`; return `${this.jobId}_clone`;
}, },
jobDescription: jobDescription:
'Create advanced job from ecommerce dataset with a categorization detector and default datafeed settings', 'Create advanced job from ft_ecommerce dataset with a categorization detector and default datafeed settings',
jobGroups: ['automated', 'ecommerce', 'advanced'], jobGroups: ['automated', 'ecommerce', 'advanced'],
get jobGroupsClone(): string[] { get jobGroupsClone(): string[] {
return [...this.jobGroups, 'clone']; return [...this.jobGroups, 'clone'];
@ -274,16 +274,20 @@ export default function({ getService }: FtrProviderContext) {
}, },
]; ];
const calendarId = `wizard-test-calendar_${Date.now()}`;
describe('advanced job', function() { describe('advanced job', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/ecommerce'); await esArchiver.loadIfNeeded('ml/ecommerce');
await ml.api.createCalendar('wizard-test-calendar'); await ml.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.api.createCalendar(calendarId);
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/ecommerce');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });
@ -475,7 +479,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation assigns calendars', async () => { it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.addCalendar('wizard-test-calendar'); await ml.jobWizardCommon.addCalendar(calendarId);
}); });
it('job creation displays the model plot switch', async () => { it('job creation displays the model plot switch', async () => {
@ -734,7 +738,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job cloning persists assigned calendars', async () => { it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']); await ml.jobWizardCommon.assertCalendarsSelection([calendarId]);
}); });
it('job cloning pre-fills the model plot switch', async () => { it('job cloning pre-fills the model plot switch', async () => {

View file

@ -29,7 +29,7 @@ const JOB_CONFIG: Job = {
const DATAFEED_CONFIG: Datafeed = { const DATAFEED_CONFIG: Datafeed = {
datafeed_id: 'datafeed-fq_multi_1_se', datafeed_id: 'datafeed-fq_multi_1_se',
indices: ['farequote'], indices: ['ft_farequote'],
job_id: 'fq_multi_1_ae', job_id: 'fq_multi_1_ae',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
}; };
@ -59,12 +59,11 @@ export default function({ getService }: FtrProviderContext) {
describe('anomaly explorer', function() { describe('anomaly explorer', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await ml.securityUI.loginAsMlPowerUser(); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
}); await ml.testResources.setKibanaTimeZoneToUTC();
after(async () => { await ml.securityUI.loginAsMlPowerUser();
await esArchiver.unload('ml/farequote');
}); });
for (const testData of testDataList) { for (const testData of testDataList) {

View file

@ -16,7 +16,7 @@ export default function({ getService }: FtrProviderContext) {
const jobId = `categorization_${Date.now()}`; const jobId = `categorization_${Date.now()}`;
const jobIdClone = `${jobId}_clone`; const jobIdClone = `${jobId}_clone`;
const jobDescription = const jobDescription =
'Create categorization job based on the categorization_functional_test dataset with a count rare'; 'Create categorization job based on the ft_categorization dataset with a count rare';
const jobGroups = ['automated', 'categorization']; const jobGroups = ['automated', 'categorization'];
const jobGroupsClone = [...jobGroups, 'clone']; const jobGroupsClone = [...jobGroups, 'clone'];
const detectorTypeIdentifier = 'Rare'; const detectorTypeIdentifier = 'Rare';
@ -74,16 +74,20 @@ export default function({ getService }: FtrProviderContext) {
}; };
} }
const calendarId = `wizard-test-calendar_${Date.now()}`;
describe('categorization', function() { describe('categorization', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/categorization'); await esArchiver.loadIfNeeded('ml/categorization');
await ml.api.createCalendar('wizard-test-calendar'); await ml.testResources.createIndexPatternIfNeeded('ft_categorization', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.api.createCalendar(calendarId);
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/categorization');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });
@ -97,9 +101,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation loads the job type selection page', async () => { it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob( await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ft_categorization');
'categorization_functional_test'
);
}); });
it('job creation loads the categorization job wizard page', async () => { it('job creation loads the categorization job wizard page', async () => {
@ -178,7 +180,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation assigns calendars', async () => { it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.addCalendar('wizard-test-calendar'); await ml.jobWizardCommon.addCalendar(calendarId);
}); });
it('job creation opens the advanced section', async () => { it('job creation opens the advanced section', async () => {
@ -310,7 +312,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job cloning persists assigned calendars', async () => { it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']); await ml.jobWizardCommon.assertCalendarsSelection([calendarId]);
}); });
it('job cloning opens the advanced section', async () => { it('job cloning opens the advanced section', async () => {

View file

@ -104,7 +104,7 @@ export default function({ getService }: FtrProviderContext) {
const testDataList = [ const testDataList = [
{ {
suiteTitle: 'with count detector and model plot disabled', suiteTitle: 'with count detector and model plot disabled',
jobSource: 'event_rate_gen_trend_nanos', jobSource: 'ft_event_rate_gen_trend_nanos',
jobId: `event_rate_nanos_count_1_${Date.now()}`, jobId: `event_rate_nanos_count_1_${Date.now()}`,
jobDescription: jobDescription:
'Create advanced job based on the event rate dataset with a date_nanos time field, 30m bucketspan and count', 'Create advanced job based on the event rate dataset with a date_nanos time field, 30m bucketspan and count',
@ -168,12 +168,18 @@ export default function({ getService }: FtrProviderContext) {
describe('job on data set with date_nanos time field', function() { describe('job on data set with date_nanos time field', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/event_rate_nanos'); await esArchiver.loadIfNeeded('ml/event_rate_nanos');
await ml.testResources.createIndexPatternIfNeeded(
'ft_event_rate_gen_trend_nanos',
'@timestamp'
);
await ml.testResources.setKibanaTimeZoneToUTC();
await esArchiver.loadIfNeeded('ml/event_rate_nanos');
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/event_rate_nanos');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });

View file

@ -71,16 +71,20 @@ export default function({ getService }: FtrProviderContext) {
}; };
} }
const calendarId = `wizard-test-calendar_${Date.now()}`;
describe('multi metric', function() { describe('multi metric', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await ml.api.createCalendar('wizard-test-calendar'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.api.createCalendar(calendarId);
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/farequote');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });
@ -94,7 +98,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation loads the job type selection page', async () => { it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('farequote'); await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ft_farequote');
}); });
it('job creation loads the multi metric job wizard page', async () => { it('job creation loads the multi metric job wizard page', async () => {
@ -181,7 +185,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation assigns calendars', async () => { it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.addCalendar('wizard-test-calendar'); await ml.jobWizardCommon.addCalendar(calendarId);
}); });
it('job creation opens the advanced section', async () => { it('job creation opens the advanced section', async () => {
@ -329,7 +333,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job cloning persists assigned calendars', async () => { it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']); await ml.jobWizardCommon.assertCalendarsSelection([calendarId]);
}); });
it('job cloning opens the advanced section', async () => { it('job cloning opens the advanced section', async () => {

View file

@ -85,16 +85,20 @@ export default function({ getService }: FtrProviderContext) {
}; };
} }
const calendarId = `wizard-test-calendar_${Date.now()}`;
describe('population', function() { describe('population', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/ecommerce'); await esArchiver.loadIfNeeded('ml/ecommerce');
await ml.api.createCalendar('wizard-test-calendar'); await ml.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.api.createCalendar(calendarId);
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/farequote');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });
@ -108,7 +112,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation loads the job type selection page', async () => { it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ecommerce'); await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ft_ecommerce');
}); });
it('job creation loads the population job wizard page', async () => { it('job creation loads the population job wizard page', async () => {
@ -208,7 +212,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation assigns calendars', async () => { it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.addCalendar('wizard-test-calendar'); await ml.jobWizardCommon.addCalendar(calendarId);
}); });
it('job creation opens the advanced section', async () => { it('job creation opens the advanced section', async () => {
@ -367,7 +371,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job cloning persists assigned calendars', async () => { it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']); await ml.jobWizardCommon.assertCalendarsSelection([calendarId]);
}); });
it('job cloning opens the advanced section', async () => { it('job cloning opens the advanced section', async () => {

View file

@ -15,7 +15,7 @@ export default function({ getService }: FtrProviderContext) {
const testDataList = [ const testDataList = [
{ {
suiteTitle: 'with filter', suiteTitle: 'with filter',
jobSource: 'farequote_filter', jobSource: 'ft_farequote_filter',
jobId: `fq_saved_search_1_${Date.now()}`, jobId: `fq_saved_search_1_${Date.now()}`,
jobDescription: 'Create multi metric job based on a saved search with filter', jobDescription: 'Create multi metric job based on a saved search with filter',
jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'], jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'],
@ -66,7 +66,7 @@ export default function({ getService }: FtrProviderContext) {
}, },
{ {
suiteTitle: 'with lucene query', suiteTitle: 'with lucene query',
jobSource: 'farequote_lucene', jobSource: 'ft_farequote_lucene',
jobId: `fq_saved_search_2_${Date.now()}`, jobId: `fq_saved_search_2_${Date.now()}`,
jobDescription: 'Create multi metric job based on a saved search with lucene query', jobDescription: 'Create multi metric job based on a saved search with lucene query',
jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'], jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'],
@ -117,7 +117,7 @@ export default function({ getService }: FtrProviderContext) {
}, },
{ {
suiteTitle: 'with kuery query', suiteTitle: 'with kuery query',
jobSource: 'farequote_kuery', jobSource: 'ft_farequote_kuery',
jobId: `fq_saved_search_3_${Date.now()}`, jobId: `fq_saved_search_3_${Date.now()}`,
jobDescription: 'Create multi metric job based on a saved search with kuery query', jobDescription: 'Create multi metric job based on a saved search with kuery query',
jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'], jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'],
@ -168,7 +168,7 @@ export default function({ getService }: FtrProviderContext) {
}, },
{ {
suiteTitle: 'with filter and lucene query', suiteTitle: 'with filter and lucene query',
jobSource: 'farequote_filter_and_lucene', jobSource: 'ft_farequote_filter_and_lucene',
jobId: `fq_saved_search_4_${Date.now()}`, jobId: `fq_saved_search_4_${Date.now()}`,
jobDescription: jobDescription:
'Create multi metric job based on a saved search with filter and lucene query', 'Create multi metric job based on a saved search with filter and lucene query',
@ -220,7 +220,7 @@ export default function({ getService }: FtrProviderContext) {
}, },
{ {
suiteTitle: 'with filter and kuery query', suiteTitle: 'with filter and kuery query',
jobSource: 'farequote_filter_and_kuery', jobSource: 'ft_farequote_filter_and_kuery',
jobId: `fq_saved_search_5_${Date.now()}`, jobId: `fq_saved_search_5_${Date.now()}`,
jobDescription: 'Create multi metric job based on a saved search with filter and kuery query', jobDescription: 'Create multi metric job based on a saved search with filter and kuery query',
jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'], jobGroups: ['automated', 'farequote', 'multi-metric', 'saved-search'],
@ -274,12 +274,19 @@ export default function({ getService }: FtrProviderContext) {
describe('saved search', function() { describe('saved search', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
await ml.testResources.createSavedSearchFarequoteFilterIfNeeded();
await ml.testResources.createSavedSearchFarequoteLuceneIfNeeded();
await ml.testResources.createSavedSearchFarequoteKueryIfNeeded();
await ml.testResources.createSavedSearchFarequoteFilterAndLuceneIfNeeded();
await ml.testResources.createSavedSearchFarequoteFilterAndKueryIfNeeded();
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/farequote');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });

View file

@ -70,16 +70,20 @@ export default function({ getService }: FtrProviderContext) {
}; };
} }
const calendarId = `wizard-test-calendar_${Date.now()}`;
describe('single metric', function() { describe('single metric', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await ml.api.createCalendar('wizard-test-calendar'); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.api.createCalendar(calendarId);
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/farequote');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });
@ -93,7 +97,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation loads the job type selection page', async () => { it('job creation loads the job type selection page', async () => {
await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('farequote'); await ml.jobSourceSelection.selectSourceForAnomalyDetectionJob('ft_farequote');
}); });
it('job creation loads the single metric job wizard page', async () => { it('job creation loads the single metric job wizard page', async () => {
@ -162,7 +166,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job creation assigns calendars', async () => { it('job creation assigns calendars', async () => {
await ml.jobWizardCommon.addCalendar('wizard-test-calendar'); await ml.jobWizardCommon.addCalendar(calendarId);
}); });
it('job creation opens the advanced section', async () => { it('job creation opens the advanced section', async () => {
@ -294,7 +298,7 @@ export default function({ getService }: FtrProviderContext) {
}); });
it('job cloning persists assigned calendars', async () => { it('job cloning persists assigned calendars', async () => {
await ml.jobWizardCommon.assertCalendarsSelection(['wizard-test-calendar']); await ml.jobWizardCommon.assertCalendarsSelection([calendarId]);
}); });
it('job cloning opens the advanced section', async () => { it('job cloning opens the advanced section', async () => {

View file

@ -29,7 +29,7 @@ const JOB_CONFIG: Job = {
const DATAFEED_CONFIG: Datafeed = { const DATAFEED_CONFIG: Datafeed = {
datafeed_id: 'datafeed-fq_single_1_smv', datafeed_id: 'datafeed-fq_single_1_smv',
indices: ['farequote'], indices: ['ft_farequote'],
job_id: 'fq_single_1_smv', job_id: 'fq_single_1_smv',
query: { bool: { must: [{ match_all: {} }] } }, query: { bool: { must: [{ match_all: {} }] } },
}; };
@ -42,13 +42,15 @@ export default function({ getService }: FtrProviderContext) {
describe('single metric viewer', function() { describe('single metric viewer', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.api.createAndRunAnomalyDetectionLookbackJob(JOB_CONFIG, DATAFEED_CONFIG); await ml.api.createAndRunAnomalyDetectionLookbackJob(JOB_CONFIG, DATAFEED_CONFIG);
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/farequote');
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
}); });

View file

@ -14,13 +14,15 @@ export default function({ getService }: FtrProviderContext) {
describe('classification creation', function() { describe('classification creation', function() {
this.tags(['smoke']); this.tags(['smoke']);
before(async () => { before(async () => {
await esArchiver.load('ml/bm_classification'); await esArchiver.loadIfNeeded('ml/bm_classification');
await ml.testResources.createIndexPatternIfNeeded('ft_bank_marketing', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
await esArchiver.unload('ml/bm_classification');
}); });
const testDataList = [ const testDataList = [
@ -29,8 +31,8 @@ export default function({ getService }: FtrProviderContext) {
jobType: 'classification', jobType: 'classification',
jobId: `bm_1_${Date.now()}`, jobId: `bm_1_${Date.now()}`,
jobDescription: jobDescription:
"Classification job based on 'bank-marketing' dataset with dependentVariable 'y' and trainingPercent '20'", "Classification job based on 'ft_bank_marketing' dataset with dependentVariable 'y' and trainingPercent '20'",
source: 'bank-marketing*', source: 'ft_bank_marketing',
get destinationIndex(): string { get destinationIndex(): string {
return `user-${this.jobId}`; return `user-${this.jobId}`;
}, },
@ -51,6 +53,7 @@ export default function({ getService }: FtrProviderContext) {
describe(`${testData.suiteTitle}`, function() { describe(`${testData.suiteTitle}`, function() {
after(async () => { after(async () => {
await ml.api.deleteIndices(testData.destinationIndex); await ml.api.deleteIndices(testData.destinationIndex);
await ml.testResources.deleteIndexPattern(testData.destinationIndex);
}); });
it('loads the data frame analytics page', async () => { it('loads the data frame analytics page', async () => {

View file

@ -19,6 +19,7 @@ export default function({ getService }: FtrProviderContext) {
const testDataList: Array<{ const testDataList: Array<{
suiteTitle: string; suiteTitle: string;
archive: string; archive: string;
indexPattern: { name: string; timeField: string };
job: DeepPartial<DataFrameAnalyticsConfig>; job: DeepPartial<DataFrameAnalyticsConfig>;
}> = (() => { }> = (() => {
const timestamp = Date.now(); const timestamp = Date.now();
@ -27,12 +28,13 @@ export default function({ getService }: FtrProviderContext) {
{ {
suiteTitle: 'classification job supported by the form', suiteTitle: 'classification job supported by the form',
archive: 'ml/bm_classification', archive: 'ml/bm_classification',
indexPattern: { name: 'ft_bank_marketing', timeField: '@timestamp' },
job: { job: {
id: `bm_1_${timestamp}`, id: `bm_1_${timestamp}`,
description: description:
"Classification job based on 'bank-marketing' dataset with dependentVariable 'y' and trainingPercent '20'", "Classification job based on 'ft_bank_marketing' dataset with dependentVariable 'y' and trainingPercent '20'",
source: { source: {
index: ['bank-marketing*'], index: ['ft_bank_marketing'],
query: { query: {
match_all: {}, match_all: {},
}, },
@ -60,11 +62,12 @@ export default function({ getService }: FtrProviderContext) {
{ {
suiteTitle: 'outlier detection job supported by the form', suiteTitle: 'outlier detection job supported by the form',
archive: 'ml/ihp_outlier', archive: 'ml/ihp_outlier',
indexPattern: { name: 'ft_ihp_outlier', timeField: '@timestamp' },
job: { job: {
id: `ihp_1_${timestamp}`, id: `ihp_1_${timestamp}`,
description: 'This is the job description', description: 'This is the job description',
source: { source: {
index: ['ihp_outlier'], index: ['ft_ihp_outlier'],
query: { query: {
match_all: {}, match_all: {},
}, },
@ -88,11 +91,12 @@ export default function({ getService }: FtrProviderContext) {
{ {
suiteTitle: 'regression job supported by the form', suiteTitle: 'regression job supported by the form',
archive: 'ml/egs_regression', archive: 'ml/egs_regression',
indexPattern: { name: 'ft_egs_regression', timeField: '@timestamp' },
job: { job: {
id: `egs_1_${timestamp}`, id: `egs_1_${timestamp}`,
description: 'This is the job description', description: 'This is the job description',
source: { source: {
index: ['egs_regression'], index: ['ft_egs_regression'],
query: { query: {
match_all: {}, match_all: {},
}, },
@ -120,6 +124,7 @@ export default function({ getService }: FtrProviderContext) {
})(); })();
before(async () => { before(async () => {
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
@ -133,7 +138,11 @@ export default function({ getService }: FtrProviderContext) {
const cloneDestIndex = `${testData.job!.dest!.index}_clone`; const cloneDestIndex = `${testData.job!.dest!.index}_clone`;
before(async () => { before(async () => {
await esArchiver.load(testData.archive); await esArchiver.loadIfNeeded(testData.archive);
await ml.testResources.createIndexPatternIfNeeded(
testData.indexPattern.name,
testData.indexPattern.timeField
);
await ml.api.createDataFrameAnalyticsJob(testData.job as DataFrameAnalyticsConfig); await ml.api.createDataFrameAnalyticsJob(testData.job as DataFrameAnalyticsConfig);
await ml.navigation.navigateToMl(); await ml.navigation.navigateToMl();
@ -146,7 +155,7 @@ export default function({ getService }: FtrProviderContext) {
after(async () => { after(async () => {
await ml.api.deleteIndices(cloneDestIndex); await ml.api.deleteIndices(cloneDestIndex);
await ml.api.deleteIndices(testData.job.dest!.index as string); await ml.api.deleteIndices(testData.job.dest!.index as string);
await esArchiver.unload(testData.archive); await ml.testResources.deleteIndexPattern(testData.job.dest!.index as string);
}); });
it('should open the flyout with a proper header', async () => { it('should open the flyout with a proper header', async () => {

View file

@ -14,13 +14,15 @@ export default function({ getService }: FtrProviderContext) {
describe('outlier detection creation', function() { describe('outlier detection creation', function() {
this.tags(['smoke']); this.tags(['smoke']);
before(async () => { before(async () => {
await esArchiver.load('ml/ihp_outlier'); await esArchiver.loadIfNeeded('ml/ihp_outlier');
await ml.testResources.createIndexPatternIfNeeded('ft_ihp_outlier', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
await esArchiver.unload('ml/ihp_outlier');
}); });
const testDataList = [ const testDataList = [
@ -29,7 +31,7 @@ export default function({ getService }: FtrProviderContext) {
jobType: 'outlier_detection', jobType: 'outlier_detection',
jobId: `ihp_1_${Date.now()}`, jobId: `ihp_1_${Date.now()}`,
jobDescription: 'This is the job description', jobDescription: 'This is the job description',
source: 'ihp_outlier', source: 'ft_ihp_outlier',
get destinationIndex(): string { get destinationIndex(): string {
return `user-${this.jobId}`; return `user-${this.jobId}`;
}, },
@ -49,6 +51,7 @@ export default function({ getService }: FtrProviderContext) {
describe(`${testData.suiteTitle}`, function() { describe(`${testData.suiteTitle}`, function() {
after(async () => { after(async () => {
await ml.api.deleteIndices(testData.destinationIndex); await ml.api.deleteIndices(testData.destinationIndex);
await ml.testResources.deleteIndexPattern(testData.destinationIndex);
}); });
it('loads the data frame analytics page', async () => { it('loads the data frame analytics page', async () => {

View file

@ -14,13 +14,15 @@ export default function({ getService }: FtrProviderContext) {
describe('regression creation', function() { describe('regression creation', function() {
this.tags(['smoke']); this.tags(['smoke']);
before(async () => { before(async () => {
await esArchiver.load('ml/egs_regression'); await esArchiver.loadIfNeeded('ml/egs_regression');
await ml.testResources.createIndexPatternIfNeeded('ft_egs_regression', '@timestamp');
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => { after(async () => {
await ml.api.cleanMlIndices(); await ml.api.cleanMlIndices();
await esArchiver.unload('ml/egs_regression');
}); });
const testDataList = [ const testDataList = [
@ -29,7 +31,7 @@ export default function({ getService }: FtrProviderContext) {
jobType: 'regression', jobType: 'regression',
jobId: `egs_1_${Date.now()}`, jobId: `egs_1_${Date.now()}`,
jobDescription: 'This is the job description', jobDescription: 'This is the job description',
source: 'egs_regression', source: 'ft_egs_regression',
get destinationIndex(): string { get destinationIndex(): string {
return `user-${this.jobId}`; return `user-${this.jobId}`;
}, },
@ -51,6 +53,7 @@ export default function({ getService }: FtrProviderContext) {
describe(`${testData.suiteTitle}`, function() { describe(`${testData.suiteTitle}`, function() {
after(async () => { after(async () => {
await ml.api.deleteIndices(testData.destinationIndex); await ml.api.deleteIndices(testData.destinationIndex);
await ml.testResources.deleteIndexPattern(testData.destinationIndex);
}); });
it('loads the data frame analytics page', async () => { it('loads the data frame analytics page', async () => {

View file

@ -36,6 +36,8 @@ export default function({ getService }: FtrProviderContext) {
describe('file based', function() { describe('file based', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
await ml.navigation.navigateToMl(); await ml.navigation.navigateToMl();
}); });

View file

@ -45,7 +45,7 @@ export default function({ getService }: FtrProviderContext) {
const farequoteIndexPatternTestData: TestData = { const farequoteIndexPatternTestData: TestData = {
suiteTitle: 'index pattern', suiteTitle: 'index pattern',
sourceIndexOrSavedSearch: 'farequote', sourceIndexOrSavedSearch: 'ft_farequote',
advancedJobWizardDatafeedQuery: `{ advancedJobWizardDatafeedQuery: `{
"bool": { "bool": {
"must": [ "must": [
@ -128,7 +128,7 @@ export default function({ getService }: FtrProviderContext) {
const farequoteKQLSearchTestData: TestData = { const farequoteKQLSearchTestData: TestData = {
suiteTitle: 'KQL saved search', suiteTitle: 'KQL saved search',
sourceIndexOrSavedSearch: 'farequote_kuery', sourceIndexOrSavedSearch: 'ft_farequote_kuery',
advancedJobWizardDatafeedQuery: `{ advancedJobWizardDatafeedQuery: `{
"bool": { "bool": {
"must": [ "must": [
@ -211,7 +211,7 @@ export default function({ getService }: FtrProviderContext) {
const farequoteLuceneSearchTestData: TestData = { const farequoteLuceneSearchTestData: TestData = {
suiteTitle: 'lucene saved search', suiteTitle: 'lucene saved search',
sourceIndexOrSavedSearch: 'farequote_lucene', sourceIndexOrSavedSearch: 'ft_farequote_lucene',
advancedJobWizardDatafeedQuery: `{ advancedJobWizardDatafeedQuery: `{
"bool": { "bool": {
"must": [ "must": [
@ -378,12 +378,13 @@ export default function({ getService }: FtrProviderContext) {
describe('index based', function() { describe('index based', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await ml.securityUI.loginAsMlPowerUser(); await ml.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
}); await ml.testResources.createSavedSearchFarequoteLuceneIfNeeded();
await ml.testResources.createSavedSearchFarequoteKueryIfNeeded();
await ml.testResources.setKibanaTimeZoneToUTC();
after(async () => { await ml.securityUI.loginAsMlPowerUser();
await esArchiver.unload('ml/farequote');
}); });
// TODO - add tests for // TODO - add tests for

View file

@ -7,15 +7,12 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context'; import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) { export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const security = getService('security'); const security = getService('security');
const appsMenu = getService('appsMenu'); const appsMenu = getService('appsMenu');
const PageObjects = getPageObjects(['common', 'security']); const PageObjects = getPageObjects(['common', 'security']);
describe('security', function() { describe('security', function() {
before(async () => { before(async () => {
await esArchiver.load('empty_kibana');
await security.role.create('global_all_role', { await security.role.create('global_all_role', {
elasticsearch: { elasticsearch: {
indices: [{ names: ['logstash-*'], privileges: ['read', 'view_index_metadata'] }], indices: [{ names: ['logstash-*'], privileges: ['read', 'view_index_metadata'] }],
@ -33,7 +30,6 @@ export default function({ getPageObjects, getService }: FtrProviderContext) {
}); });
after(async () => { after(async () => {
await esArchiver.unload('empty_kibana');
await security.role.delete('global_all_role'); await security.role.delete('global_all_role');
// logout, so the other tests don't accidentally run as the custom users we're testing below // logout, so the other tests don't accidentally run as the custom users we're testing below

View file

@ -7,21 +7,12 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context'; import { FtrProviderContext } from '../../../ftr_provider_context';
export default function({ getPageObjects, getService }: FtrProviderContext) { export default function({ getPageObjects, getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const spacesService = getService('spaces'); const spacesService = getService('spaces');
const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error']); const PageObjects = getPageObjects(['common', 'dashboard', 'security', 'error']);
const appsMenu = getService('appsMenu'); const appsMenu = getService('appsMenu');
const testSubjects = getService('testSubjects'); const testSubjects = getService('testSubjects');
describe('spaces', () => { describe('spaces', () => {
before(async () => {
await esArchiver.load('empty_kibana');
});
after(async () => {
await esArchiver.unload('empty_kibana');
});
describe('space with no features disabled', () => { describe('space with no features disabled', () => {
before(async () => { before(async () => {
await spacesService.create({ await spacesService.create({

View file

@ -6,6 +6,7 @@
import { FtrProviderContext } from '../../ftr_provider_context'; import { FtrProviderContext } from '../../ftr_provider_context';
export default function({ getService, loadTestFile }: FtrProviderContext) { export default function({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const ml = getService('ml'); const ml = getService('ml');
describe('machine learning', function() { describe('machine learning', function() {
@ -19,6 +20,26 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
after(async () => { after(async () => {
await ml.securityCommon.cleanMlUsers(); await ml.securityCommon.cleanMlUsers();
await ml.securityCommon.cleanMlRoles(); await ml.securityCommon.cleanMlRoles();
await ml.testResources.deleteSavedSearches();
await ml.testResources.deleteIndexPattern('ft_farequote');
await ml.testResources.deleteIndexPattern('ft_ecommerce');
await ml.testResources.deleteIndexPattern('ft_categorization');
await ml.testResources.deleteIndexPattern('ft_event_rate_gen_trend_nanos');
await ml.testResources.deleteIndexPattern('ft_bank_marketing');
await ml.testResources.deleteIndexPattern('ft_ihp_outlier');
await ml.testResources.deleteIndexPattern('ft_egs_regression');
await esArchiver.unload('ml/farequote');
await esArchiver.unload('ml/ecommerce');
await esArchiver.unload('ml/categorization');
await esArchiver.unload('ml/event_rate_nanos');
await esArchiver.unload('ml/bm_classification');
await esArchiver.unload('ml/ihp_outlier');
await esArchiver.unload('ml/egs_regression');
await ml.testResources.resetKibanaTimeZone();
}); });
loadTestFile(require.resolve('./feature_controls')); loadTestFile(require.resolve('./feature_controls'));

View file

@ -7,20 +7,15 @@
import { FtrProviderContext } from '../../ftr_provider_context'; import { FtrProviderContext } from '../../ftr_provider_context';
export default function({ getService }: FtrProviderContext) { export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const ml = getService('ml'); const ml = getService('ml');
describe('page navigation', function() { describe('page navigation', function() {
this.tags(['smoke', 'mlqa']); this.tags(['smoke', 'mlqa']);
before(async () => { before(async () => {
await esArchiver.load('empty_kibana'); await ml.api.cleanMlIndices();
await ml.securityUI.loginAsMlPowerUser(); await ml.securityUI.loginAsMlPowerUser();
}); });
after(async () => {
await esArchiver.unload('empty_kibana');
});
it('loads the home page', async () => { it('loads the home page', async () => {
await ml.navigation.navigateToMl(); await ml.navigation.navigateToMl();
}); });

View file

@ -11,7 +11,7 @@ function getTransformConfig(): TransformPivotConfig {
const date = Date.now(); const date = Date.now();
return { return {
id: `ec_2_${date}`, id: `ec_2_${date}`,
source: { index: ['ecommerce'] }, source: { index: ['ft_ecommerce'] },
pivot: { pivot: {
group_by: { category: { terms: { field: 'category.keyword' } } }, group_by: { category: { terms: { field: 'category.keyword' } } },
aggregations: { 'products.base_price.avg': { avg: { field: 'products.base_price' } } }, aggregations: { 'products.base_price.avg': { avg: { field: 'products.base_price' } } },
@ -31,13 +31,16 @@ export default function({ getService }: FtrProviderContext) {
const transformConfig = getTransformConfig(); const transformConfig = getTransformConfig();
before(async () => { before(async () => {
await esArchiver.load('ml/ecommerce'); await esArchiver.loadIfNeeded('ml/ecommerce');
await transform.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date');
await transform.api.createAndRunTransform(transformConfig); await transform.api.createAndRunTransform(transformConfig);
await transform.testResources.setKibanaTimeZoneToUTC();
await transform.securityUI.loginAsTransformPowerUser(); await transform.securityUI.loginAsTransformPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/ecommerce'); await transform.testResources.deleteIndexPattern(transformConfig.dest.index);
await transform.api.deleteIndices(transformConfig.dest.index); await transform.api.deleteIndices(transformConfig.dest.index);
await transform.api.cleanTransformIndices(); await transform.api.cleanTransformIndices();
}); });

View file

@ -20,19 +20,21 @@ export default function({ getService }: FtrProviderContext) {
describe('creation_index_pattern', function() { describe('creation_index_pattern', function() {
this.tags(['smoke']); this.tags(['smoke']);
before(async () => { before(async () => {
await esArchiver.load('ml/ecommerce'); await esArchiver.loadIfNeeded('ml/ecommerce');
await transform.testResources.createIndexPatternIfNeeded('ft_ecommerce', 'order_date');
await transform.testResources.setKibanaTimeZoneToUTC();
await transform.securityUI.loginAsTransformPowerUser(); await transform.securityUI.loginAsTransformPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/ecommerce');
await transform.api.cleanTransformIndices(); await transform.api.cleanTransformIndices();
}); });
const testDataList = [ const testDataList = [
{ {
suiteTitle: 'batch transform with terms+date_histogram groups and avg agg', suiteTitle: 'batch transform with terms+date_histogram groups and avg agg',
source: 'ecommerce', source: 'ft_ecommerce',
groupByEntries: [ groupByEntries: [
{ {
identifier: 'terms(category.keyword)', identifier: 'terms(category.keyword)',
@ -96,7 +98,7 @@ export default function({ getService }: FtrProviderContext) {
}, },
{ {
suiteTitle: 'batch transform with terms group and percentiles agg', suiteTitle: 'batch transform with terms group and percentiles agg',
source: 'ecommerce', source: 'ft_ecommerce',
groupByEntries: [ groupByEntries: [
{ {
identifier: 'terms(geoip.country_iso_code)', identifier: 'terms(geoip.country_iso_code)',
@ -154,6 +156,7 @@ export default function({ getService }: FtrProviderContext) {
describe(`${testData.suiteTitle}`, function() { describe(`${testData.suiteTitle}`, function() {
after(async () => { after(async () => {
await transform.api.deleteIndices(testData.destinationIndex); await transform.api.deleteIndices(testData.destinationIndex);
await transform.testResources.deleteIndexPattern(testData.destinationIndex);
}); });
it('loads the home page', async () => { it('loads the home page', async () => {

View file

@ -20,19 +20,22 @@ export default function({ getService }: FtrProviderContext) {
describe('creation_saved_search', function() { describe('creation_saved_search', function() {
this.tags(['smoke']); this.tags(['smoke']);
before(async () => { before(async () => {
await esArchiver.load('ml/farequote'); await esArchiver.loadIfNeeded('ml/farequote');
await transform.testResources.createIndexPatternIfNeeded('ft_farequote', '@timestamp');
await transform.testResources.createSavedSearchFarequoteFilterIfNeeded();
await transform.testResources.setKibanaTimeZoneToUTC();
await transform.securityUI.loginAsTransformPowerUser(); await transform.securityUI.loginAsTransformPowerUser();
}); });
after(async () => { after(async () => {
await esArchiver.unload('ml/farequote');
await transform.api.cleanTransformIndices(); await transform.api.cleanTransformIndices();
}); });
const testDataList = [ const testDataList = [
{ {
suiteTitle: 'batch transform with terms groups and avg agg with saved search filter', suiteTitle: 'batch transform with terms groups and avg agg with saved search filter',
source: 'farequote_filter', source: 'ft_farequote_filter',
groupByEntries: [ groupByEntries: [
{ {
identifier: 'terms(airline)', identifier: 'terms(airline)',
@ -61,7 +64,7 @@ export default function({ getService }: FtrProviderContext) {
mode: 'batch', mode: 'batch',
progress: '100', progress: '100',
}, },
sourceIndex: 'farequote', sourceIndex: 'ft_farequote',
sourcePreview: { sourcePreview: {
column: 2, column: 2,
values: ['ASA'], values: ['ASA'],
@ -74,6 +77,7 @@ export default function({ getService }: FtrProviderContext) {
describe(`${testData.suiteTitle}`, function() { describe(`${testData.suiteTitle}`, function() {
after(async () => { after(async () => {
await transform.api.deleteIndices(testData.destinationIndex); await transform.api.deleteIndices(testData.destinationIndex);
await transform.testResources.deleteIndexPattern(testData.destinationIndex);
}); });
it('loads the home page', async () => { it('loads the home page', async () => {

View file

@ -6,6 +6,7 @@
import { FtrProviderContext } from '../../ftr_provider_context'; import { FtrProviderContext } from '../../ftr_provider_context';
export default function({ getService, loadTestFile }: FtrProviderContext) { export default function({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const transform = getService('transform'); const transform = getService('transform');
describe('transform', function() { describe('transform', function() {
@ -19,6 +20,16 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
after(async () => { after(async () => {
await transform.securityCommon.cleanTransformUsers(); await transform.securityCommon.cleanTransformUsers();
await transform.securityCommon.cleanTransformRoles(); await transform.securityCommon.cleanTransformRoles();
await transform.testResources.deleteSavedSearches();
await transform.testResources.deleteIndexPattern('ft_farequote');
await transform.testResources.deleteIndexPattern('ft_ecommerce');
await esArchiver.unload('ml/farequote');
await esArchiver.unload('ml/ecommerce');
await transform.testResources.resetKibanaTimeZone();
}); });
loadTestFile(require.resolve('./creation_index_pattern')); loadTestFile(require.resolve('./creation_index_pattern'));

View file

@ -2,7 +2,7 @@
"type": "index", "type": "index",
"value": { "value": {
"aliases": {}, "aliases": {},
"index": "categorization_functional_test", "index": "ft_categorization",
"mappings": { "mappings": {
"properties": { "properties": {
"@timestamp": { "@timestamp": {
@ -39,835 +39,3 @@
} }
} }
} }
{
"type": "index",
"value": {
"aliases": {
".kibana": {}
},
"index": ".kibana_1",
"mappings": {
"_meta": {
"migrationMappingPropertyHashes": {
"action": "c0c235fba02ebd2a2412bcda79009b58",
"action_task_params": "a9d49f184ee89641044be0ca2950fa3a",
"alert": "e588043a01d3d43477e7cad7efa0f5d8",
"apm-indices": "9bb9b2bf1fa636ed8619cbab5ce6a1dd",
"apm-services-telemetry": "07ee1939fa4302c62ddc052ec03fed90",
"config": "87aca8fdb053154f11383fce3dbf3edf",
"dashboard": "d00f614b29a80360e1190193fd333bab",
"file-upload-telemetry": "0ed4d3e1983d1217a30982630897092e",
"index-pattern": "66eccb05066c5a89924f48a9e9736499",
"kql-telemetry": "d12a98a6f19a2d273696597547e064ee",
"lens": "21c3ea0763beb1ecb0162529706b88c5",
"lens-ui-telemetry": "509bfa5978586998e05f9e303c07a327",
"map": "23d7aa4a720d4938ccde3983f87bd58d",
"maps-telemetry": "268da3a48066123fc5baf35abaa55014",
"migrationVersion": "4a1746014a75ade3a714e1db5763276f",
"ml-telemetry": "257fd1d4b4fdbb9cb4b8a3b27da201e9",
"namespace": "2f4316de49999235636386fe51dc06c1",
"query": "11aaeb7f5f7fa5bb43f25e18ce26e7d9",
"references": "7997cf5a56cc02bdc9c93361bde732b0",
"sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4",
"search": "181661168bbadd1eff5902361e2a0d5c",
"server": "ec97f1c5da1a19609a60874e5af1100c",
"space": "c5ca8acafa0beaa4d08d014a97b6bc6b",
"telemetry": "358ffaa88ba34a97d55af0933a117de4",
"timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf",
"tsvb-validation-telemetry": "3a37ef6c8700ae6fc97d5c7da00e9215",
"type": "2f4316de49999235636386fe51dc06c1",
"ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3",
"updated_at": "00da57df13e94e9d98437d13ace4bfe0",
"upgrade-assistant-reindex-operation": "a53a20fe086b72c9a86da3cc12dad8a6",
"upgrade-assistant-telemetry": "56702cec857e0a9dacfb696655b4ff7b",
"url": "c7f66a0df8b1b52f17c28c4adb111105",
"visualization": "52d7a13ad68a150c4525b292d23e12cc"
}
},
"dynamic": "strict",
"properties": {
"action": {
"properties": {
"actionTypeId": {
"type": "keyword"
},
"config": {
"enabled": false,
"type": "object"
},
"name": {
"type": "text"
},
"secrets": {
"type": "binary"
}
}
},
"action_task_params": {
"properties": {
"actionId": {
"type": "keyword"
},
"apiKey": {
"type": "binary"
},
"params": {
"enabled": false,
"type": "object"
}
}
},
"alert": {
"properties": {
"actions": {
"properties": {
"actionRef": {
"type": "keyword"
},
"actionTypeId": {
"type": "keyword"
},
"group": {
"type": "keyword"
},
"params": {
"enabled": false,
"type": "object"
}
},
"type": "nested"
},
"alertTypeId": {
"type": "keyword"
},
"apiKey": {
"type": "binary"
},
"apiKeyOwner": {
"type": "keyword"
},
"consumer": {
"type": "keyword"
},
"createdAt": {
"type": "date"
},
"createdBy": {
"type": "keyword"
},
"enabled": {
"type": "boolean"
},
"muteAll": {
"type": "boolean"
},
"mutedInstanceIds": {
"type": "keyword"
},
"name": {
"type": "text"
},
"params": {
"enabled": false,
"type": "object"
},
"schedule": {
"properties": {
"interval": {
"type": "keyword"
}
}
},
"scheduledTaskId": {
"type": "keyword"
},
"tags": {
"type": "keyword"
},
"throttle": {
"type": "keyword"
},
"updatedBy": {
"type": "keyword"
}
}
},
"apm-indices": {
"properties": {
"apm_oss": {
"properties": {
"errorIndices": {
"type": "keyword"
},
"metricsIndices": {
"type": "keyword"
},
"onboardingIndices": {
"type": "keyword"
},
"sourcemapIndices": {
"type": "keyword"
},
"spanIndices": {
"type": "keyword"
},
"transactionIndices": {
"type": "keyword"
}
}
}
}
},
"apm-services-telemetry": {
"properties": {
"has_any_services": {
"type": "boolean"
},
"services_per_agent": {
"properties": {
"dotnet": {
"null_value": 0,
"type": "long"
},
"go": {
"null_value": 0,
"type": "long"
},
"java": {
"null_value": 0,
"type": "long"
},
"js-base": {
"null_value": 0,
"type": "long"
},
"nodejs": {
"null_value": 0,
"type": "long"
},
"python": {
"null_value": 0,
"type": "long"
},
"ruby": {
"null_value": 0,
"type": "long"
},
"rum-js": {
"null_value": 0,
"type": "long"
}
}
}
}
},
"config": {
"dynamic": "true",
"properties": {
"buildNum": {
"type": "keyword"
},
"dateFormat:tz": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"defaultIndex": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
},
"dashboard": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"file-upload-telemetry": {
"properties": {
"filesUploadedTotalCount": {
"type": "long"
}
}
},
"index-pattern": {
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
},
"type": {
"type": "keyword"
},
"typeMeta": {
"type": "keyword"
}
}
},
"kql-telemetry": {
"properties": {
"optInCount": {
"type": "long"
},
"optOutCount": {
"type": "long"
}
}
},
"lens": {
"properties": {
"expression": {
"index": false,
"type": "keyword"
},
"state": {
"type": "keyword"
},
"title": {
"type": "text"
},
"visualizationType": {
"type": "keyword"
}
}
},
"lens-ui-telemetry": {
"properties": {
"count": {
"type": "integer"
},
"date": {
"type": "date"
},
"name": {
"type": "keyword"
},
"type": {
"type": "keyword"
}
}
},
"map": {
"properties": {
"bounds": {
"type": "geo_shape"
},
"description": {
"type": "text"
},
"layerListJSON": {
"type": "text"
},
"mapStateJSON": {
"type": "text"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"maps-telemetry": {
"properties": {
"attributesPerMap": {
"properties": {
"dataSourcesCount": {
"properties": {
"avg": {
"type": "long"
},
"max": {
"type": "long"
},
"min": {
"type": "long"
}
}
},
"emsVectorLayersCount": {
"dynamic": "true",
"type": "object"
},
"layerTypesCount": {
"dynamic": "true",
"type": "object"
},
"layersCount": {
"properties": {
"avg": {
"type": "long"
},
"max": {
"type": "long"
},
"min": {
"type": "long"
}
}
}
}
},
"indexPatternsWithGeoFieldCount": {
"type": "long"
},
"mapsTotalCount": {
"type": "long"
},
"settings": {
"properties": {
"showMapVisualizationTypes": {
"type": "boolean"
}
}
},
"timeCaptured": {
"type": "date"
}
}
},
"migrationVersion": {
"dynamic": "true",
"properties": {
"index-pattern": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
},
"space": {
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
},
"type": "text"
}
}
},
"ml-telemetry": {
"properties": {
"file_data_visualizer": {
"properties": {
"index_creation_count": {
"type": "long"
}
}
}
}
},
"namespace": {
"type": "keyword"
},
"query": {
"properties": {
"description": {
"type": "text"
},
"filters": {
"enabled": false,
"type": "object"
},
"query": {
"properties": {
"language": {
"type": "keyword"
},
"query": {
"index": false,
"type": "keyword"
}
}
},
"timefilter": {
"enabled": false,
"type": "object"
},
"title": {
"type": "text"
}
}
},
"references": {
"properties": {
"id": {
"type": "keyword"
},
"name": {
"type": "keyword"
},
"type": {
"type": "keyword"
}
},
"type": "nested"
},
"sample-data-telemetry": {
"properties": {
"installCount": {
"type": "long"
},
"unInstallCount": {
"type": "long"
}
}
},
"search": {
"properties": {
"columns": {
"type": "keyword"
},
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"sort": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"server": {
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"space": {
"properties": {
"_reserved": {
"type": "boolean"
},
"color": {
"type": "keyword"
},
"description": {
"type": "text"
},
"disabledFeatures": {
"type": "keyword"
},
"imageUrl": {
"index": false,
"type": "text"
},
"initials": {
"type": "keyword"
},
"name": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"telemetry": {
"properties": {
"enabled": {
"type": "boolean"
},
"lastReported": {
"type": "date"
},
"lastVersionChecked": {
"ignore_above": 256,
"type": "keyword"
},
"sendUsageFrom": {
"ignore_above": 256,
"type": "keyword"
},
"userHasSeenNotice": {
"type": "boolean"
}
}
},
"timelion-sheet": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"timelion_chart_height": {
"type": "integer"
},
"timelion_columns": {
"type": "integer"
},
"timelion_interval": {
"type": "keyword"
},
"timelion_other_interval": {
"type": "keyword"
},
"timelion_rows": {
"type": "integer"
},
"timelion_sheet": {
"type": "text"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"tsvb-validation-telemetry": {
"properties": {
"failedRequests": {
"type": "long"
}
}
},
"type": {
"type": "keyword"
},
"ui-metric": {
"properties": {
"count": {
"type": "integer"
}
}
},
"updated_at": {
"type": "date"
},
"upgrade-assistant-reindex-operation": {
"dynamic": "true",
"properties": {
"indexName": {
"type": "keyword"
},
"status": {
"type": "integer"
}
}
},
"upgrade-assistant-telemetry": {
"properties": {
"features": {
"properties": {
"deprecation_logging": {
"properties": {
"enabled": {
"null_value": true,
"type": "boolean"
}
}
}
}
},
"ui_open": {
"properties": {
"cluster": {
"null_value": 0,
"type": "long"
},
"indices": {
"null_value": 0,
"type": "long"
},
"overview": {
"null_value": 0,
"type": "long"
}
}
},
"ui_reindex": {
"properties": {
"close": {
"null_value": 0,
"type": "long"
},
"open": {
"null_value": 0,
"type": "long"
},
"start": {
"null_value": 0,
"type": "long"
},
"stop": {
"null_value": 0,
"type": "long"
}
}
}
}
},
"url": {
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"fields": {
"keyword": {
"ignore_above": 2048,
"type": "keyword"
}
},
"type": "text"
}
}
},
"visualization": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchRefName": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
}
}
},
"settings": {
"index": {
"auto_expand_replicas": "0-1",
"number_of_replicas": "0",
"number_of_shards": "1"
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -30,3 +30,4 @@ export { MachineLearningSecurityCommonProvider } from './security_common';
export { MachineLearningSecurityUIProvider } from './security_ui'; export { MachineLearningSecurityUIProvider } from './security_ui';
export { MachineLearningSettingsProvider } from './settings'; export { MachineLearningSettingsProvider } from './settings';
export { MachineLearningSingleMetricViewerProvider } from './single_metric_viewer'; export { MachineLearningSingleMetricViewerProvider } from './single_metric_viewer';
export { MachineLearningTestResourcesProvider } from './test_resources';

View file

@ -0,0 +1,219 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ProvidedType } from '@kbn/test/types/ftr';
import { savedSearches } from './test_resources_data';
import { FtrProviderContext } from '../../ftr_provider_context';
const COMMON_HEADERS = {
'kbn-xsrf': 'some-xsrf-token',
};
export enum SavedObjectType {
CONFIG = 'config',
DASHBOARD = 'dashboard',
INDEX_PATTERN = 'index-pattern',
SEARCH = 'search',
VISUALIZATION = 'visualization',
}
export type MlTestResourcesi = ProvidedType<typeof MachineLearningTestResourcesProvider>;
export function MachineLearningTestResourcesProvider({ getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const log = getService('log');
const supertest = getService('supertest');
return {
async setKibanaTimeZoneToUTC() {
await kibanaServer.uiSettings.update({
'dateFormat:tz': 'UTC',
});
},
async resetKibanaTimeZone() {
await kibanaServer.uiSettings.unset('dateFormat:tz');
},
async savedObjectExists(id: string, objectType: SavedObjectType): Promise<boolean> {
const response = await supertest.get(`/api/saved_objects/${objectType}/${id}`);
return response.status === 200;
},
async getSavedObjectIdByTitle(
title: string,
objectType: SavedObjectType
): Promise<string | undefined> {
log.debug(`Searching for '${objectType}' with title '${title}'...`);
const findResponse = await supertest
.get(`/api/saved_objects/_find?type=${objectType}`)
.set(COMMON_HEADERS)
.expect(200)
.then((res: any) => res.body);
for (const savedObject of findResponse.saved_objects) {
const objectTitle = savedObject.attributes.title;
if (objectTitle === title) {
log.debug(` > Found '${savedObject.id}'`);
return savedObject.id;
}
}
log.debug(` > Not found`);
},
async getIndexPatternId(title: string): Promise<string | undefined> {
return this.getSavedObjectIdByTitle(title, SavedObjectType.INDEX_PATTERN);
},
async getSavedSearchId(title: string): Promise<string | undefined> {
return this.getSavedObjectIdByTitle(title, SavedObjectType.SEARCH);
},
async createIndexPattern(title: string, timeFieldName?: string): Promise<string> {
log.debug(
`Creating index pattern with title '${title}'${
timeFieldName !== undefined ? ` and time field '${timeFieldName}'` : ''
}`
);
const createResponse = await supertest
.post(`/api/saved_objects/${SavedObjectType.INDEX_PATTERN}`)
.set(COMMON_HEADERS)
.send({ attributes: { title, timeFieldName } })
.expect(200)
.then((res: any) => res.body);
log.debug(` > Created with id '${createResponse.id}'`);
return createResponse.id;
},
async createIndexPatternIfNeeded(title: string, timeFieldName?: string): Promise<string> {
const indexPatternId = await this.getIndexPatternId(title);
if (indexPatternId !== undefined) {
log.debug(`Index pattern with title '${title}' already exists. Nothing to create.`);
return indexPatternId;
} else {
return await this.createIndexPattern(title, timeFieldName);
}
},
async createSavedSearch(title: string, body: object): Promise<string> {
log.debug(`Creating saved search with title '${title}'`);
const createResponse = await supertest
.post(`/api/saved_objects/${SavedObjectType.SEARCH}`)
.set(COMMON_HEADERS)
.send(body)
.expect(200)
.then((res: any) => res.body);
log.debug(` > Created with id '${createResponse.id}'`);
return createResponse.id;
},
async createSavedSearchIfNeeded(savedSearch: any): Promise<string> {
const title = savedSearch.requestBody.attributes.title;
const savedSearchId = await this.getSavedSearchId(title);
if (savedSearchId !== undefined) {
log.debug(`Saved search with title '${title}' already exists. Nothing to create.`);
return savedSearchId;
} else {
const body = await this.updateSavedSearchRequestBody(
savedSearch.requestBody,
savedSearch.indexPatternTitle
);
return await this.createSavedSearch(title, body);
}
},
async updateSavedSearchRequestBody(body: object, indexPatternTitle: string): Promise<object> {
const indexPatternId = await this.getIndexPatternId(indexPatternTitle);
if (indexPatternId === undefined) {
throw new Error(
`Index pattern '${indexPatternTitle}' to base saved search on does not exist. `
);
}
// inject index pattern id
const updatedBody = JSON.parse(JSON.stringify(body), (_key, value) => {
if (value === 'INDEX_PATTERN_ID_PLACEHOLDER') {
return indexPatternId;
} else {
return value;
}
});
// make searchSourceJSON node a string
const searchSourceJsonNode = updatedBody.attributes.kibanaSavedObjectMeta.searchSourceJSON;
const searchSourceJsonString = JSON.stringify(searchSourceJsonNode);
updatedBody.attributes.kibanaSavedObjectMeta.searchSourceJSON = searchSourceJsonString;
return updatedBody;
},
async createSavedSearchFarequoteFilterIfNeeded() {
await this.createSavedSearchIfNeeded(savedSearches.farequoteFilter);
},
async createSavedSearchFarequoteLuceneIfNeeded() {
await this.createSavedSearchIfNeeded(savedSearches.farequoteLucene);
},
async createSavedSearchFarequoteKueryIfNeeded() {
await this.createSavedSearchIfNeeded(savedSearches.farequoteKuery);
},
async createSavedSearchFarequoteFilterAndLuceneIfNeeded() {
await this.createSavedSearchIfNeeded(savedSearches.farequoteFilterAndLucene);
},
async createSavedSearchFarequoteFilterAndKueryIfNeeded() {
await this.createSavedSearchIfNeeded(savedSearches.farequoteFilterAndKuery);
},
async deleteIndexPattern(title: string) {
log.debug(`Deleting index pattern with title '${title}'...`);
const indexPatternId = await this.getIndexPatternId(title);
if (indexPatternId === undefined) {
log.debug(`Index pattern with title '${title}' does not exists. Nothing to delete.`);
return;
} else {
await supertest
.delete(`/api/saved_objects/${SavedObjectType.INDEX_PATTERN}/${indexPatternId}`)
.set(COMMON_HEADERS)
.expect(200);
log.debug(` > Deleted index pattern with id '${indexPatternId}'`);
}
},
async deleteSavedSearch(title: string) {
log.debug(`Deleting saved search with title '${title}'...`);
const savedSearchId = await this.getSavedSearchId(title);
if (savedSearchId === undefined) {
log.debug(`Saved search with title '${title}' does not exists. Nothing to delete.`);
return;
} else {
await supertest
.delete(`/api/saved_objects/${SavedObjectType.SEARCH}/${savedSearchId}`)
.set(COMMON_HEADERS)
.expect(200);
log.debug(` > Deleted saved searchwith id '${savedSearchId}'`);
}
},
async deleteSavedSearches() {
for (const search of Object.values(savedSearches)) {
await this.deleteSavedSearch(search.requestBody.attributes.title);
}
},
};
}

View file

@ -0,0 +1,249 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export const savedSearches = {
farequoteFilter: {
indexPatternTitle: 'ft_farequote',
requestBody: {
attributes: {
title: 'ft_farequote_filter',
description: '',
hits: 0,
columns: ['_source'],
sort: ['@timestamp', 'desc'],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: {
highlightAll: true,
version: true,
query: {
query: '',
language: 'lucene',
},
filter: [
{
meta: {
index: 'INDEX_PATTERN_ID_PLACEHOLDER',
negate: false,
disabled: false,
alias: null,
type: 'phrase',
key: 'airline',
value: 'ASA',
params: {
query: 'ASA',
type: 'phrase',
},
},
query: {
match: {
airline: {
query: 'ASA',
type: 'phrase',
},
},
},
$state: {
store: 'appState',
},
},
],
indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index',
},
},
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: 'INDEX_PATTERN_ID_PLACEHOLDER',
},
],
},
},
farequoteLucene: {
indexPatternTitle: 'ft_farequote',
requestBody: {
attributes: {
title: 'ft_farequote_lucene',
description: '',
hits: 0,
columns: ['_source'],
sort: ['@timestamp', 'desc'],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: {
highlightAll: true,
version: true,
query: {
query: 'airline:A*',
language: 'lucene',
},
filter: [],
indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index',
},
},
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: 'INDEX_PATTERN_ID_PLACEHOLDER',
},
],
},
},
farequoteKuery: {
indexPatternTitle: 'ft_farequote',
requestBody: {
attributes: {
title: 'ft_farequote_kuery',
description: '',
hits: 0,
columns: ['_source'],
sort: ['@timestamp', 'desc'],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: {
highlightAll: true,
version: true,
query: {
query: 'airline: A* and responsetime > 5',
language: 'kuery',
},
filter: [],
indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index',
},
},
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: 'INDEX_PATTERN_ID_PLACEHOLDER',
},
],
},
},
farequoteFilterAndLucene: {
indexPatternTitle: 'ft_farequote',
requestBody: {
attributes: {
title: 'ft_farequote_filter_and_lucene',
description: '',
hits: 0,
columns: ['_source'],
sort: ['@timestamp', 'desc'],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: {
highlightAll: true,
version: true,
query: {
query: 'responsetime:>50',
language: 'lucene',
},
filter: [
{
meta: {
index: 'INDEX_PATTERN_ID_PLACEHOLDER',
negate: false,
disabled: false,
alias: null,
type: 'phrase',
key: 'airline',
value: 'ASA',
params: {
query: 'ASA',
type: 'phrase',
},
},
query: {
match: {
airline: {
query: 'ASA',
type: 'phrase',
},
},
},
$state: {
store: 'appState',
},
},
],
indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index',
},
},
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: 'INDEX_PATTERN_ID_PLACEHOLDER',
},
],
},
},
farequoteFilterAndKuery: {
indexPatternTitle: 'ft_farequote',
requestBody: {
attributes: {
title: 'ft_farequote_filter_and_kuery',
description: '',
hits: 0,
columns: ['_source'],
sort: ['@timestamp', 'desc'],
version: 1,
kibanaSavedObjectMeta: {
searchSourceJSON: {
highlightAll: true,
version: true,
query: {
query: 'responsetime > 49',
language: 'kuery',
},
filter: [
{
meta: {
index: 'INDEX_PATTERN_ID_PLACEHOLDER',
negate: false,
disabled: false,
alias: null,
type: 'phrase',
key: 'airline',
value: 'ASA',
params: {
query: 'ASA',
type: 'phrase',
},
},
query: {
match: {
airline: {
query: 'ASA',
type: 'phrase',
},
},
},
$state: {
store: 'appState',
},
},
],
indexRefName: 'kibanaSavedObjectMeta.searchSourceJSON.index',
},
},
},
references: [
{
name: 'kibanaSavedObjectMeta.searchSourceJSON.index',
type: 'index-pattern',
id: 'INDEX_PATTERN_ID_PLACEHOLDER',
},
],
},
},
};

View file

@ -33,6 +33,7 @@ import {
MachineLearningSecurityUIProvider, MachineLearningSecurityUIProvider,
MachineLearningSettingsProvider, MachineLearningSettingsProvider,
MachineLearningSingleMetricViewerProvider, MachineLearningSingleMetricViewerProvider,
MachineLearningTestResourcesProvider,
} from './machine_learning'; } from './machine_learning';
export function MachineLearningProvider(context: FtrProviderContext) { export function MachineLearningProvider(context: FtrProviderContext) {
@ -67,6 +68,7 @@ export function MachineLearningProvider(context: FtrProviderContext) {
const securityUI = MachineLearningSecurityUIProvider(context, securityCommon); const securityUI = MachineLearningSecurityUIProvider(context, securityCommon);
const settings = MachineLearningSettingsProvider(context); const settings = MachineLearningSettingsProvider(context);
const singleMetricViewer = MachineLearningSingleMetricViewerProvider(context); const singleMetricViewer = MachineLearningSingleMetricViewerProvider(context);
const testResources = MachineLearningTestResourcesProvider(context);
return { return {
anomaliesTable, anomaliesTable,
@ -95,5 +97,6 @@ export function MachineLearningProvider(context: FtrProviderContext) {
securityUI, securityUI,
settings, settings,
singleMetricViewer, singleMetricViewer,
testResources,
}; };
} }

View file

@ -17,6 +17,8 @@ import {
TransformWizardProvider, TransformWizardProvider,
} from './transform_ui'; } from './transform_ui';
import { MachineLearningTestResourcesProvider } from './machine_learning';
export function TransformProvider(context: FtrProviderContext) { export function TransformProvider(context: FtrProviderContext) {
const api = TransformAPIProvider(context); const api = TransformAPIProvider(context);
const management = TransformManagementProvider(context); const management = TransformManagementProvider(context);
@ -25,6 +27,7 @@ export function TransformProvider(context: FtrProviderContext) {
const securityUI = TransformSecurityUIProvider(context, securityCommon); const securityUI = TransformSecurityUIProvider(context, securityCommon);
const sourceSelection = TransformSourceSelectionProvider(context); const sourceSelection = TransformSourceSelectionProvider(context);
const table = TransformTableProvider(context); const table = TransformTableProvider(context);
const testResources = MachineLearningTestResourcesProvider(context);
const wizard = TransformWizardProvider(context); const wizard = TransformWizardProvider(context);
return { return {
@ -35,6 +38,7 @@ export function TransformProvider(context: FtrProviderContext) {
securityUI, securityUI,
sourceSelection, sourceSelection,
table, table,
testResources,
wizard, wizard,
}; };
} }