Skip to content

Commit

Permalink
Merge branch 'master' into adding-do-not-start-datafeed-switch-to-job…
Browse files Browse the repository at this point in the history
…-wizards
  • Loading branch information
elasticmachine authored Sep 16, 2020
2 parents 2ec87e1 + 6c5258a commit 12aa78d
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { isEmpty } from 'lodash';
import { i18n } from '@kbn/i18n';
import isEmpty from 'lodash/isEmpty';

import './brace_imports';

import {
EuiForm,
EuiButton,
Expand All @@ -25,6 +25,17 @@ import { GrokdebuggerRequest } from '../../models/grokdebugger_request';
import { withKibana } from '../../../../../../src/plugins/kibana_react/public';
import { FormattedMessage } from '@kbn/i18n/react';

const i18nTexts = {
simulate: {
errorTitle: i18n.translate('xpack.grokDebugger.simulate.errorTitle', {
defaultMessage: 'Simulate error',
}),
unknownErrorTitle: i18n.translate('xpack.grokDebugger.unknownErrorTitle', {
defaultMessage: 'Something went wrong',
}),
},
};

export class GrokDebuggerComponent extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -84,12 +95,13 @@ export class GrokDebuggerComponent extends React.Component {

if (!isEmpty(simulateResponse.error)) {
notifications.toasts.addDanger({
body: simulateResponse.error,
title: i18nTexts.simulate.errorTitle,
text: simulateResponse.error,
});
}
} catch (e) {
notifications.toasts.addDanger({
body: e,
notifications.toasts.addError(e, {
title: i18nTexts.simulate.unknownErrorTitle,
});
}
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 11 additions & 152 deletions x-pack/test/apm_api_integration/trial/tests/service_maps/service_maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,159 +86,18 @@ export default function serviceMapsApiTests({ getService }: FtrProviderContext)
});

it('returns service map elements filtering by environment not defined', async () => {
const encodedStart = encodeURIComponent('2020-06-28T10:24:46.055Z');
const encodedEnd = encodeURIComponent('2020-06-29T10:24:46.055Z');
const environment = 'ENVIRONMENT_NOT_DEFINED';
const resp = await supertest.get(
`/api/apm/service-map?start=${encodedStart}&end=${encodedEnd}&environment=${environment}`
const ENVIRONMENT_NOT_DEFINED = 'ENVIRONMENT_NOT_DEFINED';
const { body, status } = await supertest.get(
`/api/apm/service-map?start=${start}&end=${end}&environment=${ENVIRONMENT_NOT_DEFINED}`
);
expect(resp.status).to.be(200);
expectSnapshot(resp.body).toMatchInline(`
Object {
"elements": Array [
Object {
"data": Object {
"id": "client~opbeans-node",
"source": "client",
"sourceData": Object {
"agent.name": "rum-js",
"id": "client",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "client",
},
"target": "opbeans-node",
"targetData": Object {
"agent.name": "nodejs",
"id": "opbeans-node",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-node",
},
},
},
Object {
"data": Object {
"id": "opbeans-java~>postgresql",
"source": "opbeans-java",
"sourceData": Object {
"agent.name": "java",
"id": "opbeans-java",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-java",
},
"target": ">postgresql",
"targetData": Object {
"id": ">postgresql",
"label": "postgresql",
"span.destination.service.resource": "postgresql",
"span.subtype": "postgresql",
"span.type": "db",
},
},
},
Object {
"data": Object {
"id": "opbeans-node~>postgresql",
"source": "opbeans-node",
"sourceData": Object {
"agent.name": "nodejs",
"id": "opbeans-node",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-node",
},
"target": ">postgresql",
"targetData": Object {
"id": ">postgresql",
"label": "postgresql",
"span.destination.service.resource": "postgresql",
"span.subtype": "postgresql",
"span.type": "db",
},
},
},
Object {
"data": Object {
"id": "opbeans-node~>redis",
"source": "opbeans-node",
"sourceData": Object {
"agent.name": "nodejs",
"id": "opbeans-node",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-node",
},
"target": ">redis",
"targetData": Object {
"id": ">redis",
"label": "redis",
"span.destination.service.resource": "redis",
"span.subtype": "redis",
"span.type": "cache",
},
},
},
Object {
"data": Object {
"id": "opbeans-node~opbeans-java",
"source": "opbeans-node",
"sourceData": Object {
"agent.name": "nodejs",
"id": "opbeans-node",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-node",
},
"target": "opbeans-java",
"targetData": Object {
"agent.name": "java",
"id": "opbeans-java",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-java",
},
},
},
Object {
"data": Object {
"agent.name": "rum-js",
"id": "client",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "client",
},
},
Object {
"data": Object {
"agent.name": "nodejs",
"id": "opbeans-node",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-node",
},
},
Object {
"data": Object {
"id": ">redis",
"label": "redis",
"span.destination.service.resource": "redis",
"span.subtype": "redis",
"span.type": "cache",
},
},
Object {
"data": Object {
"agent.name": "java",
"id": "opbeans-java",
"service.environment": "ENVIRONMENT_NOT_DEFINED",
"service.name": "opbeans-java",
},
},
Object {
"data": Object {
"id": ">postgresql",
"label": "postgresql",
"span.destination.service.resource": "postgresql",
"span.subtype": "postgresql",
"span.type": "db",
},
},
],
}
`);
expect(status).to.be(200);
const environments = new Set();
body.elements.forEach((element: { data: Record<string, any> }) => {
environments.add(element.data['service.environment']);
});
expect(environments.size).to.eql(1);
expect(environments.has(ENVIRONMENT_NOT_DEFINED)).to.eql(true);
expectSnapshot(body).toMatch();
});
});
});
Expand Down

0 comments on commit 12aa78d

Please sign in to comment.