Alerting: remove dead code (#43956) (#44103)

(cherry picked from commit 55ec05b560)
This commit is contained in:
Gilles De Mey
2022-01-17 14:29:34 +01:00
committed by GitHub
parent e77602a3b9
commit 575d7ed5d5
2 changed files with 1 additions and 22 deletions
@@ -1,6 +1,6 @@
import { Matcher } from 'app/plugins/datasource/alertmanager/types';
import { Labels } from 'app/types/unified-alerting-dto';
import { parseMatcher, parseMatchers, stringifyMatcher, labelsMatchMatchers } from './alertmanager';
import { parseMatcher, parseMatchers, labelsMatchMatchers } from './alertmanager';
describe('Alertmanager utils', () => {
describe('parseMatcher', () => {
@@ -55,19 +55,6 @@ describe('Alertmanager utils', () => {
});
});
describe('stringifyMatcher', () => {
it('should stringify matcher correctly', () => {
expect(
stringifyMatcher({
name: 'foo',
value: 'boo="bar"',
isRegex: true,
isEqual: false,
})
).toEqual('foo!~"boo=\\"bar\\""');
});
});
describe('parseMatchers', () => {
it('should parse all operators', () => {
expect(parseMatchers('foo=bar, bar=~ba.+, severity!=warning, email!~@grafana.com')).toEqual<Matcher[]>([
@@ -99,14 +99,6 @@ function unescapeMatcherValue(value: string) {
return trimmed.replace(/\\"/g, '"');
}
function escapeMatcherValue(value: string) {
return '"' + value.replace(/"/g, '\\"') + '"';
}
export function stringifyMatcher(matcher: Matcher): string {
return `${matcher.name}${matcherToOperator(matcher)}${escapeMatcherValue(matcher.value)}`;
}
export function parseMatcher(matcher: string): Matcher {
const trimmed = matcher.trim();
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {