Skip to content

Conversation

@csr
Copy link
Contributor

@csr csr commented Nov 26, 2025

This PR migrates FTR tests belonging to the x-pack/platform/test/saved_object_api_integration/spaces_only/config.ts FTR test config to Scout. The "Spaces Only" test suite validates Saved Objects API behavior in a multi-space Kibana environment.

This suite focuses purely on space isolation and namespace behavior, testing how objects are created, retrieved, updated, and deleted across different Kibana spaces.

Important

Deprecated Saved API operations: most Saved Object API operations are deprecated so they aren't used in the new Scout tests, except for the bulk delete operation. The import and export APIs aren't deprecated so these tests focus especially on those.

@csr csr self-assigned this Nov 26, 2025
@csr csr added the test:scout label Nov 26, 2025
fleet: FleetApiService;
streams: StreamsApiService;
core: CoreApiService;
savedObjects: SavedObjectsApiService;
Copy link
Contributor Author

@csr csr Nov 28, 2025

Choose a reason for hiding this comment

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

This PR introduces a new savedObjects API helper that can be used within Scout tests to perform common Saved Object operations.

While API helpers are fine for setup and teardown operations, in the test body we should use the apiClient fixture to send API requests scoped to the role/privileges of our choice (in this case, the savedObjectsManagement privilege).

}
);
},
delete: async (type, id, spaceId, force) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm aware that many of these Saved Object operations are deprecated, except for import/export APIs (and a few others). I have however decided to add most operations to the interface for convenience, as I don't believe there are any plans to remove these anytime soon.

* Note: since version 8.0, Kibana requires most saved objects to have globally unique IDs
* Learn more: https://www.elastic.co/docs/explore-analyze/find-and-organize/saved-objects
*/
TEST_SPACES.forEach((space) => {
Copy link
Contributor Author

@csr csr Dec 1, 2025

Choose a reason for hiding this comment

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

As the comment says, this test suite validates api/saved_objects/_import behavior when operating within a single space at a time to ensure consistent behavior regardless of the space we're in. Each test suite creates just one space.

import { ATTRIBUTE_TITLE_KEY, ATTRIBUTE_TITLE_VALUE, COMMON_HEADERS, SPACES } from './constants';
import { prepareImportFormData } from './helpers';

apiTest.describe(`_import API with multiple spaces`, { tag: tags.ESS_ONLY }, () => {
Copy link
Contributor Author

@csr csr Dec 1, 2025

Choose a reason for hiding this comment

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

As the comment above says, this test suite creates multiple spaces at the same time to test the Saved Object APIs across multiple spaces (see test cases for details).

{
base: [],
feature: {
savedObjectsManagement: ['all'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In both test suites we're creating an API key with the minimum privilege necessary to call the Saved Objects API: savedObjectsManagement: ['all'].

@csr csr added release_note:skip Skip the PR/issue when compiling release notes backport:all-open Backport to all branches that could still receive a release labels Dec 1, 2025
@csr csr changed the title Migrate Spaces-only API tests to Scout [Scout] Add tests using Saved Objects API in different spaces Dec 1, 2025
@csr csr marked this pull request as ready for review December 1, 2025 08:43
@csr csr requested review from a team as code owners December 1, 2025 08:43
@csr csr changed the title [Scout] Add tests using Saved Objects API in different spaces [Scout] Add tests around using Saved Objects API in different spaces Dec 1, 2025
@csr csr changed the title [Scout] Add tests around using Saved Objects API in different spaces [Spaces] Add Scout tests around using Saved Objects API in different spaces Dec 1, 2025
@SiddharthMantri SiddharthMantri self-requested a review December 1, 2025 13:25
Comment on lines 23 to 24
export interface SavedObjectsApiService {
// Note: the create and bulk create operations are deprecated in favor of the import API so they weren't added to the API helper
Copy link
Member

Choose a reason for hiding this comment

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

@elastic/kibana-security we would appreciate if you can verify helpers implementation to make sure we didn't do anything wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Following up here to say I was able to leverage the kbnClient.savedObects helper just fine, and I have removed the Saved Objects API service that the PR introduced.

@elasticmachine
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:all-open Backport to all branches that could still receive a release release_note:skip Skip the PR/issue when compiling release notes test:scout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants