-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ska][x-pack] relocate api_integration tests [1] #218470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
09644ae
106c7ad
0ab4784
4604668
a183042
552eb84
10451fe
1a81723
2e72adf
0dd914d
22c59c3
cf67400
54ad4ec
4dba3cd
abf766d
b8ca2ae
e9688e8
fc8ad0b
3679590
deb9e43
ea3be01
81899da
f30bada
077e947
6507843
0134a12
7d73bb7
b37f561
1da2ca9
239b5b1
4a547dc
9247b1c
ff299e1
11ab0c6
ed9b6c2
f9f4027
4ef63de
f0629c1
3992bfd
6c37370
1636fff
a0519b1
5fc0593
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * 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 { ScoutTestRunConfigCategory } from '@kbn/scout-info'; | ||
| import { FtrConfigProviderContext } from '@kbn/test'; | ||
| import { services } from './services'; | ||
|
|
||
| export async function getApiIntegrationConfig({ readConfigFile }: FtrConfigProviderContext) { | ||
| const xPackFunctionalTestsConfig = await readConfigFile( | ||
| require.resolve('@kbn/test-suites-xpack/functional/config.base') | ||
| ); | ||
|
|
||
| return { | ||
| services, | ||
| testConfigCategory: ScoutTestRunConfigCategory.API_TEST, | ||
| servers: xPackFunctionalTestsConfig.get('servers'), | ||
| security: xPackFunctionalTestsConfig.get('security'), | ||
| junit: { | ||
| reportName: 'X-Pack API Integration Tests', | ||
| }, | ||
| kbnTestServer: { | ||
| ...xPackFunctionalTestsConfig.get('kbnTestServer'), | ||
| serverArgs: [ | ||
| ...xPackFunctionalTestsConfig.get('kbnTestServer.serverArgs'), | ||
| '--xpack.security.session.idleTimeout=3600000', // 1 hour | ||
| '--telemetry.optIn=true', | ||
| '--xpack.fleet.agents.pollingRequestTimeout=5000', // 5 seconds | ||
| '--xpack.ruleRegistry.write.enabled=true', | ||
| '--xpack.ruleRegistry.write.enabled=true', | ||
| '--xpack.ruleRegistry.write.cache.enabled=false', | ||
| '--monitoring_collection.opentelemetry.metrics.prometheus.enabled=true', | ||
| ], | ||
| }, | ||
| esTestCluster: { | ||
| ...xPackFunctionalTestsConfig.get('esTestCluster'), | ||
| serverArgs: [ | ||
| ...xPackFunctionalTestsConfig.get('esTestCluster.serverArgs'), | ||
| 'node.attr.name=apiIntegrationTestNode', | ||
| `path.repo=/tmp/repo,/tmp/repo_1,/tmp/repo_2,/tmp/cloud-snapshots/`, | ||
| ], | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| export default getApiIntegrationConfig; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* | ||
| * 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 { GenericFtrProviderContext } from '@kbn/test'; | ||
|
|
||
| import { services } from './services'; | ||
|
|
||
| export type FtrProviderContext = GenericFtrProviderContext<typeof services, {}>; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { FtrProviderContext } from '../ftr_provider_context'; | ||
|
|
||
| export function DataViewApiProvider({ getService }: FtrProviderContext) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see this is also defined under
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "DA" services are unique by design, more restricted and generally may not work in non-DA tests:
Your point is valid, but I'm afraid we have to keep "DA" services separately even if it means file/name duplication. We discussed it with @pheyos and conclusion was that SKA test relocation focuses around x-pack tests split and we don't refactor/unify services to not slow process. When tests / services are split, we hopefully can refactor and remove duplicates. But with Scout development being the priority, I'm not sure how much of this work we plan in the near term |
||
| const supertest = getService('supertest'); | ||
|
|
||
| return { | ||
| async create({ id, name, title }: { id: string; name: string; title: string }) { | ||
| const { body } = await supertest | ||
| .post(`/api/content_management/rpc/create`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo') | ||
| .send({ | ||
| contentTypeId: 'index-pattern', | ||
| data: { | ||
| fieldAttrs: '{}', | ||
| title, | ||
| timeFieldName: '@timestamp', | ||
| sourceFilters: '[]', | ||
| fields: '[]', | ||
| fieldFormatMap: '{}', | ||
| typeMeta: '{}', | ||
| runtimeFieldMap: '{}', | ||
| name, | ||
| }, | ||
| options: { id }, | ||
| version: 1, | ||
| }); | ||
| return body; | ||
| }, | ||
|
|
||
| async delete({ id }: { id: string }) { | ||
| const { body } = await supertest | ||
| .post(`/api/content_management/rpc/delete`) | ||
| .set('kbn-xsrf', 'foo') | ||
| .set('x-elastic-internal-origin', 'foo') | ||
| .send({ | ||
| contentTypeId: 'index-pattern', | ||
| id, | ||
| options: { force: true }, | ||
| version: 1, | ||
| }); | ||
| return body; | ||
| }, | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * 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 { format as formatUrl } from 'url'; | ||
| import supertest from 'supertest'; | ||
|
|
||
| import { FtrProviderContext } from '../ftr_provider_context'; | ||
|
|
||
| /** | ||
| * Supertest provider that doesn't include user credentials into base URL that is passed | ||
| * to the supertest. | ||
| */ | ||
| export function EsSupertestWithoutAuthProvider({ getService }: FtrProviderContext) { | ||
| const config = getService('config'); | ||
| const elasticsearchServerConfig = config.get('servers.elasticsearch'); | ||
|
|
||
| return supertest( | ||
| formatUrl({ | ||
| ...elasticsearchServerConfig, | ||
| auth: false, | ||
| }) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should every entry has an associated team? I guess this line can be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is automatically added by CI bot, I will explicitly list the owners for what's inside of it and has no owner yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found entries for:
so I guess it is expected to be added?