Skip to content

Commit

Permalink
[FTR] Serverless - enable common config grouping (elastic#167172)
Browse files Browse the repository at this point in the history
## Summary

This PR introduces grouped common configs in serverless project FTR
tests.

### Details

* With increasing number of added tests, we're running into issues with
test run time (configurations are stopped at 40 minutes)
* This PR moves the inclusion of `common` tests from the projects' main
`config.ts` file to `common_configs/config.group1.ts`, which can easily
be extended
* As part of that, `common` tests in `api_integration/test_suites` and
`functional/test_suites` are re-organized to no longer contain a top
level index file
  * Created sub-directories and index files where needed
* This makes it easier to group `common` tests when including them in
project config files

### Additional changes

* Add README files to
`x-pack/test_serverless/[api_integration|functional]/test_suites/common`
* Rename `security` directory in `common` tests to `platform_security`
to avoid confusion with the `security` project type
* Include sample data test suite in an index file (this suite wasn't
included so far and didn't run at all) and prepared it for actually
working in serverless
  * it's still failing and should be fixed soon - skipped it for now
  • Loading branch information
pheyos authored Sep 29, 2023
1 parent 5dedc99 commit 343c04c
Show file tree
Hide file tree
Showing 58 changed files with 477 additions and 219 deletions.
8 changes: 7 additions & 1 deletion .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,22 @@ enabled:
- x-pack/test/upgrade_assistant_integration/config.js
- x-pack/test/usage_collection/config.ts
- x-pack/test_serverless/api_integration/test_suites/observability/config.ts
- x-pack/test_serverless/api_integration/test_suites/observability/config.feature_flags.ts
- x-pack/test_serverless/api_integration/test_suites/observability/common_configs/config.group1.ts
- x-pack/test_serverless/api_integration/test_suites/search/config.ts
- x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts
- x-pack/test_serverless/api_integration/test_suites/security/config.ts
- x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/observability/config.ts
- x-pack/test_serverless/functional/test_suites/observability/config.examples.ts
- x-pack/test_serverless/api_integration/test_suites/observability/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/search/config.ts
- x-pack/test_serverless/functional/test_suites/search/config.examples.ts
- x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts
- x-pack/test_serverless/functional/test_suites/search/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/security/config.ts
- x-pack/test_serverless/functional/test_suites/security/config.examples.ts
- x-pack/test_serverless/functional/test_suites/security/common_configs/config.group1.ts
- x-pack/performance/journeys/ecommerce_dashboard.ts
- x-pack/performance/journeys/ecommerce_dashboard_map_only.ts
- x-pack/performance/journeys/flight_dashboard.ts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Kibana Serverless Common API Integration Tests

The `common` tests in this directory are not project specific and are running
in two or three of the projects. You can use tags to exclude one of the
projects: `skipSvlOblt`, `skipSvlSearch`, `skipSvlSec`. If no such tag is added,
the test will run in all three projects.
Tests that are designed to only run in one of the projects should be added to
the project specific test directory and not to `common` with two skips.

For more information about serverless tests please refer to
[x-pack/test_serverless/README](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/README.md).

## Organizing common tests

- Common tests don't have dedicated config files as they run as part of project
configs.
- There's no top level index file and tests are organized in sub-directories in
order to better group them based on test run time.
- **If you add a new `common` sub-directory, remember to add it to the `common_configs` of all projects (`x-pack/test_serverless/api_integration/test_suites/[observability|search|security]/common_configs`)**





Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const esSupertest = getService('esSupertest');
const svlCommonApi = getService('svlCommonApi');

describe('Elasticsearch API', function () {
describe('Home', function () {
it('can request /', async () => {
const { body, status } = await esSupertest.get('/');
svlCommonApi.assertResponseStatusCode(200, status, body);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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 type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Elasticsearch API', () => {
loadTestFile(require.resolve('./home'));
});
}
39 changes: 0 additions & 39 deletions x-pack/test_serverless/api_integration/test_suites/common/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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 type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('Management', () => {
loadTestFile(require.resolve('./ingest_pipelines'));
loadTestFile(require.resolve('./rollups'));
loadTestFile(require.resolve('./scripted_fields'));
loadTestFile(require.resolve('./spaces'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from '@kbn/expect';
import { IngestPutPipelineRequest } from '@elastic/elasticsearch/lib/api/types';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { INITIAL_REST_VERSION_INTERNAL } from '@kbn/data-views-plugin/server/constants';
import { X_ELASTIC_INTERNAL_ORIGIN_REQUEST } from '@kbn/core-http-common/src/constants';
import { FIELDS_FOR_WILDCARD_PATH as BASE_URI } from '@kbn/data-views-plugin/common/constants';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import expect from 'expect';
import { DATA_VIEW_PATH } from '@kbn/data-views-plugin/server';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import expect from 'expect';
import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const svlCommonApi = getService('svlCommonApi');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }: FtrProviderContext) {
const svlCommonApi = getService('svlCommonApi');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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 default function ({ loadTestFile }: FtrProviderContext) {
describe('serverless common API', function () {
loadTestFile(require.resolve('./anonymous'));
loadTestFile(require.resolve('./api_keys'));
loadTestFile(require.resolve('./authentication'));
loadTestFile(require.resolve('./authentication_http'));
loadTestFile(require.resolve('./authorization'));
loadTestFile(require.resolve('./encrypted_saved_objects'));
loadTestFile(require.resolve('./misc'));
loadTestFile(require.resolve('./response_headers'));
loadTestFile(require.resolve('./role_mappings'));
loadTestFile(require.resolve('./sessions'));
loadTestFile(require.resolve('./users'));
loadTestFile(require.resolve('./user_profiles'));
loadTestFile(require.resolve('./views'));
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const baseTestConfig = await readConfigFile(require.resolve('../config.ts'));

return {
...baseTestConfig.getAll(),
testFiles: [
require.resolve('../../common/alerting'),
require.resolve('../../common/data_view_field_editor'),
require.resolve('../../common/data_views'),
require.resolve('../../common/elasticsearch_api'),
require.resolve('../../common/index_management'),
require.resolve('../../common/kql_telemetry'),
require.resolve('../../common/management'),
require.resolve('../../common/platform_security'),
require.resolve('../../common/scripts_tests'),
require.resolve('../../common/search_oss'),
require.resolve('../../common/search_xpack'),
],
junit: {
reportName: 'Serverless Observability API Integration Tests - Common Group 1',
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { services } from './apm_api_integration/common/services';

export default createTestConfig({
serverlessProject: 'oblt',
testFiles: [require.resolve('../common'), require.resolve('.')],
testFiles: [require.resolve('.')],
junit: {
reportName: 'Serverless Observability API Integration Tests',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const baseTestConfig = await readConfigFile(require.resolve('../config.ts'));

return {
...baseTestConfig.getAll(),
testFiles: [
require.resolve('../../common/alerting'),
require.resolve('../../common/data_view_field_editor'),
require.resolve('../../common/data_views'),
require.resolve('../../common/elasticsearch_api'),
require.resolve('../../common/index_management'),
require.resolve('../../common/kql_telemetry'),
require.resolve('../../common/management'),
require.resolve('../../common/platform_security'),
require.resolve('../../common/scripts_tests'),
require.resolve('../../common/search_oss'),
require.resolve('../../common/search_xpack'),
],
junit: {
reportName: 'Serverless Search API Integration Tests - Common Group 1',
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createTestConfig } from '../../config.base';

export default createTestConfig({
serverlessProject: 'es',
testFiles: [require.resolve('../common'), require.resolve('.')],
testFiles: [require.resolve('.')],
junit: {
reportName: 'Serverless Search API Integration Tests',
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 { FtrConfigProviderContext } from '@kbn/test';

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const baseTestConfig = await readConfigFile(require.resolve('../config.ts'));

return {
...baseTestConfig.getAll(),
testFiles: [
require.resolve('../../common/alerting'),
require.resolve('../../common/data_view_field_editor'),
require.resolve('../../common/data_views'),
require.resolve('../../common/elasticsearch_api'),
require.resolve('../../common/index_management'),
require.resolve('../../common/kql_telemetry'),
require.resolve('../../common/management'),
require.resolve('../../common/platform_security'),
require.resolve('../../common/scripts_tests'),
require.resolve('../../common/search_oss'),
require.resolve('../../common/search_xpack'),
],
junit: {
reportName: 'Serverless Security API Integration Tests - Common Group 1',
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createTestConfig } from '../../config.base';

export default createTestConfig({
serverlessProject: 'security',
testFiles: [require.resolve('../common'), require.resolve('.')],
testFiles: [require.resolve('.')],
junit: {
reportName: 'Serverless Security API Integration Tests',
},
Expand Down
24 changes: 24 additions & 0 deletions x-pack/test_serverless/functional/test_suites/common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Kibana Serverless Common Functional Tests

The `common` tests in this directory are not project specific and are running
in two or three of the projects. You can use tags to exclude one of the
projects: `skipSvlOblt`, `skipSvlSearch`, `skipSvlSec`. If no such tag is added,
the test will run in all three projects.
Tests that are designed to only run in one of the projects should be added to
the project specific test directory and not to `common` with two skips.

For more information about serverless tests please refer to
[x-pack/test_serverless/README](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/README.md).

## Organizing common tests

- Common tests don't have dedicated config files as they run as part of project
configs.
- There's no top level index file and tests are organized in sub-directories in
order to better group them based on test run time.
- **If you add a new `common` sub-directory, remember to add it to the `common_configs` of all projects (`x-pack/test_serverless/functional/test_suites/[observability|search|security]/common_configs`)**





Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* 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 default function ({ loadTestFile }: FtrProviderContext) {
describe('Serverless Common UI - Examples', function () {
this.tags('skipMKI');
loadTestFile(require.resolve('./data_view_field_editor_example'));
loadTestFile(require.resolve('./discover_customization_examples'));
loadTestFile(require.resolve('./field_formats'));
loadTestFile(require.resolve('./partial_results'));
loadTestFile(require.resolve('./search'));
loadTestFile(require.resolve('./search_examples'));
loadTestFile(require.resolve('./unified_field_list_examples'));
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { FtrProviderContext } from '../../ftr_provider_context';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObject, getService }: FtrProviderContext) {
const svlCommonPage = getPageObject('svlCommonPage');
Expand Down
Loading

0 comments on commit 343c04c

Please sign in to comment.