Skip to content

fix: reject units in StateSet builder - #2635

Open
2748109647 wants to merge 1 commit into
prometheus:mainfrom
2748109647:fix/stateset-unit-validation
Open

2748109647 wants to merge 1 commit into
prometheus:mainfrom
2748109647:fix/stateset-unit-validation

Conversation

@2748109647

Copy link
Copy Markdown

@fstab

Fixes #2632.

StateSet.Builder inherited the generic unit(...) setter, so it accepted a non-null unit while building and only failed later during collect(). Override the setter to reject non-null units immediately, consistent with Info.Builder, and add a regression test.

Validation:

  • mvnw.cmd test -pl prometheus-metrics-core -am -Dtest=StateSetTest -Dsurefire.failIfNoSpecifiedTests=false -Dcoverage.skip=true — 5 tests passed; reactor build succeeded.
  • mvnw.cmd install -DskipTests -DskipITs -Dcoverage.skip=true — all 56 modules built successfully.
  • mise run lint:fix applied formatting. Checkstyle could not run locally because its downloaded Windows executable reported an incompatible binary.
  • Docker/Testcontainers integration checks were attempted with Docker available, but the configured docker.mirrors.ustc.edu.cn registry mirror did not resolve when pulling testcontainers/ryuk:0.12.0; those checks remain unverified.

Signed-off-by: Alpha <2748109647@qq.com>

This branch has not been deployed

No deployments
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.

StateSet.Builder.unit(...) is accepted at build time, then every collect() throws

1 participant