Skip to content

test: improve CLI parsing and source-tracking coverage #610

@abtreece

Description

@abtreece

Context

PR #609 adds targeted regression coverage for #601, specifically around config precedence when CLI or environment values are explicitly set to their defaults. While reviewing that work, a few broader CLI test gaps became clear that are adjacent to the fix but not required for it.

Suggested test improvements

  • Replace stale default-node tests that manually simulate old Run() behavior with tests that exercise the real applyBackendDefaults() path and backend Run() wiring.
  • Add table-driven tests for config source tracking from Kong:
    • global CLI flags
    • global env vars
    • representative backend flags such as --node, --scheme, --file, --filter, and Secrets Manager/ACM flags
    • aliases where TOML and CLI names differ, such as TOML nodes versus CLI node
  • Add broader config precedence tests for representative settings beyond the refactor: replace manual config precedence merging #601 regression cases:
    • boolean options with explicit false/true behavior
    • string options
    • duration options
    • backend-specific options
  • Keep parse-only CLI tests separate from config-merge tests so failures identify whether Kong parsing, source tracking, or TOML resolution regressed.

Acceptance criteria

  • CLI parse/source tests cover representative global and backend flags.
  • Config precedence tests cover representative scalar, bool, duration, slice, and backend-specific options.
  • Stale tests that only duplicate implementation details are removed or rewritten to exercise production behavior.
  • go test ./cmd/confd passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions