Skip to content

Commit

Permalink
Merge branch 'main' into fix/alert_reason_formatting_expandable_flyout
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeOberti authored Aug 25, 2023
2 parents b2eabd5 + 76e3d5c commit 1f2d978
Show file tree
Hide file tree
Showing 257 changed files with 35,072 additions and 34,158 deletions.
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ enabled:
- x-pack/performance/journeys/ecommerce_dashboard_saved_search_only.ts
- x-pack/performance/journeys/ecommerce_dashboard_tsvb_gauge_only.ts
- x-pack/performance/journeys/dashboard_listing_page.ts
- x-pack/performance/journeys/tags_listing_page.ts
- x-pack/performance/journeys/cloud_security_dashboard.ts
- x-pack/performance/journeys/apm_service_inventory.ts
- x-pack/test/custom_branding/config.ts
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipelines/on_merge_unsupported_ftrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ steps:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
parallelism: 6
parallelism: 14
retry:
automatic:
- exit_status: '*'
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/pipelines/pull_request/defend_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ steps:
- command: .buildkite/scripts/steps/functional/defend_workflows_vagrant.sh
label: 'Defend Workflows Endpoint Cypress Tests'
agents:
queue: n2-16-virt
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 120
parallelism: 6
parallelism: 5
retry:
automatic:
- exit_status: '*'
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/pipelines/pull_request/osquery_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ steps:
depends_on: build
timeout_in_minutes: 50
soft_fail: true
retry:
automatic: false
artifact_paths:
- "target/kibana-osquery/**/*"

Expand Down
4 changes: 3 additions & 1 deletion .buildkite/pipelines/pull_request/security_solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ steps:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 60
parallelism: 2
parallelism: 4
retry:
automatic:
- exit_status: '*'
Expand Down Expand Up @@ -48,6 +48,8 @@ steps:
depends_on: build
timeout_in_minutes: 120
parallelism: 1
retry:
automatic: false
soft_fail: true
artifact_paths:
- "target/kibana-security-solution/**/*"
4 changes: 2 additions & 2 deletions .buildkite/pipelines/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ steps:
- "target/kibana-security-serverless/**/*"

- command: .buildkite/scripts/steps/functional/security_serverless_explore.sh
label: 'Explore - Security Solution Cypress Tests'
label: 'Serverless Explore - Security Solution Cypress Tests'
agents:
queue: n2-4-spot
depends_on: build
Expand All @@ -89,7 +89,7 @@ steps:
- "target/kibana-security-serverless/**/*"

- command: .buildkite/scripts/steps/functional/security_serverless_investigations.sh
label: 'Investigations - Security Solution Cypress Tests'
label: 'Serverless Investigations - Security Solution Cypress Tests'
agents:
queue: n2-4-spot
depends_on: build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ describe('resolveInstanceUuid', () => {
});
});

describe('when file exists but is empty', () => {
it('throws an explicit error for uuid formatting', async () => {
mockReadFile({ uuid: '' });
await expect(
resolveInstanceUuid({ pathConfig, serverConfig, logger })
).rejects.toThrowErrorMatchingInlineSnapshot(`"data-folder/uuid contains an invalid UUID"`);
});
});

describe('when file contains a trailing new line', () => {
it('returns the trimmed file uuid', async () => {
mockReadFile({ uuid: DEFAULT_FILE_UUID + '\n' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ export async function resolveInstanceUuid({

async function readUuidFromFile(filepath: string, logger: Logger): Promise<string | undefined> {
const content = await readFileContent(filepath);
if (content === undefined) {
return undefined;
}

if (content === UUID_7_6_0_BUG) {
logger.debug(`UUID from 7.6.0 bug detected, ignoring file UUID`);
return undefined;
}

if (content && !content.match(uuidRegexp)) {
if (!content.match(uuidRegexp)) {
throw new Error(`${filepath} contains an invalid UUID`);
}

Expand Down
14 changes: 14 additions & 0 deletions packages/kbn-journeys/services/page/kibana_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,18 @@ export class KibanaPage {
checkAttribute: 'data-ech-render-complete',
});
}

async clearInput(locator: string) {
const textArea = this.page.locator(locator);
await textArea.clear();
}

async clickAndWaitFor(
locator: string,
state?: 'attached' | 'detached' | 'visible' | 'hidden' | undefined
) {
const element = this.page.locator(locator);
await element.click();
await element.waitFor({ state });
}
}
8 changes: 4 additions & 4 deletions packages/kbn-search-api-panels/components/code_box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface CodeBoxProps {
pluginId: string;
application?: ApplicationStart;
sharePlugin: SharePluginStart;
showTryInConsole: boolean;
consoleRequest?: string;
}

export const CodeBox: React.FC<CodeBoxProps> = ({
Expand All @@ -54,7 +54,7 @@ export const CodeBox: React.FC<CodeBoxProps> = ({
selectedLanguage,
setSelectedLanguage,
sharePlugin,
showTryInConsole,
consoleRequest,
}) => {
const [isPopoverOpen, setIsPopoverOpen] = useState<boolean>(false);

Expand Down Expand Up @@ -115,10 +115,10 @@ export const CodeBox: React.FC<CodeBoxProps> = ({
)}
</EuiCopy>
</EuiFlexItem>
{showTryInConsole && (
{consoleRequest !== undefined && (
<EuiFlexItem grow={false}>
<TryInConsoleButton
request={codeSnippet}
request={consoleRequest}
application={application}
sharePlugin={sharePlugin}
/>
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-search-api-panels/components/ingest_data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface IngestDataProps {
application?: ApplicationStart;
sharePlugin: SharePluginStart;
languages: LanguageDefinition[];
showTryInConsole: boolean;
consoleRequest?: string;
}

export const IngestData: React.FC<IngestDataProps> = ({
Expand All @@ -41,7 +41,7 @@ export const IngestData: React.FC<IngestDataProps> = ({
application,
sharePlugin,
languages,
showTryInConsole,
consoleRequest,
}) => {
const [selectedIngestMethod, setSelectedIngestMethod] = useState<
'ingestViaApi' | 'ingestViaIntegration'
Expand All @@ -55,7 +55,7 @@ export const IngestData: React.FC<IngestDataProps> = ({
leftPanelContent={
selectedIngestMethod === 'ingestViaApi' ? (
<CodeBox
showTryInConsole={showTryInConsole}
consoleRequest={consoleRequest}
codeSnippet={codeSnippet}
languages={languages}
selectedLanguage={selectedLanguage}
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-search-api-panels/components/install_client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { GithubLink } from './github_link';

interface InstallClientProps {
codeSnippet: string;
showTryInConsole: boolean;
consoleRequest?: string;
language: LanguageDefinition;
setSelectedLanguage: (language: LanguageDefinition) => void;
http: HttpStart;
Expand Down Expand Up @@ -52,7 +52,7 @@ const Link: React.FC<{ language: LanguageDefinition; http: HttpStart; pluginId:

export const InstallClientPanel: React.FC<InstallClientProps> = ({
codeSnippet,
showTryInConsole,
consoleRequest,
language,
languages,
setSelectedLanguage,
Expand All @@ -66,7 +66,7 @@ export const InstallClientPanel: React.FC<InstallClientProps> = ({
const panelContent = (
<>
<CodeBox
showTryInConsole={showTryInConsole}
consoleRequest={consoleRequest}
codeSnippet={codeSnippet}
languageType="shell"
languages={languages}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +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.
* 2.0 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 or the Server
* Side Public License, v 1.
*/

import { LanguageDefinition } from '@kbn/search-api-panels';
import { LanguageDefinition } from '../types';

export const consoleDefinition: Partial<LanguageDefinition> = {
buildSearchQuery: `POST /books/_search?pretty
Expand Down
6 changes: 6 additions & 0 deletions packages/kbn-search-api-panels/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { LanguageDefinition, LanguageDefinitionSnippetArguments } from './types';
import { consoleDefinition } from './languages/console';

export const getLanguageDefinitionCodeSnippet = (
language: Partial<LanguageDefinition>,
Expand All @@ -24,3 +25,8 @@ export const getLanguageDefinitionCodeSnippet = (
return '';
}
};

export const getConsoleRequest = (code: keyof LanguageDefinition): string | undefined =>
code in consoleDefinition && typeof consoleDefinition[code] === 'string'
? (consoleDefinition[code] as string)
: undefined;
19 changes: 14 additions & 5 deletions src/plugins/data_view_management/server/routes/resolve_index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { schema } from '@kbn/config-schema';
import { IRouter } from '@kbn/core/server';
import { getKbnServerError } from '@kbn/kibana-utils-plugin/server';

export function registerResolveIndexRoute(router: IRouter): void {
router.get(
Expand All @@ -32,11 +33,19 @@ export function registerResolveIndexRoute(router: IRouter): void {
},
async (context, req, res) => {
const esClient = (await context.core).elasticsearch.client;
const body = await esClient.asCurrentUser.indices.resolveIndex({
name: req.params.query,
expand_wildcards: req.query.expand_wildcards || 'open',
});
return res.ok({ body });
try {
const body = await esClient.asCurrentUser.indices.resolveIndex({
name: req.params.query,
expand_wildcards: req.query.expand_wildcards || 'open',
});
return res.ok({ body });
} catch (e) {
if (e?.meta.statusCode === 404) {
return res.notFound({ body: { message: e.meta?.body?.error?.reason } });
} else {
throw getKbnServerError(e);
}
}
}
);
}
1 change: 1 addition & 0 deletions test/api_integration/apis/data_views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export default function ({ loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./deprecations'));
loadTestFile(require.resolve('./has_user_index_pattern'));
loadTestFile(require.resolve('./swap_references'));
loadTestFile(require.resolve('./resolve_index'));
});
}
15 changes: 15 additions & 0 deletions test/api_integration/apis/data_views/resolve_index/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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 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 or the Server
* Side Public License, v 1.
*/

import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ loadTestFile }: FtrProviderContext) {
describe('/internal/index-pattern-management/resolve_index', () => {
loadTestFile(require.resolve('./resolve_index'));
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* 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 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 or the Server
* Side Public License, v 1.
*/

import { FtrProviderContext } from '../../../ftr_provider_context';

// node scripts/functional_tests --config test/api_integration/config.js --grep="Resolve index API"

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

describe('Resolve index API', function () {
it('should return 200 for a search for indices with wildcard', () =>
supertest.get(`/internal/index-pattern-management/resolve_index/test*`).expect(200));

it('should return 404 for an exact match index', () =>
supertest.get(`/internal/index-pattern-management/resolve_index/test`).expect(404));
});
}
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ declare module 'monaco-editor/esm/vs/basic-languages/css/css';
declare module 'monaco-editor/esm/vs/basic-languages/yaml/yaml';

declare module 'find-cypress-specs';
declare module '@cypress/grep/src/plugin';
64 changes: 64 additions & 0 deletions x-pack/performance/journeys/tags_listing_page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* 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 { Journey } from '@kbn/journeys';
import { subj } from '@kbn/test-subj-selector';

const TAG_NAME = 'testing';
const TAG_DESCRIPTION = 'test description';

export const journey = new Journey({
esArchives: ['x-pack/performance/es_archives/sample_data_flights'],
kbnArchives: ['x-pack/performance/kbn_archives/many_tags_and_visualizations'],
})
.step('Go to Tags Page', async ({ page, kbnUrl }) => {
await page.goto(kbnUrl.get(`/app/management/kibana/tags`));
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
})
.step('Delete the first 20 tags', async ({ page }) => {
await page.click(subj('checkboxSelectAll'));
await page.click(subj('actionBar-contextMenuButton'));
await page.click(subj('actionBar-button-delete'));
await page.click(subj('confirmModalConfirmButton'));
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
})
.step(`Search for 'stream' tag`, async ({ page, inputDelays }) => {
await page.type(subj('tagsManagementSearchBar'), 'stream', {
delay: inputDelays.TYPING,
});
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
})
.step('Create a new tag', async ({ page, inputDelays, kibanaPage }) => {
await kibanaPage.clearInput(subj('tagsManagementSearchBar'));
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
await page.click(subj('createTagButton'));
await page.type(subj('createModalField-name'), TAG_NAME, { delay: inputDelays.TYPING });
await kibanaPage.clickAndWaitFor(subj('createModalConfirmButton'), 'detached');
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
// search for newly created tag
await page.type(subj('tagsManagementSearchBar'), TAG_NAME, {
delay: inputDelays.TYPING,
});
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
await page.waitForSelector(subj('tagsTableRowName'), { state: 'visible' });
})
.step('Update tag', async ({ page, inputDelays, kibanaPage }) => {
await page.click(subj('tagsTableAction-edit'));
await page.type(subj('createModalField-description'), TAG_DESCRIPTION, {
delay: inputDelays.TYPING,
});
await kibanaPage.clickAndWaitFor(subj('createModalConfirmButton'), 'detached');
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
})
.step('Delete tag', async ({ page }) => {
const tagRow = page.locator(subj('tagsTableRowName'));
await page.click(subj('euiCollapsedItemActionsButton'));
await page.click(subj('tagsTableAction-delete'));
await page.click(subj('confirmModalConfirmButton'));
await page.waitForSelector(subj('tagsManagementTable table-is-ready'));
await tagRow.waitFor({ state: 'detached' });
});
Loading

0 comments on commit 1f2d978

Please sign in to comment.