-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[scout] migrate FTR serverless API management tests #262124
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
Merged
dmlemeshko
merged 16 commits into
elastic:main
from
dmlemeshko:scout/migrate-svl-api-management-tests
Apr 15, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
696925f
[scout] migrate serverless/api_integration/test_suites/management
dmlemeshko d42f4ed
refactor spaces api helper
dmlemeshko fad0962
fix test
dmlemeshko b8ce6a8
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko f836d87
fix scenario
dmlemeshko 19547ee
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko 4785268
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko e2cdeb0
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko 67df52d
move rollup_data_views.spec under data_views dir
dmlemeshko 11c4f83
fix import
dmlemeshko 3547e7e
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko 0765e32
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko 4c5cb6e
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko 59f01ab
move tests to dir
dmlemeshko 54c00a3
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko 293e5be
Merge branch 'main' into scout/migrate-svl-api-management-tests
dmlemeshko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...tform/plugins/shared/data_views/test/scout/api/tests/data_views/rollup_data_views.spec.ts
|
Contributor
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. Could we put the new tests in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import { apiTest, tags, type RoleApiCredentials } from '@kbn/scout'; | ||
| import { expect } from '@kbn/scout/api'; | ||
| import { | ||
| ES_ARCHIVE_BASIC_INDEX, | ||
| FIELDS_FOR_WILDCARD_PATH, | ||
| INTERNAL_COMMON_HEADERS, | ||
| } from '../../fixtures/constants'; | ||
|
|
||
| apiTest.describe( | ||
| 'rollup data views - fields for wildcard', | ||
| { | ||
| tag: [ | ||
| ...tags.serverless.observability.complete, | ||
| ...tags.serverless.search, | ||
| ...tags.serverless.security.complete, | ||
| ], | ||
| }, | ||
| () => { | ||
| let adminApiCredentials: RoleApiCredentials; | ||
|
|
||
| apiTest.beforeAll(async ({ requestAuth, esArchiver }) => { | ||
| adminApiCredentials = await requestAuth.getApiKey('admin'); | ||
| await esArchiver.loadIfNeeded(ES_ARCHIVE_BASIC_INDEX); | ||
| }); | ||
|
|
||
| apiTest( | ||
| 'returns 200 and best effort response despite lack of rollup support', | ||
| async ({ apiClient }) => { | ||
| const response = await apiClient.get( | ||
| `${FIELDS_FOR_WILDCARD_PATH}?pattern=basic_index&type=rollup&rollup_index=bar`, | ||
| { | ||
| headers: { | ||
| ...INTERNAL_COMMON_HEADERS, | ||
| ...adminApiCredentials.apiKeyHeader, | ||
| }, | ||
| } | ||
| ); | ||
|
|
||
| expect(response).toHaveStatusCode(200); | ||
| expect(response.body.fields).toHaveLength(5); | ||
| } | ||
| ); | ||
| } | ||
| ); |
71 changes: 71 additions & 0 deletions
71
src/platform/plugins/shared/data_views/test/scout/api/tests/scripted_fields_disabled.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import { apiTest, tags, type RoleApiCredentials } from '@kbn/scout'; | ||
| import { expect } from '@kbn/scout/api'; | ||
| import { | ||
| COMMON_HEADERS, | ||
| DATA_VIEW_PATH, | ||
| ES_ARCHIVE_BASIC_INDEX, | ||
| SERVICE_KEY, | ||
| } from '../fixtures/constants'; | ||
|
|
||
| apiTest.describe( | ||
| 'scripted fields disabled', | ||
| { | ||
| tag: [ | ||
| ...tags.serverless.observability.complete, | ||
| ...tags.serverless.search, | ||
| ...tags.serverless.security.complete, | ||
| ], | ||
| }, | ||
| () => { | ||
| let adminApiCredentials: RoleApiCredentials; | ||
| let createdDataViewId: string | undefined; | ||
|
|
||
| apiTest.beforeAll(async ({ requestAuth, esArchiver, kbnClient }) => { | ||
| adminApiCredentials = await requestAuth.getApiKey('admin'); | ||
| await kbnClient.savedObjects.cleanStandardList(); | ||
| await esArchiver.loadIfNeeded(ES_ARCHIVE_BASIC_INDEX); | ||
| }); | ||
|
|
||
| apiTest.afterEach(async ({ apiServices }) => { | ||
| if (createdDataViewId) { | ||
| await apiServices.dataViews.delete(createdDataViewId); | ||
| createdDataViewId = undefined; | ||
| } | ||
| }); | ||
|
|
||
| apiTest('scripted fields are ignored when disabled', async ({ apiClient }) => { | ||
| const response = await apiClient.post(DATA_VIEW_PATH, { | ||
| headers: { | ||
| ...COMMON_HEADERS, | ||
| ...adminApiCredentials.apiKeyHeader, | ||
| }, | ||
| body: { | ||
| [SERVICE_KEY]: { | ||
| title: 'basic_index', | ||
| fields: { | ||
| foo_scripted: { | ||
| name: 'foo_scripted', | ||
| type: 'string', | ||
| scripted: true, | ||
| script: "doc['field_name'].value", | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| expect(response).toHaveStatusCode(200); | ||
| createdDataViewId = response.body[SERVICE_KEY].id; | ||
|
macroscopeapp[bot] marked this conversation as resolved.
|
||
| expect(response.body[SERVICE_KEY].fields.foo_scripted).toBeUndefined(); | ||
| }); | ||
| } | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
x-pack/platform/plugins/shared/spaces/test/scout/api/tests/active_space.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * 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 { tags } from '@kbn/scout'; | ||
| import { expect } from '@kbn/scout/api'; | ||
|
|
||
| import { COMMON_HEADERS } from '../constants'; | ||
| import { apiTest } from '../fixtures'; | ||
|
|
||
| apiTest.describe( | ||
| 'Get active space', | ||
| { | ||
| tag: tags.deploymentAgnostic, | ||
| }, | ||
| () => { | ||
| let cookieHeader: Record<string, string>; | ||
|
|
||
| apiTest.beforeAll(async ({ apiServices, samlAuth }) => { | ||
| ({ cookieHeader } = await samlAuth.asInteractiveUser('admin')); | ||
| await apiServices.spaces.create({ id: 'foo-space' }); | ||
| }); | ||
|
|
||
| apiTest.afterAll(async ({ apiServices }) => { | ||
| await apiServices.spaces.delete('foo-space'); | ||
| }); | ||
|
|
||
| apiTest('returns the default space', async ({ apiClient }) => { | ||
| const response = await apiClient.get('internal/spaces/_active_space', { | ||
| headers: { ...COMMON_HEADERS, ...cookieHeader }, | ||
| }); | ||
|
|
||
| expect(response).toHaveStatusCode(200); | ||
| const { id, name, _reserved } = response.body; | ||
| expect({ id, name, _reserved }).toStrictEqual({ | ||
| id: 'default', | ||
| name: 'Default', | ||
| _reserved: true, | ||
| }); | ||
| }); | ||
|
|
||
| apiTest('returns the default space when explicitly referenced', async ({ apiClient }) => { | ||
| const response = await apiClient.get('s/default/internal/spaces/_active_space', { | ||
| headers: { ...COMMON_HEADERS, ...cookieHeader }, | ||
| }); | ||
|
|
||
| expect(response).toHaveStatusCode(200); | ||
| const { id, name, _reserved } = response.body; | ||
| expect({ id, name, _reserved }).toStrictEqual({ | ||
| id: 'default', | ||
| name: 'Default', | ||
| _reserved: true, | ||
| }); | ||
| }); | ||
|
|
||
| apiTest('returns the foo space', async ({ apiClient }) => { | ||
| const { body } = await apiClient.get('s/foo-space/internal/spaces/_active_space', { | ||
| headers: { ...COMMON_HEADERS, ...cookieHeader }, | ||
| }); | ||
|
|
||
| expect(body).toMatchObject({ | ||
| id: 'foo-space', | ||
| name: 'foo-space', | ||
| disabledFeatures: [], | ||
| }); | ||
| }); | ||
|
|
||
| apiTest('returns 404 when the space is not found', async ({ apiClient }) => { | ||
| const response = await apiClient.get('s/not-found-space/internal/spaces/_active_space', { | ||
| headers: { ...COMMON_HEADERS, ...cookieHeader }, | ||
| }); | ||
|
|
||
| expect(response).toHaveStatusCode(404); | ||
| expect(response.body).toStrictEqual({ | ||
| statusCode: 404, | ||
| error: 'Not Found', | ||
| message: 'Saved object [space/not-found-space] not found', | ||
| }); | ||
| }); | ||
| } | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
it was used by one of the migrated tests, seems to be reasonable addition