tests: add coverage for options, types, and HTTP server

- options_test.go: GetOption, GetFloatOption, GetIntOption, GetBoolOption
  with native types, JSON round-trips, missing keys, and wrong types
- types_test.go: Status JSON marshal/unmarshal (strings, legacy ints,
  round-trip, unknown values), CheckTarget.Scope/String, BuildRulesInfo,
  empty-ID rejection
- server_test.go: /health, /collect (success, error, bad body),
  /definition, /evaluate (all rules, disabled rule), /report (HTML,
  metrics, bad body), missing endpoints without CheckerDefinitionProvider
This commit is contained in:
nemunaire 2026-04-10 16:24:11 +07:00
commit ef7fffd4b7
4 changed files with 631 additions and 0 deletions

View file

@ -22,6 +22,9 @@ import (
// resetRegistries clears the global registries between tests so that one
// test's registration cannot leak into the next. The package-level maps are
// the only shared state.
//
// Tests in this package MUST NOT use t.Parallel() because they mutate
// these shared maps without synchronization.
func resetRegistries() {
checkerRegistry = map[string]*CheckerDefinition{}
observationProviderRegistry = map[ObservationKey]ObservationProvider{}