Skip to content

Commit

Permalink
Use getLogMetadata util function
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Jan 25, 2024
1 parent 4cb64ee commit 5e3820b
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ describe('CasesConnectorExecutor', () => {
expect(casesClientMock.attachments.bulkCreate).toHaveBeenCalledTimes(0);
expect(mockLogger.warn).toHaveBeenCalledWith(
'Cases with ids "mock-id-1" contain more than 1000 alerts. The new alerts will not be attached to the cases. Total new alerts: 1',
{ tags: ['rule:rule-test-id'] }
{ tags: ['cases-connector', 'rule:rule-test-id'], labels: {} }
);
});

Expand All @@ -962,7 +962,7 @@ describe('CasesConnectorExecutor', () => {
expect(casesClientMock.attachments.bulkCreate).toHaveBeenCalledTimes(0);
expect(mockLogger.warn).toHaveBeenCalledWith(
'Cases with ids "mock-id-1" contain more than 1000 alerts. The new alerts will not be attached to the cases. Total new alerts: 1',
{ tags: ['rule:rule-test-id'] }
{ tags: ['cases-connector', 'rule:rule-test-id'], labels: {} }
);
});

Expand Down Expand Up @@ -2032,7 +2032,8 @@ describe('CasesConnectorExecutor', () => {
});

expect(mockLogger.warn).toHaveBeenCalledWith(
'[CasesConnector][CasesConnectorExecutor][isTimeWindowPassed] Parsing time window error. Parsing value: "invalid"'
'[CasesConnector][CasesConnectorExecutor][isTimeWindowPassed] Parsing time window error. Parsing value: "invalid"',
{ labels: {}, tags: ['cases-connector', 'rule:rule-test-id'] }
);
});

Expand All @@ -2042,7 +2043,8 @@ describe('CasesConnectorExecutor', () => {
await connectorExecutor.execute(params);

expect(mockLogger.warn).toHaveBeenCalledWith(
'[CasesConnector][CasesConnectorExecutor][isTimeWindowPassed] Timestamp "invalid" is not a valid date'
'[CasesConnector][CasesConnectorExecutor][isTimeWindowPassed] Timestamp "invalid" is not a valid date',
{ labels: {}, tags: ['cases-connector', 'rule:rule-test-id'] }
);
});
});
Expand Down Expand Up @@ -2129,7 +2131,8 @@ describe('CasesConnectorExecutor', () => {
});

expect(mockLogger.warn).toHaveBeenCalledWith(
`[CasesConnector][CasesConnectorExecutor][applyCircuitBreakers] Circuit breaker: Grouping definition would create more than the maximum number of allowed cases 1. Falling back to one case.`
`[CasesConnector][CasesConnectorExecutor][applyCircuitBreakers] Circuit breaker: Grouping definition would create more than the maximum number of allowed cases 1. Falling back to one case.`,
{ labels: {}, tags: ['cases-connector', 'rule:rule-test-id'] }
);
});
});
Expand Down Expand Up @@ -2210,7 +2213,8 @@ describe('CasesConnectorExecutor', () => {
});

expect(mockLogger.warn).toHaveBeenCalledWith(
`[CasesConnector][CasesConnectorExecutor][applyCircuitBreakers] Circuit breaker: Grouping definition would create more than the maximum number of allowed cases 10. Falling back to one case.`
`[CasesConnector][CasesConnectorExecutor][applyCircuitBreakers] Circuit breaker: Grouping definition would create more than the maximum number of allowed cases 10. Falling back to one case.`,
{ labels: {}, tags: ['cases-connector', 'rule:rule-test-id'] }
);
});
});
Expand Down
Loading

0 comments on commit 5e3820b

Please sign in to comment.