Skip to content

test: add krbctl integration suite and non-interactive mode - #253

Merged
maansaake merged 2 commits into
mainfrom
maansaake/krbctl-test-suite
Aug 23, 2026
Merged

test: add krbctl integration suite and non-interactive mode#253
maansaake merged 2 commits into
mainfrom
maansaake/krbctl-test-suite

Conversation

@maansaake

Copy link
Copy Markdown
Member

Summary

Adds a black-box integration test suite for the krbctl CLI, plus the non-interactive mode needed to drive it deterministically.

Non-interactive mode (production code)

krbctl's compose and config commands are fully interactive (huh forms requiring a TTY), so they could not be black-box tested. This adds an explicit --non-interactive/-y flag with per-option value flags. Value flags only take effect in non-interactive mode; the interactive forms are unchanged and remain the default.

  • compose: -y, --echo, --obs-stack, --postgres, --connector
  • config: -y, --echo-backend, repeatable --backend 'name=..,host=..,port=..,auth=..', --driver, --obs-stack, --grafana-anonymous, repeatable --scrape-target, --connector, --connector-allow-all-origins
    • New parseBackendFlag helper with validation (unknown driver / missing backend produce clear errors).

New suite test/suites/krbctl (stdlib only, no new deps)

  • One golden-file test for compose — byte-compares generated compose.yaml.
  • One golden-file test for config — rich scenario (echo backend + auth backend + postgres + obs stack + connector); validates only the dynamically-built files (krb.json, connector.json, prometheus.yml, grafana/grafana.ini, grafana/grafana-datasources.yml). Embedded static assets (dashboards, jaeger config) are intentionally not compared.
  • Binary located via KRBCTL_BIN; golden fixtures under testdata/.

Tooling / CI

  • make test/krbctl and make test/krbctl/json (build krbctl, run suite).
  • New callable-test-krbctl.yaml workflow (no docker/image dependency), wired into main.yaml as an independent krbctl-test job on main pushes.

Verification

  • make test/krbctl and make test/krbctl/json pass (both tests green).
  • golangci-lint clean on cmd/krbctl/... and the new suite; go vet clean.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

maansaake and others added 2 commits August 23, 2026 11:07
Add an explicit non-interactive mode (--non-interactive/-y) to the krbctl
compose and config commands, with per-option value flags so the commands can
be driven deterministically without a TTY. The interactive huh forms are
unchanged and remain the default.

Add a new, separate integration test suite (test/suites/krbctl) with one
golden-file test each for compose and config, running the real binary via
KRBCTL_BIN. The config test validates only the dynamically-built files.

Wire up make test/krbctl[/json] targets and a callable-test-krbctl workflow
invoked from main.yaml on main pushes (no image dependency).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maansaake
maansaake merged commit 35930e3 into main Aug 23, 2026
19 checks passed
@maansaake
maansaake deleted the maansaake/krbctl-test-suite branch August 23, 2026 09:57
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.

1 participant