Skip to content

Add unit coverage for Healthz notify path (MonitorHealthChan/notifyHealth) #110

Description

@miotte

The internal health-signal path used to broadcast GOAWAY/health codes to connected Healthz clients is largely untested:

  • server.MonitorHealthChan (server.go:779) — 0% coverage
  • server.notifyHealth (server.go:768) — 40% coverage

These functions implement the K8s-aware health broadcast feature (fan-out of HealthStatus_Code to all registered client notifiers, and single-notifier-per-client registration/replacement). The fan-out and notifier-replacement logic currently has no direct unit test.

Scope

Add table/unit tests covering:

  • notifyHealth registers a receiver and, when called again for the same client address, closes and replaces the prior receiver.
  • MonitorHealthChan fans a code out to all registered notifiers and exits cleanly when its receiver channel is closed.

No production behavior change; test-only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    goPull requests that update go codetesting

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions