test: local-creds helper for acceptance runs#545
Merged
Conversation
5107388 to
40ce7e3
Compare
Contributor
Author
|
[SC-183040] |
Add a build-tagged entry point to every acceptance test package so contributors can run real-infrastructure tests without exporting EXOSCALE_API_KEY / EXOSCALE_API_SECRET into the shell, and without remembering to set TF_ACC=1. Mirrors exoscale/cli#837. Credentials are read from $HOME/.config/exoscale/exoscale.toml (same file the CLI uses) and injected via t.Setenv, scoped to the test. LoadLocalCreds also defaults TF_ACC to "1" when unset; a pre-set value is respected. - pkg/testutils/localcreds.go: LoadLocalCreds(t, account) helper. No build tag, but only invoked from build-tagged _test.go files, so CI never sees it. - pkg/resources/<pkg>/local_test.go (build local_integration): one TestXxxLocal per package that loads creds and forwards to the existing TestXxx entry point. 9 packages covered; the legacy exoscale/ package has no single entry point and is left out (callers can still use LoadLocalCreds directly there). Usage: go test -tags=local_integration -run TestDatabaseLocal \ -account=owner-production -timeout 60m ./pkg/resources/database/
40ce7e3 to
8dfe099
Compare
kobajagi
reviewed
Jun 5, 2026
LoadLocalCreds hardcoded $HOME/.config/exoscale/exoscale.toml, which is the Linux XDG path. The CLI uses os.UserConfigDir(), so on macOS the config actually lives at ~/Library/Application Support/exoscale/ and the helper would not find it. Mirrors the CLI lookup instead. Also honour $EXOSCALE_CONFIG, same as the CLI's -C/--config flag.
kobajagi
approved these changes
Jun 5, 2026
2 tasks
natalie-o-perret
added a commit
that referenced
this pull request
Jun 8, 2026
natalie-o-perret
added a commit
that referenced
this pull request
Jun 8, 2026
## Summary Backfill the `Unreleased` block in `CHANGELOG.md` with natalie's PRs merged since v0.69.2 (2026-05-05) that were missing. ## Related issue None. ## Changes Add the following to the existing `## Unreleased` block in `CHANGELOG.md`: ### IMPROVEMENTS - test: local-creds helper for acceptance runs #545 ### BUG FIXES - fix(compute_instance): suppress user_data diffs for pre-encoded input #518 - fix(security-group-rule): allow portless protocols (ESP, AH, GRE, IPIP) #531 - fix(template): fall back to private visibility when name lookup returns not found #532 ### FEATURES - feat(dbaas): add exoscale_dbaas_valkey_user resource #528 ## Checklist * [x] Changelog updated (under *Unreleased* block) * [ ] Acceptance tests OK (not applicable, docs only) ## Notes for reviewers Entries for other merged PRs since 0.69.2 (#533 by @imiric) are missing. Not added here per scope; left for the relevant author or release manager. --------- Co-authored-by: Ivan Mirić <1009277+imiric@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.
Description
Local helper for running acceptance tests against real infra. Mirrors exoscale/cli#837. Reads
~/.config/exoscale/exoscale.toml, sets the creds viat.Setenv, defaultsTF_ACC=1(pre-set is respected).go test -tags=local_integration -run TestDatabaseLocal \ -account=owner-production -timeout 60m ./pkg/resources/database/pkg/testutils/localcreds.go:LoadLocalCreds(t, account).pkg/resources/<pkg>/local_test.go(buildlocal_integration):TestXxxLocalper package, wraps the existingTestXxx. Legacyexoscale/left out, no single entry.README.md: short note in Contributing pointing at the helper, so new contributors know they don't need to export creds by hand.Build, vet, gofmt, unit tests clean. Smoke tested with a fake
exoscale.toml, env vars land correctly,TF_ACCdefault and override both work.Checklist
(For exoscale contributors)
Testing
make testpasses. No real-infra run, no creds in this env.