Skip to content

Commit

Permalink
Merge branch 'main' into profiling-embeddables-kql-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Nov 22, 2023
2 parents d68f20e + d5fc9b0 commit 6c1fca6
Show file tree
Hide file tree
Showing 20 changed files with 534 additions and 68 deletions.
1 change: 1 addition & 0 deletions .buildkite/ftr_configs.yml
Expand Up @@ -318,6 +318,7 @@ enabled:
- x-pack/test/functional/apps/transform/feature_controls/config.ts
- x-pack/test/functional/apps/upgrade_assistant/config.ts
- x-pack/test/functional/apps/uptime/config.ts
- x-pack/test/functional/apps/user_profiles/config.ts
- x-pack/test/functional/apps/visualize/config.ts
- x-pack/test/functional/apps/watcher/config.ts
- x-pack/test/functional/config_security_basic.ts
Expand Down
137 changes: 124 additions & 13 deletions .buildkite/pipelines/security_solution/api_integration.yml
@@ -1,7 +1,7 @@
steps:
- label: Running exception_workflows:runner:serverless
- label: Running exception_workflows:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_workflows:qa:serverless
key: exception_workflows:runner:serverless
key: exception_workflows:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
Expand All @@ -10,9 +10,9 @@ steps:
- exit_status: '*'
limit: 2

- label: Running exception_operators_date_numeric_types:runner:serverless
- label: Running exception_operators_date_numeric_types:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_date_numeric_types:qa:serverless
key: exception_operators_date_numeric_types:runner:serverless
key: exception_operators_date_numeric_types:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
Expand All @@ -21,9 +21,20 @@ steps:
- exit_status: '*'
limit: 2

- label: Running exception_operators_keyword_text_long:runner:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_keyword_text_long:qa:serverless
key: exception_operators_keyword_text_long:runner:serverless
- label: Running exception_operators_keyword:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_keyword:qa:serverless
key: exception_operators_keyword:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '*'
limit: 2

- label: Running exception_operators_ips:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_ips:qa:serverless
key: exception_operators_ips:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
Expand All @@ -32,20 +43,32 @@ steps:
- exit_status: '*'
limit: 2

- label: Running exception_operators_ips_text_array:runner:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_ips_text_array:qa:serverless
key: exception_operators_ips_text_array:runner:serverless
- label: Running exception_operators_long:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_long:qa:serverless
key: exception_operators_long:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2


- label: Running rule_creation:runner:serverless
- label: Running exception_operators_text:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh exception_operators_text:qa:serverless
key: exception_operators_text:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running rule_creation:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh rule_creation:qa:serverless
key: rule_creation:runner:serverless
key: rule_creation:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
Expand All @@ -64,4 +87,92 @@ steps:
automatic:
- exit_status: '1'
limit: 2


- label: Running entity_analytics:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh entity_analytics:qa:serverless
key: entity_analytics:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running prebuilt_rules_management:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh prebuilt_rules_management:qa:serverless
key: prebuilt_rules_management:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running prebuilt_rules_bundled_prebuilt_rules_package:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh prebuilt_rules_bundled_prebuilt_rules_package:qa:serverless
key: prebuilt_rules_bundled_prebuilt_rules_package:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running prebuilt_rules_large_prebuilt_rules_package:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh prebuilt_rules_large_prebuilt_rules_package:qa:serverless
key: prebuilt_rules_large_prebuilt_rules_package:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running prebuilt_rules_update_prebuilt_rules_package:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh prebuilt_rules_update_prebuilt_rules_package:qa:serverless
key: prebuilt_rules_update_prebuilt_rules_package:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running rule_execution_logic:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh rule_execution_logic:qa:serverless
key: rule_execution_logic:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running user_roles:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh user_roles:qa:serverless
key: user_roles:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

- label: Running telemetry:qa:serverless
command: .buildkite/scripts/pipelines/security_solution_quality_gate/api-integration-tests.sh telemetry:qa:serverless
key: telemetry:qa:serverless
agents:
queue: n2-4-spot
timeout_in_minutes: 120
retry:
automatic:
- exit_status: '1'
limit: 2

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -1441,6 +1441,7 @@ x-pack/test/security_solution_api_integration/test_suites/detections_response/de
## Security Solution sub teams - security-telemetry (Data Engineering)
x-pack/plugins/security_solution/server/usage/ @elastic/security-data-analytics
x-pack/plugins/security_solution/server/lib/telemetry/ @elastic/security-data-analytics
x-pack/test/security_solution_api_integration/test_suites/detections_response/default_license/telemetry @elastic/security-data-analytics

## Security Solution sub teams - security-engineering-productivity
/x-pack/test/security_solution_cypress/* @elastic/security-engineering-productivity
Expand Down
Expand Up @@ -12,13 +12,13 @@ import { getHeight } from './get_height';
describe('getHeight', () => {
Object.defineProperty(window, 'innerHeight', { writable: true, configurable: true, value: 500 });

const getMonacoMock = (lineCount: number) => {
const getMonacoMock = (lineCount: number, top: number = 200) => {
return {
getDomNode: jest.fn(() => {
return {
getBoundingClientRect: jest.fn(() => {
return {
top: 200,
top,
};
}),
};
Expand All @@ -29,10 +29,17 @@ describe('getHeight', () => {
} as unknown as monaco.editor.IStandaloneCodeEditor;
};
test('when using document explorer, returning the available height in the flyout', () => {
const monacoMock = getMonacoMock(500, 0);

const height = getHeight(monacoMock, true);
expect(height).toBe(475);
});

test('when using document explorer, returning the available height in the flyout has a minimun guarenteed height', () => {
const monacoMock = getMonacoMock(500);

const height = getHeight(monacoMock, true);
expect(height).toBe(275);
expect(height).toBe(400);
});

test('when using classic table, its displayed inline without scrolling', () => {
Expand Down
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { monaco } from '@kbn/monaco';
import { MARGIN_BOTTOM, MAX_LINES_CLASSIC_TABLE } from './source';
import { MARGIN_BOTTOM, MAX_LINES_CLASSIC_TABLE, MIN_HEIGHT } from './source';

export function getHeight(editor: monaco.editor.IStandaloneCodeEditor, useDocExplorer: boolean) {
const editorElement = editor?.getDomNode();
Expand All @@ -28,5 +28,5 @@ export function getHeight(editor: monaco.editor.IStandaloneCodeEditor, useDocExp
lineCount > MAX_LINES_CLASSIC_TABLE ? MAX_LINES_CLASSIC_TABLE : lineCount;
result = editor.getTopForLineNumber(displayedLineCount + 1) + lineHeight;
}
return result > 0 ? result : 0;
return Math.max(result, MIN_HEIGHT);
}
Expand Up @@ -36,6 +36,8 @@ interface SourceViewerProps {
export const MAX_LINES_CLASSIC_TABLE = 500;
// Displayed margin of the code editor to the window bottom when rendered in the document explorer flyout
export const MARGIN_BOTTOM = 25;
// Minimum height for the source content to guarantee minimum space when the flyout is scrollable.
export const MIN_HEIGHT = 400;

export const DocViewerSource = ({
id,
Expand Down
8 changes: 8 additions & 0 deletions src/setup_node_env/mute_libraries.js
Expand Up @@ -9,3 +9,11 @@
// disable moment deprecation warnings
var moment = require('moment');
moment.suppressDeprecationWarnings = true;

// disable rison-node parsing errors
// eslint-disable-next-line @kbn/eslint/module_migration
var rison = require('rison-node');
rison.parser.prototype.error = function (message) {
this.message = message;
return undefined;
};
Expand Up @@ -138,7 +138,7 @@ const UserDetailsEditor: FunctionComponent<UserDetailsEditorProps> = ({ user })
labelAppend={<OptionalText />}
fullWidth
>
<FormField name="user.full_name" fullWidth />
<FormField name="user.full_name" data-test-subj={'userProfileFullName'} fullWidth />
</FormRow>

<FormRow
Expand All @@ -153,7 +153,7 @@ const UserDetailsEditor: FunctionComponent<UserDetailsEditorProps> = ({ user })
labelAppend={<OptionalText />}
fullWidth
>
<FormField type="email" name="user.email" fullWidth />
<FormField type="email" name="user.email" data-test-subj={'userProfileEmail'} fullWidth />
</FormRow>
</EuiDescribedFormGroup>
);
Expand Down Expand Up @@ -189,6 +189,7 @@ const UserSettingsEditor: FunctionComponent<UserSettingsEditorProps> = ({
<EuiKeyPadMenuItem
name={id}
label={label}
data-test-subj={`themeKeyPadItem${label}`}
checkable="single"
isSelected={idSelected === id}
isDisabled={isThemeOverridden}
Expand Down Expand Up @@ -810,7 +811,11 @@ export const UserProfile: FunctionComponent<UserProfileProps> = ({ user, data })
</Form>
</KibanaPageTemplate.Section>
{formChanges.count > 0 ? (
<KibanaPageTemplate.BottomBar paddingSize="m" position="fixed">
<KibanaPageTemplate.BottomBar
paddingSize="m"
position="fixed"
data-test-subj={'userProfileBottomBar'}
>
<SaveChangesBottomBar />
</KibanaPageTemplate.BottomBar>
) : null}
Expand Down Expand Up @@ -974,6 +979,7 @@ export const SaveChangesBottomBar: FunctionComponent = () => {
<EuiFlexItem grow={false}>
<EuiButton
onClick={formik.submitForm}
data-test-subj="saveProfileChangesButton"
isLoading={formik.isSubmitting}
isDisabled={formik.submitCount > 0 && !formik.isValid}
color="success"
Expand Down
Expand Up @@ -9,6 +9,8 @@ export const TELEMETRY_CHANNEL_LISTS = 'security-lists-v2';

export const TELEMETRY_CHANNEL_ENDPOINT_META = 'endpoint-metadata';

export const TELEMETRY_CHANNEL_ENDPOINT_ALERTS = 'alerts-endpoint';

export const TELEMETRY_CHANNEL_DETECTION_ALERTS = 'alerts-detections';

export const TELEMETRY_CHANNEL_TIMELINE = 'alerts-timeline';
Expand Down
Expand Up @@ -37,15 +37,10 @@ describe('diagnostics telemetry task test', () => {
mockTelemetryEventsSender,
testTaskExecutionPeriod
);

expect(mockTelemetryReceiver.fetchDiagnosticAlerts).toHaveBeenCalledWith(
testTaskExecutionPeriod.last,
testTaskExecutionPeriod.current
);

expect(mockTelemetryEventsSender.queueTelemetryEvents).toHaveBeenCalledWith(
testDiagnosticsAlerts.hits.hits.flatMap((doc) => [doc._source])
);
expect(mockTelemetryEventsSender.sendOnDemand).toBeCalledTimes(1);
expect(mockTelemetryEventsSender.sendOnDemand).toBeCalledTimes(2);
});
});
Expand Up @@ -11,7 +11,7 @@ import type { ITelemetryEventsSender } from '../sender';
import type { TelemetryEvent } from '../types';
import type { ITelemetryReceiver } from '../receiver';
import type { TaskExecutionPeriod } from '../task';
import { TASK_METRICS_CHANNEL } from '../constants';
import { TELEMETRY_CHANNEL_ENDPOINT_ALERTS, TASK_METRICS_CHANNEL } from '../constants';

export function createTelemetryDiagnosticsTaskConfig() {
return {
Expand Down Expand Up @@ -49,14 +49,15 @@ export function createTelemetryDiagnosticsTaskConfig() {
return 0;
}
tlog(logger, `Received ${hits.length} diagnostic alerts`);
const diagAlerts: TelemetryEvent[] = hits.flatMap((h) =>
const alerts: TelemetryEvent[] = hits.flatMap((h) =>
h._source != null ? [h._source] : []
);
sender.queueTelemetryEvents(diagAlerts);

await sender.sendOnDemand(TELEMETRY_CHANNEL_ENDPOINT_ALERTS, alerts);
await sender.sendOnDemand(TASK_METRICS_CHANNEL, [
createTaskMetric(taskName, true, startTime),
]);
return diagAlerts.length;
return alerts.length;
} catch (err) {
await sender.sendOnDemand(TASK_METRICS_CHANNEL, [
createTaskMetric(taskName, false, startTime, err.message),
Expand Down

0 comments on commit 6c1fca6

Please sign in to comment.