Skip to content

test: add integration tests for flag/config/env precedence#91

Merged
telegrapher merged 5 commits intomainfrom
test/integration-tests-flag-config-env-precedence
Mar 3, 2026
Merged

test: add integration tests for flag/config/env precedence#91
telegrapher merged 5 commits intomainfrom
test/integration-tests-flag-config-env-precedence

Conversation

@telegrapher
Copy link
Collaborator

Summary

  • Add 34 integration tests in cmd/integration_test.go that exercise the full cobra command tree end-to-end using httptest mock servers
  • Verify the precedence chain (flag > env > config file > default), subcommand URL routing, timeout behavior, config file loading, command-specific flags/headers/form data, API version routing, and env var mapping
  • All assertions are on captured HTTP requests (path, method, headers, form data, query params) rather than stdout, since subcommands use fmt.Println

Go 1.18 introduced any as an alias for interface{}. This is a
cosmetic change with no behavioral impact.
Exercise the full cobra command tree end-to-end using httptest mock
servers: flag parsing → viper binding → config population → IMS API
call. Covers 34 test cases across 7 groups: precedence chain
(flag > env > config > default), subcommand URL routing, timeout
behavior, config file loading, command-specific flags/headers/form
data, API version routing, and env var mapping.
Each test creates a fresh mock and makes exactly one command call,
so storing a slice of requests behind a mutex is unnecessary.
Move govulncheck and notify jobs from the standalone govulncheck.yml
into ci.yml so vulnerability scanning runs alongside tests, lint, and
build on every push and PR. Adds the weekly schedule trigger and
issues:write permission to ci.yml. Deletes the now-redundant
govulncheck.yml.
@telegrapher telegrapher merged commit db11c5a into main Mar 3, 2026
21 checks passed
@telegrapher telegrapher deleted the test/integration-tests-flag-config-env-precedence branch March 3, 2026 15:54
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.

2 participants