Integration tests: fast-fail on missing credential env vars#1534
Merged
Integration tests: fast-fail on missing credential env vars#1534
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a small integration-test utility to fail fast when required credential environment variables are missing/empty, so CI failures point directly to the missing GitHub Actions secret(s).
Changes:
- Introduced
TestHelper.AssertCredentialsPresent(...)to validate required credential env vars at construction time. - Updated integration test constructors to invoke the new helper before creating clients / making API calls.
- Refactored Azure storage env var name construction into a local variable for reuse (and to include in the validation list).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/OctoshiftCLI.IntegrationTests/TestHelper.cs | Adds AssertCredentialsPresent helper that checks env vars and throws a clear exception listing missing credentials. |
| src/OctoshiftCLI.IntegrationTests/GithubToGithub.cs | Validates GHEC_PAT is present before initializing GitHub client/api usage. |
| src/OctoshiftCLI.IntegrationTests/GhesToGithub.cs | Validates GHES_PAT, GHEC_PAT, and OS-specific Azure storage connection string env var before proceeding. |
| src/OctoshiftCLI.IntegrationTests/BbsToGithub.cs | Validates BBS creds, GHEC_PAT, and OS-specific Azure storage connection string env var before proceeding. |
| src/OctoshiftCLI.IntegrationTests/AdoToGithub.cs | Validates ADO PAT env var (configurable) plus GHEC_PAT before initializing ADO/GitHub clients. |
Unit Test Results 1 files 1 suites 10m 25s ⏱️ Results for commit dfef1ad. ♻️ This comment has been updated with latest results. |
Add TestHelper.AssertCredentialsPresent() that validates required environment variables are set and non-empty at test construction time. Each integration test class now calls this before making any API calls, producing an immediate, actionable error message identifying which GitHub Actions secret needs rotating.
c18ab83 to
dfef1ad
Compare
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.
Add TestHelper.AssertCredentialsPresent() that validates required environment variables are set and non-empty at test construction time. Each integration test class now calls this before making any API calls, producing an immediate, actionable error message identifying which GitHub Actions secret needs rotating.
ThirdPartyNotices.txt(if applicable)