Skip to content

The new lazy initialization logic in GetMessanger() (lines 166-214) lacks test coverage. This includes critical paths like: #39

Description

@rustyeddy

The new lazy initialization logic in GetMessanger() (lines 166-214) lacks test coverage. This includes critical paths like:

  1. Environment variable fallback logic (MQTT_BROKER, MQTT_USERNAME, MQTT_PASSWORD)
  2. The "address already in use" error handling for the embedded broker
  3. The config priority (config -> env vars -> default)
  4. The fallthrough from "otto" case to default case

The existing TestGetMessanger only tests singleton behavior after NewMessanger is called, not the lazy initialization path. Consider adding table-driven tests that exercise these scenarios.

Originally posted by @Copilot in #34 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions