Skip to content
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,7 @@ x-pack/platform/plugins/shared/ml/server/models/data_recognizer/modules/security
/src/platform/test/functional/services/field_editor.ts @elastic/kibana-data-discovery
/src/platform/test/functional/services/embedding.ts @elastic/appex-qa
/src/platform/test/functional/services/data_grid.ts @elastic/kibana-data-discovery
/src/platform/test/functional/services/search_sessions.ts @elastic/kibana-data-discovery
/src/platform/test/functional/services/combo_box.ts @elastic/appex-qa
/src/platform/test/functional/services/synthtrace/sythtrace.ts @elastic/appex-qa
/src/platform/test/functional/page_objects/time_picker.ts @elastic/appex-qa
Expand Down Expand Up @@ -2308,7 +2309,6 @@ x-pack/platform/plugins/private/cloud_integrations/cloud_full_story/server/confi
/src/platform/test/functional/fixtures/kbn_archiver/annotation_listing_page_search.json @elastic/search-kibana
/src/platform/test/functional/fixtures/es_archiver/search/downsampled @elastic/search-kibana
/x-pack/solutions/search/functional_solution_sidenav/ @elastic/search-kibana
/x-pack/platform/test/functional/services/search_sessions.ts @elastic/search-kibana
/x-pack/platform/test/functional/page_objects/search_sessions_management_page.ts @elastic/search-kibana
x-pack/platform/test/functional/page_objects/search_profiler_page.ts @elastic/search-kibana
/x-pack/solutions/search/test/functional/apps/search_playground @elastic/search-kibana
Expand Down
5 changes: 0 additions & 5 deletions config/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ xpack.features.overrides:
subFeatures.privileges:
download_csv_report.disabled: true
generate_report.disabled: true
store_search_session.disabled: true
url_create:
disabled: true
includeIn: "read"
Expand All @@ -63,7 +62,6 @@ xpack.features.overrides:
subFeatures.privileges:
download_csv_report.disabled: true
generate_report.disabled: true
store_search_session.disabled: true
url_create:
disabled: true
includeIn: "read"
Expand All @@ -72,7 +70,6 @@ xpack.features.overrides:
### Reporting feature and short URL sub-feature privilege should be granted for both `All` and `Read`.
subFeatures.privileges:
generate_report.disabled: true
store_search_session.disabled: true
url_create:
disabled: true
includeIn: "read"
Expand All @@ -81,7 +78,6 @@ xpack.features.overrides:
### Reporting feature and short URL sub-feature privilege should be granted for both `All` and `Read`.
subFeatures.privileges:
generate_report.disabled: true
store_search_session.disabled: true
url_create:
disabled: true
includeIn: "read"
Expand Down Expand Up @@ -171,7 +167,6 @@ xpack.cloud_integrations.data_migration.enabled: false
# Other disabled plugins
xpack.canvas.enabled: false
xpack.reindex_service.enabled: false
data.search.sessions.enabled: false
advanced_settings.globalSettingsEnabled: false

# Disable the browser-side functionality that depends on SecurityCheckupGetStateRoutes
Expand Down
2 changes: 1 addition & 1 deletion src/platform/plugins/shared/data/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const searchSessionsConfigSchema = schema.object({
/**
* Turns the feature on \ off (incl. removing indicator and management screens)
*/
enabled: schema.boolean({ defaultValue: false }),
enabled: schema.boolean({ defaultValue: true }),

/**
* notTouchedTimeout controls how long user can save a session after all searches completed.
Expand Down
2 changes: 2 additions & 0 deletions src/platform/test/functional/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import { DashboardSettingsProvider } from './dashboard/dashboard_settings';
import { ESQLService } from './esql';
import { DataViewsService } from './data_views';
import { SynthtraceClientProvider } from './synthtrace/sythtrace';
import { SearchSessionsService } from './search_sessions';

export const services = {
...commonFunctionalServices,
Expand Down Expand Up @@ -98,4 +99,5 @@ export const services = {
savedObjectsFinder: SavedObjectsFinderService,
esql: ESQLService,
synthtrace: SynthtraceClientProvider,
searchSessions: SearchSessionsService,
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/*
* 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.
* 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 { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { INITIAL_SEARCH_SESSION_REST_VERSION } from '@kbn/data-plugin/server';
import expect from '@kbn/expect';
import type { WebElementWrapper } from '@kbn/ftr-common-functional-ui-services';
import type { SavedObjectsFindResponse } from '@kbn/core/server';
import { FtrService } from '@kbn/test-suites-src/functional/ftr_provider_context';
import { FtrService } from '../ftr_provider_context';
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've moved this from the x-pack functional services folder to the base functional services so I can reuse it in the serverless tests - happy to do it in some other way if this is not ideal


const BACKGROUND_SEARCH_FLYOUT_ENTRYPOINT = 'openBackgroundSearchFlyoutButton';
const BACKGROUND_SEARCH_SUBMIT_BUTTON = 'querySubmitButton-secondary-button';
Expand All @@ -32,6 +34,10 @@ export class SearchSessionsService extends FtrService {
return this.testSubjects.exists(BACKGROUND_SEARCH_FLYOUT_ENTRYPOINT);
}

public async sendToBackgroundButtonExists(): Promise<boolean> {
return this.testSubjects.exists(BACKGROUND_SEARCH_SUBMIT_BUTTON);
}

public async missingOrFail(): Promise<void> {
return this.testSubjects.missingOrFail(BACKGROUND_SEARCH_FLYOUT_ENTRYPOINT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
'filesManagement',
'objects',
'tags',
'search_sessions',
'spaces',
'settings',
]);
Expand Down
2 changes: 0 additions & 2 deletions x-pack/platform/test/functional/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { PipelineListProvider } from './pipeline_list';
import { RandomProvider } from './random';
import { RulesServiceProvider } from './rules';
import { SampleDataServiceProvider } from './sample_data';
import { SearchSessionsService } from './search_sessions';
import { TransformProvider } from './transform';
import { UserMenuProvider } from './user_menu';

Expand Down Expand Up @@ -78,7 +77,6 @@ export const services = {
rules: RulesServiceProvider,
sampleData: SampleDataServiceProvider,
grokDebugger: GrokDebuggerProvider,
searchSessions: SearchSessionsService,
ml: MachineLearningProvider,
transform: TransformProvider,
reporting: ReportingFunctionalProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,22 +993,34 @@ export default function ({ getService }: FtrProviderContext) {
});

describe('available features', function () {
it('all Dashboard and Discover sub-feature privileges are disabled', async function () {
it('all Dashboard sub-features privileges are disabled', async function () {
const { body } = await supertestAdminWithCookieCredentials.get('/api/features').expect(200);

// We should make sure that neither Discover nor Dashboard displays any sub-feature privileges in Serverless.
// We should make sure that Dashboard displays any sub-feature privileges in Serverless.
// If any of these features adds a new sub-feature privilege we should make an explicit decision whether it
// should be displayed in Serverless.
const features = body as KibanaFeatureConfig[];
for (const featureId of ['discover_v2', 'dashboard_v2']) {
const feature = features.find((f) => f.id === featureId)!;
const subFeaturesPrivileges = collectSubFeaturesPrivileges(feature);
for (const privilege of subFeaturesPrivileges.values()) {
log.debug(
`Verifying that ${privilege.id} sub-feature privilege of ${featureId} feature is disabled.`
);
expect(privilege.disabled).toBe(true);
}
const feature = features.find((f) => f.id === 'dashboard_v2')!;
const subFeaturesPrivileges = collectSubFeaturesPrivileges(feature);
for (const privilege of subFeaturesPrivileges.values()) {
log.debug(
`Verifying that ${privilege.id} sub-feature privilege of dashboard_v2 feature is disabled.`
);
if (privilege.id === 'store_search_session') continue;
expect(privilege.disabled).toBe(true);
}
});

it('all Discover sub-features except store search session privilege are disabled', async function () {
const { body } = await supertestAdminWithCookieCredentials.get('/api/features').expect(200);

const features = body as KibanaFeatureConfig[];
const feature = features.find((f) => f.id === 'discover_v2')!;
const subFeaturesPrivileges = collectSubFeaturesPrivileges(feature);

for (const privilege of subFeaturesPrivileges.values()) {
if (privilege.id === 'store_search_session') expect(privilege.disabled).not.toBe(true);
else expect(privilege.disabled).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an explicit decision we made to show this privilege? It probably makes sense, just wanted to make sure.

}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {

return {
...baseTestConfig.getAll(),
testFiles: [require.resolve('../../test_suites/discover/group6')],
testFiles: [
require.resolve('../../test_suites/discover/group6'),
require.resolve('../../test_suites/discover/background_search'),
],
junit: {
reportName: 'Serverless Observability Functional Tests - Common Group 12',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
...baseTestConfig.getAll(),
testFiles: [
require.resolve('../../test_suites/discover/group6'), // 13 min
require.resolve('../../test_suites/discover/background_search'),
],
junit: {
reportName: 'Serverless Search Functional Tests - Common Group 12',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {

return {
...baseTestConfig.getAll(),
testFiles: [require.resolve('../../test_suites/discover/group6')],
testFiles: [
require.resolve('../../test_suites/discover/group6'),
require.resolve('../../test_suites/discover/background_search'),
],
junit: {
reportName: 'Serverless Security Functional Tests - Common Group 12',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ export const services = {
usageCollection: functionalPlatformServices.usageCollection,
userMenu: functionalPlatformServices.userMenu,
vegaDebugInspector: functionalPlatformServices.vegaDebugInspector,
searchSessions: functionalPlatformServices.searchSessions,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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 type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const searchSessions = getService('searchSessions');

const { common, unifiedFieldList, svlCommonPage } = getPageObjects([
'common',
'unifiedFieldList',
'svlCommonPage',
]);

describe('Discover background search', function () {
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 can't do a real test of storing/recovering a background search because delay can't be used in ESQL in this tests and stall_time_seconds can be used in classic either so i'm just adding some basic tests to ensure that the feature is present

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, makes sense... this is a real bummer, maybe we can bring this up to the team and see if there are any options here.

Copy link
Member

Choose a reason for hiding this comment

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

To quickly follow up, we might get support from ES side here, so we should be able to treat serverless and stateful the same way

before(async () => {
await kibanaServer.importExport.load(
'src/platform/test/functional/fixtures/kbn_archiver/discover'
);
await svlCommonPage.loginAsAdmin();

await common.navigateToApp('discover');
await unifiedFieldList.waitUntilSidebarHasLoaded();
});

describe('when in discover', () => {
it('renders the save to background button', async () => {
await searchSessions.sendToBackgroundButtonExists();
});
});

describe('when clicking the open background search flyout button', () => {
it('opens the background search flyout', async () => {
await searchSessions.openFlyout();
await searchSessions.expectManagementTable();
});
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* 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 type { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('discover/background_search', function () {
this.tags(['esGate']);

loadTestFile(require.resolve('./_exists'));
});
}