diff --git a/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx b/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx index 3631d7dfa06..88fece21e9f 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Policy.test.tsx @@ -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]; diff --git a/public/app/features/alerting/unified/utils/notification-policies.test.ts b/public/app/features/alerting/unified/utils/notification-policies.test.ts index 4880ee33098..e5eb78e6706 100644 --- a/public/app/features/alerting/unified/utils/notification-policies.test.ts +++ b/public/app/features/alerting/unified/utils/notification-policies.test.ts @@ -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', () => { diff --git a/public/app/features/alerting/unified/utils/notification-policies.ts b/public/app/features/alerting/unified/utils/notification-policies.ts index 81ce2822345..dceaf3ba201 100644 --- a/public/app/features/alerting/unified/utils/notification-policies.ts +++ b/public/app/features/alerting/unified/utils/notification-policies.ts @@ -169,7 +169,6 @@ function getInheritedProperties( 'group_wait', 'group_interval', 'repeat_interval', - 'mute_time_intervals', ]); // TODO how to solve this TypeScript mystery?