mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix UI inheriting mute timings from parent when calculating the polic… (#79295)
* Fix UI inheriting mute timings from parent when calculating the policy tree properties * Add test for this use case
This commit is contained in:
parent
ce79bbba87
commit
fdb4626847
@ -134,7 +134,7 @@ describe('Policy', () => {
|
||||
expect(within(secondPolicy).getByTestId('label-matchers')).toHaveTextContent(/^region \= EMEA$/);
|
||||
expect(within(secondPolicy).queryByTestId('continue-matching')).not.toBeInTheDocument();
|
||||
expect(within(secondPolicy).queryByTestId('mute-timings')).not.toBeInTheDocument();
|
||||
expect(within(secondPolicy).getByTestId('inherited-properties')).toHaveTextContent('Inherited4 properties');
|
||||
expect(within(secondPolicy).getByTestId('inherited-properties')).toHaveTextContent('Inherited3 properties');
|
||||
|
||||
// third custom policy should be correct
|
||||
const thirdPolicy = customPolicies[2];
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { MatcherOperator, Route, RouteWithID } from 'app/plugins/datasource/alertmanager/types';
|
||||
|
||||
import {
|
||||
findMatchingRoutes,
|
||||
normalizeRoute,
|
||||
getInheritedProperties,
|
||||
computeInheritedTree,
|
||||
findMatchingRoutes,
|
||||
getInheritedProperties,
|
||||
matchLabels,
|
||||
normalizeRoute,
|
||||
} from './notification-policies';
|
||||
|
||||
import 'core-js/stable/structured-clone';
|
||||
@ -294,6 +294,21 @@ describe('getInheritedProperties()', () => {
|
||||
expect(childInherited).toHaveProperty('group_interval', '2m');
|
||||
});
|
||||
});
|
||||
it('should not inherit mute timings from parent route', () => {
|
||||
const parent: Route = {
|
||||
receiver: 'PARENT',
|
||||
group_by: ['parentLabel'],
|
||||
mute_time_intervals: ['Mon-Fri 09:00-17:00'],
|
||||
};
|
||||
|
||||
const child: Route = {
|
||||
receiver: 'CHILD',
|
||||
group_by: ['childLabel'],
|
||||
};
|
||||
|
||||
const childInherited = getInheritedProperties(parent, child);
|
||||
expect(childInherited).not.toHaveProperty('mute_time_intervals');
|
||||
});
|
||||
});
|
||||
|
||||
describe('computeInheritedTree', () => {
|
||||
|
@ -169,7 +169,6 @@ function getInheritedProperties(
|
||||
'group_wait',
|
||||
'group_interval',
|
||||
'repeat_interval',
|
||||
'mute_time_intervals',
|
||||
]);
|
||||
|
||||
// TODO how to solve this TypeScript mystery?
|
||||
|
Loading…
Reference in New Issue
Block a user