Skip to content

Commit

Permalink
Merge branch 'master' into persistence-and-column-removal-updates-113090
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 16, 2021
2 parents a1429b1 + d98bf0c commit 291894f
Show file tree
Hide file tree
Showing 18 changed files with 1,130 additions and 65 deletions.
12 changes: 6 additions & 6 deletions .buildkite/scripts/pipelines/pull_request/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ const uploadPipeline = (pipelineContent) => {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/security_solution.yml'));
}

if (
(await doAnyChangesMatch([/^x-pack\/plugins\/apm/])) ||
process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml'));
}
// if (
// (await doAnyChangesMatch([/^x-pack\/plugins\/apm/])) ||
// process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
// ) {
// pipeline.push(getPipeline('.buildkite/pipelines/pull_request/apm_cypress.yml'));
// }

pipeline.push(getPipeline('.buildkite/pipelines/pull_request/post_build.yml'));

Expand Down
46 changes: 46 additions & 0 deletions src/core/server/saved_objects/serialization/serializer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,52 @@ describe('#rawToSavedObject', () => {
expect(actual).toHaveProperty('namespaces', ['baz']);
});
});

describe('throws if provided invalid type', () => {
expect(() =>
singleNamespaceSerializer.rawToSavedObject({
_id: 'foo:bar',
_source: {
// @ts-expect-error expects a string
// eslint-disable-next-line
type: new String('foo'),
},
})
).toThrowErrorMatchingInlineSnapshot(
`"Expected saved object type to be a string but given [String] with [foo] value."`
);

expect(() =>
singleNamespaceSerializer.rawToSavedObject({
_id: 'foo:bar',
_source: {
// @ts-expect-error expects astring
type: {
toString() {
return 'foo';
},
},
},
})
).toThrowErrorMatchingInlineSnapshot(
`"Expected saved object type to be a string but given [Object] with [foo] value."`
);
});

describe('throws if provided invalid id', () => {
expect(() =>
singleNamespaceSerializer.rawToSavedObject({
// @ts-expect-error expects a string
// eslint-disable-next-line
_id: new String('foo:bar'),
_source: {
type: 'foo',
},
})
).toThrowErrorMatchingInlineSnapshot(
`"Expected document id to be a string but given [String] with [foo:bar] value."`
);
});
});

describe('#savedObjectToRaw', () => {
Expand Down
6 changes: 4 additions & 2 deletions src/core/server/saved_objects/serialization/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import typeDetect from 'type-detect';
import { LEGACY_URL_ALIAS_TYPE } from '../object_types';
import { decodeVersion, encodeVersion } from '../version';
import { ISavedObjectTypeRegistry } from '../saved_objects_type_registry';
Expand Down Expand Up @@ -236,6 +236,8 @@ function checkIdMatchesPrefix(id: string, prefix: string) {

function assertNonEmptyString(value: string, name: string) {
if (!value || typeof value !== 'string') {
throw new TypeError(`Expected "${value}" to be a ${name}`);
throw new TypeError(
`Expected ${name} to be a string but given [${typeDetect(value)}] with [${value}] value.`
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ COPY --chown=1000:0 config/kibana.yml /usr/share/kibana/config/kibana.yml

# Add the launcher/wrapper script. It knows how to interpret environment
# variables and translate them to Kibana CLI options.
COPY --chown=1000:0 bin/kibana-docker /usr/local/bin/
COPY bin/kibana-docker /usr/local/bin/

# Ensure gid 0 write permissions for OpenShift.
RUN chmod g+ws /usr/share/kibana && \
Expand Down
14 changes: 7 additions & 7 deletions vars/tasks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ def functionalXpack(Map params = [:]) {
}
}

whenChanged([
'x-pack/plugins/apm/',
]) {
if (githubPr.isPr()) {
task(kibanaPipeline.functionalTestProcess('xpack-APMCypress', './test/scripts/jenkins_apm_cypress.sh'))
}
}
// whenChanged([
// 'x-pack/plugins/apm/',
// ]) {
// if (githubPr.isPr()) {
// task(kibanaPipeline.functionalTestProcess('xpack-APMCypress', './test/scripts/jenkins_apm_cypress.sh'))
// }
// }

whenChanged([
'x-pack/plugins/uptime/',
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/cypress/screens/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const TAKE_ACTION_POPOVER_BTN = '[data-test-subj="selectedShowBulkActions

export const TIMELINE_CONTEXT_MENU_BTN = '[data-test-subj="timeline-context-menu-button"]';

export const ATTACH_ALERT_TO_CASE_BUTTON = '[data-test-subj="attach-alert-to-case-button"]';
export const ATTACH_ALERT_TO_CASE_BUTTON = '[data-test-subj="add-existing-case-menu-item"]';

export const ALERT_COUNT_TABLE_FIRST_ROW_COUNT =
'[data-test-subj="alertsCountTable"] tr:nth-child(1) td:nth-child(2) .euiTableCellContent__text';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,8 @@ const RuleDetailsPageComponent: React.FC<DetectionEngineComponentProps> = ({
}, [rule, spacesApi]);

const getLegacyUrlConflictCallout = useMemo(() => {
const outcome = rule?.outcome;
if (rule != null && spacesApi && outcome === 'conflict') {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const aliasTargetId = rule?.alias_target_id!; // This is always defined if outcome === 'conflict'
if (rule?.alias_target_id != null && spacesApi && rule.outcome === 'conflict') {
const aliasTargetId = rule.alias_target_id;
// We have resolved to one rule, but there is another one with a legacy URL associated with this page. Display a
// callout with a warning for the user, and provide a way for them to navigate to the other rule.
const otherRulePath = `rules/id/${aliasTargetId}${window.location.search}${window.location.hash}`;
Expand Down
Loading

0 comments on commit 291894f

Please sign in to comment.