-
-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The test case TestNew/No_Error_for_missing_token expects that creating a GitHub client without a token should not return an error (wantErr: false), but it currently fails with:
--- FAIL: TestNew (0.28s)
--- FAIL: TestNew/No_Error_for_missing_token (0.00s)
main_test.go:261:
Error Trace: /Users/josill/Desktop/Projects/updatecli/pkg/plugins/scms/github/main_test.go:261
Error: Received unexpected error:
creating GitHub client: github token is not set
Test: TestNew/No_Error_for_missing_token
Code Location:
pkg/plugins/scms/github/main_test.go:230-251- Test case definitionpkg/plugins/scms/github/client/main.go:72-77- Token validation logic that returns error
Expected Behavior
The test No_Error_for_missing_token expects that New() should succeed even without a token. However, the current implementation requires a token to create a GitHub client.
There are two possible resolutions:
Option A: The test expectation is incorrect and should be updated to match current behavior:
- Change
wantErr: falsetowantErr: truefor the "No Error for missing token" test - Update test name to reflect that an error is expected (e.g., "Error for missing token")
Option B: The implementation should allow creating a GitHub instance without a token:
- Modify
client.New()to return a client withniltoken source when no token is provided - Handle nil token cases in subsequent operations (may require changes throughout the codebase)
- This would allow creating a GitHub client for read-only operations or when token is provided later
Steps To Reproduce
-
Run the GitHub SCM plugin tests:
cd /Users/josill/Desktop/Projects/updatecli go test ./pkg/plugins/scms/github -v
-
Observe the test failure:
- Test
TestNew/No_Error_for_missing_tokenfails with "github token is not set" error
- Test
Environment
- **OS**: macOS (Darwin 24.6.0, ARM64) - but this issue likely affects all platforms
- **Go Version**: go1.25.5 darwin/arm64
- **Test Command**: `go test ./pkg/plugins/scms/github`Pipeline Graph
Anything else?
I think this happens only in local environment since it isnt an error in pipeline tests...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Todo