mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
parent
e4abda8593
commit
34375fd433
3 changed files with 28 additions and 27 deletions
|
@ -22,7 +22,28 @@ createHangUpError (_http_client.js)
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`createErrorGroupWatch should format entire template correctly 1`] = `
|
||||
exports[`createErrorGroupWatch should format slack message correctly 1`] = `
|
||||
"Your service \\"opbeans-node\\" has error groups which exceeds 10 occurrences within \\"24h\\"
|
||||
|
||||
>*this is a string*
|
||||
>N/A
|
||||
>7761 occurrences
|
||||
|
||||
>*foo*
|
||||
>\`<anonymous> (server/coffee.js)\`
|
||||
>7752 occurrences
|
||||
|
||||
>*socket hang up*
|
||||
>\`createHangUpError (_http_client.js)\`
|
||||
>3887 occurrences
|
||||
|
||||
>*this will not get captured by express*
|
||||
>\`<anonymous> (server/coffee.js)\`
|
||||
>3886 occurrences
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`createErrorGroupWatch should format template correctly 1`] = `
|
||||
Object {
|
||||
"actions": Object {
|
||||
"email": Object {
|
||||
|
@ -41,7 +62,7 @@ Object {
|
|||
},
|
||||
"slack_webhook": Object {
|
||||
"webhook": Object {
|
||||
"body": "{\\"text\\":\\"Your service \\\\\\"opbeans-node\\\\\\" has error groups which exceeds 10 occurrences within \\\\\\"24h\\\\\\"\\\\n\\\\n>*this is a string*\\\\n>N/A\\\\n>7761 occurrences\\\\n\\\\n>*foo*\\\\n>\`<anonymous> (server/coffee.js)\`\\\\n>7752 occurrences\\\\n\\\\n>*socket hang up*\\\\n>\`createHangUpError (_http_client.js)\`\\\\n>3887 occurrences\\\\n\\\\n>*this will not get captured by express*\\\\n>\`<anonymous> (server/coffee.js)\`\\\\n>3886 occurrences\\\\n\\"}",
|
||||
"body": "__json__::{\\"text\\":\\"Your service \\\\\\"opbeans-node\\\\\\" has error groups which exceeds 10 occurrences within \\\\\\"24h\\\\\\"\\\\n\\\\n>*this is a string*\\\\n>N/A\\\\n>7761 occurrences\\\\n\\\\n>*foo*\\\\n>\`<anonymous> (server/coffee.js)\`\\\\n>7752 occurrences\\\\n\\\\n>*socket hang up*\\\\n>\`createHangUpError (_http_client.js)\`\\\\n>3887 occurrences\\\\n\\\\n>*this will not get captured by express*\\\\n>\`<anonymous> (server/coffee.js)\`\\\\n>3886 occurrences\\\\n\\"}",
|
||||
"headers": Object {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
|
@ -146,24 +167,3 @@ Object {
|
|||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`createErrorGroupWatch should format slack message correctly 1`] = `
|
||||
"Your service \\"opbeans-node\\" has error groups which exceeds 10 occurrences within \\"24h\\"
|
||||
|
||||
>*this is a string*
|
||||
>N/A
|
||||
>7761 occurrences
|
||||
|
||||
>*foo*
|
||||
>\`<anonymous> (server/coffee.js)\`
|
||||
>7752 occurrences
|
||||
|
||||
>*socket hang up*
|
||||
>\`createHangUpError (_http_client.js)\`
|
||||
>3887 occurrences
|
||||
|
||||
>*this will not get captured by express*
|
||||
>\`<anonymous> (server/coffee.js)\`
|
||||
>3886 occurrences
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -57,8 +57,9 @@ describe('createErrorGroupWatch', () => {
|
|||
expect(tmpl.actions.slack_webhook.webhook.path).toBe(
|
||||
'/services/slackid1/slackid2/slackid3'
|
||||
);
|
||||
|
||||
expect(
|
||||
JSON.parse(tmpl.actions.slack_webhook.webhook.body).text
|
||||
JSON.parse(tmpl.actions.slack_webhook.webhook.body.slice(10)).text
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
|
@ -74,7 +75,7 @@ describe('createErrorGroupWatch', () => {
|
|||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should format entire template correctly', () => {
|
||||
it('should format template correctly', () => {
|
||||
expect(tmpl).toMatchSnapshot();
|
||||
});
|
||||
|
||||
|
|
|
@ -150,9 +150,9 @@ export async function createErrorGroupWatch({
|
|||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
body: `__json__::${JSON.stringify({
|
||||
text: slackTemplate
|
||||
})
|
||||
})}`
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue