Skip to content

Commit e710e98

Browse files
pheyosazasypkin
andauthored
[workchat] Initial FTR test setup (#216828)
## Summary This PR adds the structure for workchat FTR tests and adds a few initial tests as an example. ### Details about initially added tests New test directories: - `x-pack/test_serverless/api_integration/test_suites/chat` - load a few common tests (that run on all project types) - run `platform` security tests (taken over from `search` project type) - `x-pack/test_serverless/functional/services/svl_chat_navigation.ts` - load the `home page` common test - run a simple navigation test, using the `svlChatNavigation` service that has been introduced as an example Note that these tests mostly serve as examples to prove things are actually running and will have to be adjusted / removed / extended over time. The purpose of this PR is NOT to add proper test coverage. Closes #213469 --------- Co-authored-by: Aleh Zasypkin <[email protected]>
1 parent 4302da3 commit e710e98

File tree

38 files changed

+2497
-34
lines changed

38 files changed

+2497
-34
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
disabled:
2+
# Base config files, only necessary to inform config finding script
3+
4+
defaultQueue: 'n2-4-spot'
5+
enabled:
6+
- x-pack/test_serverless/api_integration/test_suites/chat/config.ts
7+
- x-pack/test_serverless/api_integration/test_suites/chat/config.feature_flags.ts
8+
- x-pack/test_serverless/api_integration/test_suites/chat/common_configs/config.group1.ts
9+
- x-pack/test_serverless/functional/test_suites/chat/config.ts
10+
- x-pack/test_serverless/functional/test_suites/chat/config.feature_flags.ts
11+
- x-pack/test_serverless/functional/test_suites/chat/common_configs/config.group1.ts

.buildkite/ftr_configs_manifests.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
".buildkite/ftr_base_serverless_configs.yml",
1010
".buildkite/ftr_oblt_serverless_configs.yml",
1111
".buildkite/ftr_security_serverless_configs.yml",
12-
".buildkite/ftr_search_serverless_configs.yml"
12+
".buildkite/ftr_search_serverless_configs.yml",
13+
".buildkite/ftr_chat_serverless_configs.yml"
1314
]
14-
}
15+
}

.github/CODEOWNERS

+6
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,12 @@ x-pack/test/api_integration/apis/management/index_management/inference_endpoints
21042104
/x-pack/test_serverless/functional/page_objects/svl_search_* @elastic/search-kibana
21052105
/x-pack/test/functional_search/ @elastic/search-kibana
21062106

2107+
# workchat
2108+
/x-pack/test_serverless/api_integration/test_suites/chat @elastic/search-kibana
2109+
/x-pack/test_serverless/api_integration/test_suites/chat/config.ts @elastic/search-kibana @elastic/appex-qa
2110+
/x-pack/test_serverless/functional/test_suites/chat/ @elastic/search-kibana
2111+
/x-pack/test_serverless/functional/test_suites/chat/config.ts @elastic/search-kibana @elastic/appex-qa
2112+
21072113
# Management Experience - Deployment Management
21082114
/src/platform/test/functional/fixtures/kbn_archiver/management.json @elastic/kibana-management @elastic/kibana-data-discovery # Assigned per 2 uses: test/functional/apps/management/_import_objects.ts && test/functional/apps/management/data_views/_scripted_fields_filter.ts
21092115
/x-pack/test/functional/fixtures/kbn_archiver/home/feature_controls/security/security.json @elastic/kibana-management

packages/kbn-mock-idp-plugin/server/plugin.ts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const projectToAlias = new Map<string, string>([
3939
// TODO add new 'chat' solution
4040
// https://elastic.slack.com/archives/C04HT4P1YS3/p1741690997400059
4141
// https://github.com/elastic/kibana/issues/213469
42+
// requires update of config/serverless.chat.yml (currently uses projectType 'search')
4243
]);
4344

4445
const readServerlessRoles = (projectType: string) => {

src/platform/packages/shared/kbn-es/src/serverless_resources/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The resources in this directory are used for seeding Elasticsearch Serverless im
44

55
## Roles
66

7-
Roles are defined in `roles.yml` for each project under 'es' | 'oblt' | 'security' folder respectively and intended to mock a Serverless deployment. It must be in sync with `project-controller` defined roles and used in real (MKI) environments. In case of some differences tests may pass against Serverless snapshot environment but fail against MKI environments creating confusion.
7+
Roles are defined in `roles.yml` for each project under 'es' | 'oblt' | 'security' | 'chat' folder respectively and intended to mock a Serverless deployment. It must be in sync with `elasticsearch-controller` defined roles and used in real (MKI) environments. In case of some differences tests may pass against Serverless snapshot environment but fail against MKI environments creating confusion.
88

99
### Why `security_roles.json` is here?
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -----
2+
# Copy from internal roles config in elasticsearch-controller
3+
# -----
4+
viewer:
5+
cluster: ['manage_own_api_key', 'read_pipeline']
6+
indices:
7+
- names:
8+
- '*'
9+
privileges:
10+
- 'read'
11+
- 'view_index_metadata'
12+
applications:
13+
- application: 'kibana-.kibana'
14+
privileges:
15+
- 'read'
16+
resources:
17+
- '*'
18+
developer:
19+
cluster: ['all']
20+
indices:
21+
- names:
22+
- '*'
23+
privileges:
24+
- 'all'
25+
applications:
26+
- application: 'kibana-.kibana'
27+
privileges:
28+
- 'all'
29+
resources:
30+
- '*'
31+
32+
# admin role defined in elasticsearch controller
33+
admin:
34+
cluster: ['all']
35+
indices:
36+
- names: ['*']
37+
privileges: ['all']
38+
allow_restricted_indices: false
39+
applications:
40+
- application: '*'
41+
privileges: ['*']
42+
resources: ['*']
43+
44+
# temporarily added for testing purpose
45+
system_indices_superuser:
46+
cluster: ['all']
47+
indices:
48+
- names: ['*']
49+
privileges: ['all']
50+
allow_restricted_indices: true
51+
applications:
52+
- application: '*'
53+
privileges: ['*']
54+
resources: ['*']
55+
run_as: ['*']

src/platform/packages/shared/kbn-es/src/serverless_resources/project_roles/es/roles.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----
2-
# Source: project-controller/blob/main/internal/project/esproject/config/roles.yml
2+
# Copy from internal roles config in elasticsearch-controller
33
# -----
44
viewer:
55
cluster: ['manage_own_api_key', 'read_pipeline']

src/platform/packages/shared/kbn-es/src/serverless_resources/project_roles/oblt/roles.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----
2-
# Source: project-controller/blob/main/internal/project/security/config/roles.yml
2+
# Copy from internal roles config in elasticsearch-controller
33
# -----
44
viewer:
55
cluster: []

src/platform/packages/shared/kbn-es/src/serverless_resources/project_roles/security/roles.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----
2-
# Source: project-controller/blob/main/internal/project/security/config/roles.yml
2+
# Copy from internal roles config in elasticsearch-controller
33
# -----
44
# modeled after the t1_analyst minus osquery run saved queries privilege
55
viewer:

src/platform/packages/shared/kbn-es/src/utils/docker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ interface BaseOptions extends ImageOptions {
6363
files?: string | string[];
6464
}
6565

66-
export const serverlessProjectTypes = new Set<string>(['es', 'oblt', 'security']);
66+
export const serverlessProjectTypes = new Set<string>(['es', 'oblt', 'security', 'chat']);
6767
export const isServerlessProjectType = (value: string): value is ServerlessProjectType => {
6868
return serverlessProjectTypes.has(value);
6969
};
7070

71-
export type ServerlessProjectType = 'es' | 'oblt' | 'security';
71+
export type ServerlessProjectType = 'es' | 'oblt' | 'security' | 'chat';
7272

7373
export interface DockerOptions extends EsClusterExecOptions, BaseOptions {
7474
dockerCmd?: string;

src/platform/packages/shared/kbn-ftr-common-functional-services/services/saml_auth/serverless/auth_provider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const projectDefaultRoles = new Map<string, Role>([
2323
['es', 'developer'],
2424
['security', 'editor'],
2525
['oblt', 'editor'],
26+
['chat', 'developer'], // TODO: double check if it's really 'developer'
2627
]);
2728

2829
const projectTypesWithCustomRolesEnabled = ['es', 'security'];

src/platform/packages/shared/kbn-scout/src/playwright/tags.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
const SERVERLESS_ONLY = ['@svlSecurity', '@svlOblt', '@svlSearch'];
10+
const SERVERLESS_ONLY = ['@svlSecurity', '@svlOblt', '@svlSearch', '@svlChat'];
1111
const ESS_ONLY = ['@ess'];
12-
const DEPLOYMENT_AGNOSTIC = SERVERLESS_ONLY.concat(ESS_ONLY);
12+
// svlChat is truly serverless only and doesn't have a stateful counterpart
13+
const DEPLOYMENT_AGNOSTIC = ['@ess', '@svlSecurity', '@svlOblt', '@svlSearch'];
1314
const PERFORMANCE = ['@perf'];
1415

1516
export const tags = {
@@ -22,6 +23,7 @@ export const tags = {
2223
export const tagsByMode = {
2324
stateful: '@ess',
2425
serverless: {
26+
chat: '@svlChat',
2527
es: '@svlSearch',
2628
oblt: '@svlOblt',
2729
security: '@svlSecurity',

x-pack/solutions/chat/plugins/workchat-app/public/application/components/home/home_view.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { HomeIntegrationSection } from './home_integration_section';
1212

1313
export const WorkChatHomeView: React.FC<{}> = () => {
1414
return (
15-
<KibanaPageTemplate panelled>
15+
<KibanaPageTemplate panelled data-test-subj="workChatHomePage">
1616
<KibanaPageTemplate.Header pageTitle="WorkChat" />
1717

1818
<HomeAgentSection />

x-pack/test/api_integration/deployment_agnostic/default_configs/serverless.config.base.ts

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const esServerArgsFromController = {
3636
'xpack.ml.dfa.enabled=false',
3737
],
3838
security: ['xpack.security.authc.api_key.cache.max_keys=70000'],
39+
chat: [],
3940
};
4041

4142
// include settings from kibana controller
@@ -55,6 +56,7 @@ const kbnServerArgsFromController = {
5556
// disable fleet task that writes to metrics.fleet_server.* data streams, impacting functional tests
5657
`--xpack.task_manager.unsafe.exclude_task_types=${JSON.stringify(['Fleet-Metrics-Task'])}`,
5758
],
59+
chat: [],
5860
};
5961

6062
export function createServerlessTestConfig<T extends DeploymentAgnosticCommonServices>(

x-pack/test_serverless/README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
The tests and helper methods (services, page objects) defined here in
44
`x-pack/test_serverless` cover the serverless functionality introduced by the
5-
`serverless`, `serverless_observability`, `serverless_search` and
6-
`serverless_security` plugins.
5+
`serverless`, `serverless_observability`, `serverless_search`, `security_solution_serverless` and `serverless_chat` plugins.
76

87
For how to set up Docker for serverless ES images, please refer to
98
[src/platform/packages/shared/kbn-es/README](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-es/README.mdx).
@@ -19,6 +18,7 @@ set of helper methods and sub-directories for
1918
- `observability` project specific functionality
2019
- `search` project specific functionality
2120
- `security` project specific functionality
21+
- `chat` project specific functionality
2222

2323
The `shared` directory contains fixtures, services, ... that are shared across
2424
`api_integration` abd `functional` tests.
@@ -28,6 +28,7 @@ x-pack/test_serverless/
2828
├─ api_integration
2929
│ ├─ services
3030
│ ├─ test_suites
31+
│ │ ├─ chat
3132
│ │ ├─ common
3233
│ │ ├─ observability
3334
│ │ ├─ search
@@ -36,6 +37,7 @@ x-pack/test_serverless/
3637
│ ├─ page_objects
3738
│ ├─ services
3839
│ ├─ test_suites
40+
│ │ ├─ chat
3941
│ │ ├─ common
4042
│ │ ├─ observability
4143
│ │ ├─ search
@@ -52,25 +54,25 @@ covering functionality that's shared across serverless projects. That's why thes
5254
don't have a dedicated config file and instead need to be included in project specific
5355
configurations.
5456

55-
**If you add a new `api_integration` or `functional` `common` sub-directory, remember to add it to the corresponding `common_configs` of all projects (`x-pack/test_serverless/[api_integration|functional]/test_suites/[observability|search|security]/common_configs`).**
57+
**If you add a new `api_integration` or `functional` `common` sub-directory, remember to add it to the corresponding `common_configs` of all projects (`x-pack/test_serverless/[api_integration|functional]/test_suites/[chat|observability|search|security]/common_configs`).**
5658

5759
In case a common test needs to be skipped for one of the projects
5860
(in both regular pipelines that start KBN in serverless mode [against serverless ES] & pipelines creating serverless projects in MKI [Cloud]),
5961
there are the following suite tags available to do so:
60-
`skipSvlOblt`, `skipSvlSearch`, `skipSvlSec`, which can be added like this to a test suite:
62+
`skipSvlChat`, `skipSvlOblt`, `skipSvlSearch`, `skipSvlSec`, which can be added like this to a test suite:
6163

6264
```
6365
describe('my test suite', function () {
64-
this.tags(['skipSvlOblt', 'skipSvlSearch', 'skipSvlSec']);
66+
this.tags(['skipSvlChat', 'skipSvlOblt', 'skipSvlSearch', 'skipSvlSec']);
6567
// or for a single tag: this.tags('skipSvlSec');
6668
[...]
6769
});
6870
```
6971

7072
Tests that are designed to only run in one of the projects should be added to the project
71-
specific test directory and not to `common` with two skips.
73+
specific test directory and not to `common` with three skips.
7274

73-
Note, that `common` tests are invoked three times in a full test run: once per project to make
75+
Note, that `common` tests are invoked up to four times in a full test run: once per project to make
7476
sure the covered shared functionality works correctly in every project. So when writing tests there, be mindful about the test run time.
7577

7678
See also the README files for [Serverless Common API Integration Tests](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/api_integration/test_suites/common/README.md) and [Serverless Common Functional Tests](https://github.com/elastic/kibana/blob/main/x-pack/test_serverless/functional/test_suites/common/README.md).
@@ -93,6 +95,7 @@ following namespaces:
9395
| observability | svlOblt |
9496
| search | svlSearch |
9597
| security | svlSec |
98+
| chat | svlChat |
9699

97100
### Adding Serverless Tests
98101

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { FtrConfigProviderContext } from '@kbn/test';
9+
10+
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
11+
const baseTestConfig = await readConfigFile(require.resolve('../config.ts'));
12+
13+
return {
14+
...baseTestConfig.getAll(),
15+
testFiles: [
16+
require.resolve('../../common/core'),
17+
require.resolve('../../common/elasticsearch_api'),
18+
],
19+
junit: {
20+
reportName: 'Serverless Chat API Integration Tests - Common Group 1',
21+
},
22+
};
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { createTestConfig } from '../../config.base';
9+
10+
/**
11+
* Make sure to create a MKI deployment with custom Kibana image, that includes feature flags arguments
12+
* These tests most likely will fail on default MKI project
13+
*/
14+
export default createTestConfig({
15+
serverlessProject: 'chat',
16+
junit: {
17+
reportName: 'Serverless Chat Feature Flags API Integration Tests',
18+
},
19+
suiteTags: { exclude: ['skipSvlChat'] },
20+
// add feature flags
21+
kbnServerArgs: [
22+
// e.g. `--xpack.searchIndices.enabled=true`, // global empty state FF
23+
],
24+
// load tests in the index file
25+
testFiles: [require.resolve('./index.feature_flags.ts')],
26+
27+
// include settings from project controller
28+
esServerArgs: [],
29+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { createTestConfig } from '../../config.base';
9+
10+
export default createTestConfig({
11+
serverlessProject: 'chat',
12+
testFiles: [require.resolve('.')],
13+
junit: {
14+
reportName: 'Serverless Chat API Integration Tests',
15+
},
16+
suiteTags: { exclude: ['skipSvlChat'] },
17+
18+
// include settings from project controller
19+
esServerArgs: [],
20+
kbnServerArgs: [],
21+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { FtrProviderContext } from '../../ftr_provider_context';
9+
10+
export default function ({ loadTestFile }: FtrProviderContext) {
11+
describe('Serverless chat API - feature flags', function () {
12+
// loadTestFile(require.resolve('./path/to/tests'));
13+
});
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { FtrProviderContext } from '../../ftr_provider_context';
9+
10+
export default function ({ loadTestFile }: FtrProviderContext) {
11+
describe('Serverless chat API', function () {
12+
this.tags(['esGate']);
13+
14+
loadTestFile(require.resolve('./platform_security'));
15+
});
16+
}

0 commit comments

Comments
 (0)