test: add krbctl integration suite and non-interactive mode - #253
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a black-box integration test suite for the
krbctlCLI, plus the non-interactive mode needed to drive it deterministically.Non-interactive mode (production code)
krbctl'scomposeandconfigcommands are fully interactive (huhforms requiring a TTY), so they could not be black-box tested. This adds an explicit--non-interactive/-yflag with per-option value flags. Value flags only take effect in non-interactive mode; the interactive forms are unchanged and remain the default.-y,--echo,--obs-stack,--postgres,--connector-y,--echo-backend, repeatable--backend 'name=..,host=..,port=..,auth=..',--driver,--obs-stack,--grafana-anonymous, repeatable--scrape-target,--connector,--connector-allow-all-originsparseBackendFlaghelper with validation (unknown driver / missing backend produce clear errors).New suite
test/suites/krbctl(stdlib only, no new deps)compose— byte-compares generatedcompose.yaml.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.KRBCTL_BIN; golden fixtures undertestdata/.Tooling / CI
make test/krbctlandmake test/krbctl/json(build krbctl, run suite).callable-test-krbctl.yamlworkflow (no docker/image dependency), wired intomain.yamlas an independentkrbctl-testjob onmainpushes.Verification
make test/krbctlandmake test/krbctl/jsonpass (both tests green).golangci-lintclean oncmd/krbctl/...and the new suite;go vetclean.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com