fix(nvcf-cli): report which auth credentials are missing - #539
fix(nvcf-cli): report which auth credentials are missing#539mesutoezdil wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthrough
ChangesCredential reporting
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
2b87458 to
99275f0
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/clis/nvcf-cli/internal/client/client_test.go (1)
1259-1311: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover successful credential configurations as well.
The current cases only expect failures. Add table entries for
NVCF_API_KEY,NVCF_TOKEN, and complete OAuth2 credentials, assertingLoadConfigsucceeds; otherwise, regressions in the valid-credential branches could pass unnoticed. This aligns with the PR objective to cover both bearer and OAuth2 credential combinations.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/clis/nvcf-cli/internal/client/client_test.go` around lines 1259 - 1311, The TestLoadConfigReportsMissingCredentials table only covers failure paths; add successful cases for NVCF_API_KEY, NVCF_TOKEN, and complete OAuth2 credentials. For each valid configuration, assert LoadConfig returns no error while preserving the existing missing-credential assertions for incomplete setups.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/clis/nvcf-cli/internal/client/client_test.go`:
- Around line 1259-1311: The TestLoadConfigReportsMissingCredentials table only
covers failure paths; add successful cases for NVCF_API_KEY, NVCF_TOKEN, and
complete OAuth2 credentials. For each valid configuration, assert LoadConfig
returns no error while preserving the existing missing-credential assertions for
incomplete setups.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 73792324-98f3-4401-b9ca-fcb1ff198bfe
📒 Files selected for processing (2)
src/clis/nvcf-cli/internal/client/client.gosrc/clis/nvcf-cli/internal/client/client_test.go
99275f0 to
127185b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/clis/nvcf-cli/internal/client/client_test.go`:
- Around line 1268-1280: Update the partial OAuth2 cases in the
credential-validation test table to include both missing credential
requirements: “NVCF_API_KEY or NVCF_TOKEN” and “NVCF_OAUTH2_TOKEN_ENDPOINT”. Add
separate cases omitting NVCF_OAUTH2_CLIENT_ID and NVCF_OAUTH2_CLIENT_SECRET
individually, covering each production validation branch while preserving the
existing complete-configuration case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 07e6b5a7-cc2d-45de-8570-523468194739
📒 Files selected for processing (2)
src/clis/nvcf-cli/internal/client/client.gosrc/clis/nvcf-cli/internal/client/client_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- src/clis/nvcf-cli/internal/client/client.go
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
0c6699a to
5ae1955
Compare
TL;DR
LoadConfigcollects the unset credential variables intomissing, then returns a fixed "set NVCF_API_KEY" message and drops the list. An incomplete OAuth2 setup is told to set an API key. Now the error names the unset variables.QA
go build ./...andgo test ./internal/...clean fromsrc/clis/nvcf-cli;gofmt -lclean on both changed files. The new test fails against the old message.TestLoadConfigAuthCredentialsis a table covering both directions: the failure paths (nothing set, partial OAuth2) assert the error names exactly the unset variables and omits the set ones, and the success paths (NVCF_API_KEY,NVCF_TOKEN, complete OAuth2) assertLoadConfigreturns no error and picks the rightAuthType. The success cases guard the valid-credential branches next to the error branch this PR changes. Renamed fromTestLoadConfigReportsMissingCredentialssince it no longer only covers the missing case.Note:
internal/client/accounts.goandinternal/client/clusters.goare unformatted onmainalready and are left untouched here.Issues
Closes #538
Summary by CodeRabbit