Skip to content

expfmt: stop a test leaving the shared parser on legacy validation - #996

Open
Rohilalala wants to merge 1 commit into
prometheus:mainfrom
Rohilalala:fix/expfmt-test-isolation
Open

Rohilalala wants to merge 1 commit into
prometheus:mainfrom
Rohilalala:fix/expfmt-test-isolation

Conversation

@Rohilalala

Copy link
Copy Markdown

go test -count=2 ./expfmt/ fails on main, as do some -shuffle orders. testTextParseError switched the package-level test parser between UTF-8 and legacy name validation and left it on legacy, so the next TestTextParse run rejected UTF-8 names.

It now uses a second shared parser for legacy validation instead of changing the scheme of the first. Neither shared parser is modified by any test now, and the benchmarks keep reusing parsers.

Not changed: some model tests set the global NameValidationScheme without restoring it (TestLabelSetJSON, TestSilenceValidate, TestMatcherValidate, and TestDottedEncode in expfmt). None of them breaks anything today.

testTextParseError switched the package-level test parser between UTF-8
and legacy name validation and left it on legacy. Any later test using
that parser then rejected UTF-8 names, so `go test -count=2 ./expfmt/`
failed in TestTextParse, as did some -shuffle orders. Add a second shared
parser for legacy validation and have testTextParseError use the two
parsers as they are instead of changing their scheme.

Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant