|
|
|
@ -76,6 +76,36 @@ describe('buildVisualQueryFromString', () => { |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('parses query with line filter and escaped quote', () => { |
|
|
|
|
expect(buildVisualQueryFromString('{app="frontend"} |= "\\"line"')).toEqual( |
|
|
|
|
noErrors({ |
|
|
|
|
labels: [ |
|
|
|
|
{ |
|
|
|
|
op: '=', |
|
|
|
|
value: 'frontend', |
|
|
|
|
label: 'app', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
operations: [{ id: LokiOperationId.LineContains, params: ['"line'] }], |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('parses query with label filter and escaped quote', () => { |
|
|
|
|
expect(buildVisualQueryFromString('{app="frontend"} | bar="\\"baz"')).toEqual( |
|
|
|
|
noErrors({ |
|
|
|
|
labels: [ |
|
|
|
|
{ |
|
|
|
|
op: '=', |
|
|
|
|
value: 'frontend', |
|
|
|
|
label: 'app', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
operations: [{ id: LokiOperationId.LabelFilter, params: ['bar', '=', '"baz'] }], |
|
|
|
|
}) |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('returns error for query with ip matching line filter', () => { |
|
|
|
|
const context = buildVisualQueryFromString('{app="frontend"} |= ip("192.168.4.5/16") | logfmt'); |
|
|
|
|
expect(context).toEqual( |
|
|
|
@ -320,7 +350,7 @@ describe('buildVisualQueryFromString', () => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('parses query with with decolorize and other operations', () => { |
|
|
|
|
expect(buildVisualQueryFromString('{app="frontend"} | logfmt | decolorize | __error__="')).toEqual( |
|
|
|
|
expect(buildVisualQueryFromString('{app="frontend"} | logfmt | decolorize | __error__=""')).toEqual( |
|
|
|
|
noErrors({ |
|
|
|
|
labels: [ |
|
|
|
|
{ |
|
|
|
|