Skip to content

Integration tests: fast-fail on missing credential env vars#1534

Merged
offbyone merged 1 commit intomainfrom
o1/push-npuqukmlnpmy
Apr 1, 2026
Merged

Integration tests: fast-fail on missing credential env vars#1534
offbyone merged 1 commit intomainfrom
o1/push-npuqukmlnpmy

Conversation

@offbyone
Copy link
Copy Markdown
Contributor

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.

  • Did you write/update appropriate tests
  • Release notes updated (if appropriate)
  • Appropriate logging output
  • Issue linked
  • Docs updated (or issue created)
  • New package licenses are added to ThirdPartyNotices.txt (if applicable)

Copilot AI review requested due to automatic review settings March 31, 2026 14:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Unit Test Results

    1 files      1 suites   10m 25s ⏱️
1 030 tests 1 030 ✅ 0 💤 0 ❌
1 031 runs  1 031 ✅ 0 💤 0 ❌

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.
@offbyone offbyone force-pushed the o1/push-npuqukmlnpmy branch from c18ab83 to dfef1ad Compare March 31, 2026 20:54
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Code Coverage

Package Line Rate Branch Rate Complexity Health
ado2gh 71% 69% 741
gei 81% 73% 608
bbs2gh 83% 78% 667
Octoshift 84% 74% 1819
Summary 81% (7953 / 9843) 74% (1959 / 2665) 3835

Copy link
Copy Markdown
Contributor

@mulana mulana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@offbyone offbyone merged commit 4cf863e into main Apr 1, 2026
57 of 60 checks passed
@offbyone offbyone deleted the o1/push-npuqukmlnpmy branch April 1, 2026 16:41
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.

3 participants