Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
09644ae
init package
dmlemeshko Apr 16, 2025
106c7ad
move config, services and apis/features tests
dmlemeshko Apr 16, 2025
0ab4784
[CI] Auto-commit changed files from 'node scripts/lint_packages --fix'
kibanamachine Apr 16, 2025
4604668
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Apr 16, 2025
a183042
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 16, 2025
552eb84
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine Apr 16, 2025
10451fe
update tsconfig
dmlemeshko Apr 17, 2025
1a81723
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 17, 2025
2e72adf
Merge branch 'ska-tests/apis-part-1' of github.com:dmlemeshko/kibana …
dmlemeshko Apr 17, 2025
0dd914d
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 23, 2025
22c59c3
update tsconfig
dmlemeshko Apr 23, 2025
cf67400
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine Apr 23, 2025
54ad4ec
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Apr 23, 2025
4dba3cd
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 23, 2025
abf766d
fix type import
dmlemeshko Apr 23, 2025
b8ca2ae
Merge branch 'ska-tests/apis-part-1' of github.com:dmlemeshko/kibana …
dmlemeshko Apr 23, 2025
e9688e8
remove orginal api/features dir
dmlemeshko Apr 23, 2025
fc8ad0b
move apis/es
dmlemeshko Apr 23, 2025
3679590
move apis/file_upload
dmlemeshko Apr 23, 2025
deb9e43
move apis/grok_debugger, apis/kibana
dmlemeshko Apr 23, 2025
ea3be01
update codeowners
dmlemeshko Apr 23, 2025
81899da
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 23, 2025
f30bada
move apis/stats
dmlemeshko Apr 23, 2025
077e947
move apis/status
dmlemeshko Apr 23, 2025
6507843
Merge branch 'ska-tests/apis-part-1' of github.com:dmlemeshko/kibana …
dmlemeshko Apr 23, 2025
0134a12
move apis/osquery
dmlemeshko Apr 23, 2025
7d73bb7
[CI] Auto-commit changed files from 'node scripts/styled_components_m…
kibanamachine Apr 23, 2025
b37f561
move apis/searchprofiler
dmlemeshko Apr 23, 2025
1da2ca9
move apis/monitoring_collection
dmlemeshko Apr 23, 2025
239b5b1
Merge branch 'ska-tests/apis-part-1' of github.com:dmlemeshko/kibana …
dmlemeshko Apr 23, 2025
4a547dc
add missing config
dmlemeshko Apr 23, 2025
9247b1c
fix config path
dmlemeshko Apr 23, 2025
ff299e1
remove duplicate kbn reference
dmlemeshko Apr 23, 2025
11ab0c6
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 23, 2025
ed9b6c2
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 25, 2025
f9f4027
Revert "move apis/osquery"
dmlemeshko Apr 25, 2025
4ef63de
remove duplicate config
dmlemeshko Apr 25, 2025
f0629c1
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 25, 2025
3992bfd
update codeowners
dmlemeshko Apr 25, 2025
6c37370
Merge branch 'ska-tests/apis-part-1' of github.com:dmlemeshko/kibana …
dmlemeshko Apr 25, 2025
1636fff
remove auto-generated line in codeowners
dmlemeshko Apr 25, 2025
a0519b1
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine Apr 25, 2025
5fc0593
Merge branch 'main' into ska-tests/apis-part-1
dmlemeshko Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .buildkite/ftr_platform_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ disabled:
- src/platform/test/server_integration/config.base.js
- x-pack/test/functional_with_es_ssl/config.base.ts
- x-pack/test/api_integration/config.ts
- x-pack/platform/test/api_integration/config.ts
- x-pack/test/fleet_api_integration/config.base.ts
- x-pack/test/functional_basic/apps/ml/config.base.ts
- x-pack/test/functional_basic/apps/transform/config.base.ts
Expand Down Expand Up @@ -153,26 +154,17 @@ enabled:
- x-pack/test/api_integration/apis/cases/config.ts
- x-pack/test/api_integration/apis/content_management/config.ts
- x-pack/test/api_integration/apis/console/config.ts
- x-pack/test/api_integration/apis/es/config.ts
- x-pack/test/api_integration/apis/features/config.ts
- x-pack/test/api_integration/apis/file_upload/config.ts
- x-pack/test/api_integration/apis/grok_debugger/config.ts
- x-pack/test/api_integration/apis/kibana/config.ts
- x-pack/test/api_integration/apis/lists/config.ts
- x-pack/test/api_integration/apis/logstash/config.ts
- x-pack/test/api_integration/apis/management/config.ts
- x-pack/test/api_integration/apis/management/index_management/disabled_data_enrichers/config.ts
- x-pack/test/api_integration/apis/maps/config.ts
- x-pack/test/api_integration/apis/ml/config.ts
- x-pack/test/api_integration/apis/monitoring/config.ts
- x-pack/test/api_integration/apis/monitoring_collection/config.ts
- x-pack/test/api_integration/apis/search/config.ts
- x-pack/test/api_integration/apis/searchprofiler/config.ts
- x-pack/test/api_integration/apis/search_playground/config.ts
- x-pack/test/api_integration/apis/security/config.ts
- x-pack/test/api_integration/apis/spaces/config.ts
- x-pack/test/api_integration/apis/stats/config.ts
- x-pack/test/api_integration/apis/status/config.ts
- x-pack/test/api_integration/apis/telemetry/config.ts
- x-pack/test/api_integration/apis/transform/config.ts
- x-pack/test/api_integration/apis/upgrade_assistant/config.ts
Expand Down Expand Up @@ -385,3 +377,13 @@ enabled:
- x-pack/test/api_integration/deployment_agnostic/configs/stateful/platform.stateful.config.ts
- x-pack/test/api_integration/apis/cloud/config.ts
- x-pack/test/api_integration/apis/cloud/saml.config.ts
# configs migrated to the new Kibana architecture
- x-pack/platform/test/api_integration/apis/features/config.ts
- x-pack/platform/test/api_integration/apis/es/config.ts
- x-pack/platform/test/api_integration/apis/grok_debugger/config.ts
- x-pack/platform/test/api_integration/apis/file_upload/config.ts
- x-pack/platform/test/api_integration/apis/kibana/config.ts
- x-pack/platform/test/api_integration/apis/monitoring_collection/config.ts
- x-pack/platform/test/api_integration/apis/searchprofiler/config.ts
- x-pack/platform/test/api_integration/apis/stats/config.ts
- x-pack/platform/test/api_integration/apis/status/config.ts
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ module.exports = {
'x-pack/test/apm_api_integration/**/*.ts',
'x-pack/test/functional/apps/**/*.js',
'x-pack/solutions/observability/plugins/apm/**/*.js',
'x-pack/platform/test/*/{tests,test_suites,apis,apps,deployment_agnostic}/**/*',
'x-pack/platform/test/*/*config.*ts',
'x-pack/test/*/{tests,test_suites,apis,apps,deployment_agnostic}/**/*',
'x-pack/test/*/*config.*ts',
'x-pack/test/saved_object_api_integration/*/apis/**/*',
Expand Down
28 changes: 16 additions & 12 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ x-pack/platform/plugins/shared/streams_app @elastic/streams-program-team
x-pack/platform/plugins/shared/task_manager @elastic/response-ops
x-pack/platform/plugins/shared/timelines @elastic/security-threat-hunting-investigations
x-pack/platform/plugins/shared/triggers_actions_ui @elastic/response-ops
x-pack/platform/test
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found entries for:

x-pack/test
x-pack/test_serverless

so I guess it is expected to be added?

x-pack/solutions/chat/packages/wc-framework-types-browser @elastic/search-kibana
x-pack/solutions/chat/packages/wc-framework-types-common @elastic/search-kibana
x-pack/solutions/chat/packages/wc-framework-types-server @elastic/search-kibana
Expand Down Expand Up @@ -1136,7 +1137,7 @@ x-pack/test_serverless/api_integration/test_suites/common/platform_security @ela
/src/platform/test/functional/firefox/discover.config.ts @elastic/kibana-data-discovery
/src/platform/test/functional/fixtures/es_archiver/discover @elastic/kibana-data-discovery
/src/platform/test/api_integration/apis/saved_queries @elastic/kibana-data-discovery
/x-pack/test/api_integration/apis/kibana/kql_telemetry @elastic/kibana-data-discovery @elastic/kibana-visualizations
/x-pack/platform/test/api_integration/apis/kibana/kql_telemetry @elastic/kibana-data-discovery @elastic/kibana-visualizations
/x-pack/test_serverless/functional/es_archives/pre_calculated_histogram @elastic/kibana-data-discovery
/x-pack/test_serverless/functional/es_archives/kibana_sample_data_flights_index_pattern @elastic/kibana-data-discovery
/x-pack/test_serverless/functional/test_suites/security/config.examples.ts @elastic/kibana-data-discovery
Expand Down Expand Up @@ -1427,7 +1428,7 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/
/x-pack/test/functional/services/monitoring @elastic/stack-monitoring
/x-pack/test/functional/apps/monitoring @elastic/stack-monitoring
/x-pack/test/api_integration/apis/monitoring @elastic/stack-monitoring
/x-pack/test/api_integration/apis/monitoring_collection @elastic/stack-monitoring
/x-pack/platform/test/api_integration/apis/monitoring_collection @elastic/stack-monitoring
/x-pack/test/accessibility/apps/group1/kibana_overview.ts @elastic/stack-monitoring
/x-pack/test/accessibility/apps/group3/stack_monitoring.ts @elastic/stack-monitoring

Expand Down Expand Up @@ -1579,7 +1580,7 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/
# Machine Learning
/x-pack/test/stack_functional_integration/apps/ml @elastic/ml-ui
/x-pack/test/functional/fixtures/kbn_archiver/ml @elastic/ml-ui
/x-pack/test/api_integration/apis/file_upload @elastic/ml-ui
/x-pack/platform/test/api_integration/apis/file_upload @elastic/ml-ui
/x-pack/test/accessibility/apps/group2/ml.ts @elastic/ml-ui
/x-pack/test/accessibility/apps/group2/ml_* @elastic/ml-ui
/x-pack/test/accessibility/apps/group3/ml_embeddables_in_dashboard.ts @elastic/ml-ui
Expand Down Expand Up @@ -1710,7 +1711,10 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/
/x-pack/test/api_integration/services/index.ts @elastic/appex-qa
/x-pack/test/api_integration/services/es_supertest_without_auth.js @elastic/appex-qa
/x-pack/test/api_integration/config.ts @elastic/appex-qa
/x-pack/test/api_integration/apis/kibana/config.ts @elastic/appex-qa
/x-pack/platform/test/api_integration/config.ts @elastic/appex-qa
/x-pack/platform/test/api_integration/ftr_provider_context.d.ts @elastic/appex-qa
/x-pack/platform/test/api_integration/services @elastic/appex-qa
/x-pack/platform/test/api_integration/apis/kibana/config.ts @elastic/appex-qa
/x-pack/test/tsconfig.json @elastic/appex-qa
/x-pack/test/load @elastic/appex-qa
/src/platform/test/tsconfig.json @elastic/appex-qa
Expand Down Expand Up @@ -1824,7 +1828,7 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/
/x-pack/test/functional/page_objects/banners_page.ts @elastic/kibana-core
/x-pack/test/common/lib/test_data_loader.ts @elastic/kibana-core
/x-pack/test/api_integration/services/usage_api.ts @elastic/kibana-core
/x-pack/test/api_integration/apis/kibana @elastic/kibana-core
/x-pack/platform/test/api_integration/apis/kibana @elastic/kibana-core
/src/platform/test/api_integration/fixtures/import.ndjson @elastic/kibana-core
/x-pack/test/plugin_api_integration @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/pull/146704
/x-pack/test/localization/ @elastic/kibana-core # Assigned per https://github.com/elastic/kibana/pull/146704
Expand Down Expand Up @@ -1882,9 +1886,9 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/
/x-pack/test/licensing_plugin @elastic/kibana-core
/x-pack/test/functional_execution_context @elastic/kibana-core
/x-pack/test/api_integration/apis/telemetry @elastic/kibana-core
/x-pack/test/api_integration/apis/status @elastic/kibana-core
/x-pack/test/api_integration/apis/stats @elastic/kibana-core
/x-pack/test/api_integration/apis/kibana/stats @elastic/kibana-core
/x-pack/platform/test/api_integration/apis/status @elastic/kibana-core
/x-pack/platform/test/api_integration/apis/stats @elastic/kibana-core
/x-pack/platform/test/api_integration/apis/kibana/stats @elastic/kibana-core
/x-pack/test/api_integration/deployment_agnostic/apis/core/ @elastic/kibana-core
/x-pack/test/api_integration/deployment_agnostic/apis/saved_objects_management/ @elastic/kibana-core
/x-pack/test_serverless/functional/test_suites/security/config.saved_objects_management.ts @elastic/kibana-core
Expand Down Expand Up @@ -1920,8 +1924,8 @@ src/platform/plugins/shared/discover/public/context_awareness/profile_providers/

# AppEx Platform Services Security
/x-pack/test_serverless/api_integration/test_suites/common/security_response_headers.ts @elastic/kibana-security
/x-pack/test/api_integration/apis/es @elastic/kibana-security
/x-pack/test/api_integration/apis/features @elastic/kibana-security
/x-pack/platform/test/api_integration/apis/es @elastic/kibana-security
/x-pack/platform/test/api_integration/apis/features @elastic/kibana-security

# Kibana Telemetry
/.telemetryrc.json @elastic/kibana-core
Expand Down Expand Up @@ -2167,7 +2171,7 @@ x-pack/test/api_integration/apis/management/index_management/inference_endpoints
/x-pack/test/functional/apps/watcher @elastic/kibana-management
/x-pack/test/api_integration/apis/watcher @elastic/kibana-management
/x-pack/test/api_integration/apis/upgrade_assistant @elastic/kibana-core
/x-pack/test/api_integration/apis/searchprofiler @elastic/kibana-management
/x-pack/platform/test/api_integration/apis/searchprofiler @elastic/kibana-management
/x-pack/test/api_integration/apis/console @elastic/kibana-management
/x-pack/test_serverless/**/test_suites/common/index_management/ @elastic/kibana-management
/x-pack/test_serverless/**/test_suites/common/management/index_management/ @elastic/kibana-management
Expand All @@ -2185,7 +2189,7 @@ x-pack/test/api_integration/apis/management/index_management/inference_endpoints
/x-pack/test/api_integration/deployment_agnostic/apis/management/ @elastic/kibana-management
/x-pack/test/api_integration/deployment_agnostic/apis/painless_lab/ @elastic/kibana-management
/x-pack/test/functional/apps/rollup_job/ @elastic/kibana-management
/x-pack/test/api_integration/apis/grok_debugger @elastic/kibana-management
/x-pack/platform/test/api_integration/apis/grok_debugger @elastic/kibana-management
/x-pack/test/accessibility/apps/group1/advanced_settings.ts @elastic/kibana-management
/x-pack/test/accessibility/apps/**/grok_debugger.ts @elastic/kibana-management
/x-pack/test/accessibility/apps/group1/helpers.ts @elastic/kibana-management
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,7 @@
"@kbn/test-suites-src": "link:src/platform/test",
"@kbn/test-suites-xpack": "link:x-pack/test",
"@kbn/test-suites-xpack-performance": "link:x-pack/performance",
"@kbn/test-suites-xpack-platform": "link:x-pack/platform/test",
"@kbn/tooling-log": "link:src/platform/packages/shared/kbn-tooling-log",
"@kbn/ts-projects": "link:packages/kbn-ts-projects",
"@kbn/ts-type-check-cli": "link:packages/kbn-ts-type-check-cli",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1974,6 +1974,8 @@
"@kbn/test-suites-xpack/*": ["x-pack/test/*"],
"@kbn/test-suites-xpack-performance": ["x-pack/performance"],
"@kbn/test-suites-xpack-performance/*": ["x-pack/performance/*"],
"@kbn/test-suites-xpack-platform": ["x-pack/platform/test"],
"@kbn/test-suites-xpack-platform/*": ["x-pack/platform/test/*"],
"@kbn/testing-embedded-lens-plugin": ["x-pack/examples/testing_embedded_lens"],
"@kbn/testing-embedded-lens-plugin/*": ["x-pack/examples/testing_embedded_lens/*"],
"@kbn/third-party-lens-navigation-prompt-plugin": ["x-pack/examples/third_party_lens_navigation_prompt"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* 2.0.
*/

export default function ({ loadTestFile }) {
import type { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('kibana', () => {
loadTestFile(require.resolve('./stats'));
loadTestFile(require.resolve('./kql_telemetry'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
* 2.0.
*/

export default function ({ loadTestFile }) {
import type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('KQL', () => {
loadTestFile(require.resolve('./kql_telemetry'));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import expect from '@kbn/expect';
import { KQL_TELEMETRY_ROUTE_LATEST_VERSION } from '@kbn/data-plugin/common';
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertestNoAuth = getService('supertestWithoutAuth');
const supertest = getService('supertest');

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

export default function ({ loadTestFile }) {
import type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('stats', () => {
loadTestFile(require.resolve('./stats'));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
*/

import expect from '@kbn/expect';
import type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService }) {
export default function ({ getService }: FtrProviderContext) {
const supertestNoAuth = getService('supertestWithoutAuth');
const supertest = getService('supertest');
const config = getService('config');

describe('/api/stats', () => {
describe('operational stats and usage stats', () => {
// lazy check for uuid for test runs against preexisting services
function isUUID(uuid) {
function isUUID(uuid: string) {
return typeof uuid === 'string' && uuid.length === 36;
}

Expand Down
49 changes: 49 additions & 0 deletions x-pack/platform/test/api_integration/config.ts
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;
12 changes: 12 additions & 0 deletions x-pack/platform/test/api_integration/ftr_provider_context.d.ts
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, {}>;
52 changes: 52 additions & 0 deletions x-pack/platform/test/api_integration/services/data_view_api.ts
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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is also defined under x-pack/test/api_integration/deployment_agnostic/services/data_view_api.ts.
I assume the goal is to relocate the whole deployment_agnostic folder as well (in follow up tasks?) and remove duplicates

Copy link
Copy Markdown
Contributor Author

@dmlemeshko dmlemeshko Apr 24, 2025

Choose a reason for hiding this comment

The 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:

  • SAML authentication only, but FtrProviderContext used by default in api tests allows both basic and saml.
  • system indexes / operator user is not available, but FtrProviderContext exposes supertest service authenticated with highest privileges.

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,
})
);
}
Loading