mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-03 13:42:14 -04:00
Merge pull request #18783 from flying-musk/test-promql-quoted-label-name
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests for 32-bit x86 (push) Waiting to run
CI / Go tests for Prometheus upgrades and downgrades (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
Some checks are pending
buf.build / lint and publish (push) Waiting to run
CI / Go tests (push) Waiting to run
CI / More Go tests (push) Waiting to run
CI / Go tests for 32-bit x86 (push) Waiting to run
CI / Go tests for Prometheus upgrades and downgrades (push) Waiting to run
CI / Go tests with previous Go version (push) Waiting to run
CI / UI tests (push) Waiting to run
CI / Go tests on Windows (push) Waiting to run
CI / Mixins tests (push) Waiting to run
CI / Compliance testing (push) Waiting to run
CI / Build Prometheus for common architectures (push) Waiting to run
CI / Build Prometheus for all architectures (push) Waiting to run
CI / Report status of build Prometheus for all architectures (push) Blocked by required conditions
CI / Check generated parser (push) Waiting to run
CI / golangci-lint (push) Waiting to run
CI / fuzzing (push) Waiting to run
CI / codeql (push) Waiting to run
CI / Publish main branch artifacts (push) Blocked by required conditions
CI / Publish release artefacts (push) Blocked by required conditions
CI / Publish UI on npm Registry (push) Blocked by required conditions
govulncheck / Run govulncheck (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run
ui: cover PromQL label name quoting
This commit is contained in:
commit
f37442d25a
1 changed files with 14 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import {
|
|||
getNonParenNodeType,
|
||||
containsPlaceholders,
|
||||
nodeValueType,
|
||||
maybeQuoteLabelName,
|
||||
} from "./utils";
|
||||
import { nodeType, valueType, binaryOperatorType } from "./ast";
|
||||
|
||||
|
|
@ -159,3 +160,16 @@ describe("nodeValueType", () => {
|
|||
).toBe(valueType.vector);
|
||||
});
|
||||
});
|
||||
|
||||
describe("maybeQuoteLabelName", () => {
|
||||
it("does not quote valid PromQL label names", () => {
|
||||
expect(maybeQuoteLabelName("job")).toBe("job");
|
||||
expect(maybeQuoteLabelName("status_code")).toBe("status_code");
|
||||
});
|
||||
|
||||
it("quotes and escapes label names with extended characters", () => {
|
||||
expect(maybeQuoteLabelName("service.version")).toBe('"service.version"');
|
||||
expect(maybeQuoteLabelName("team/name")).toBe('"team/name"');
|
||||
expect(maybeQuoteLabelName('team"name')).toBe('"team\\"name"');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue