-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Rajat] Add Github client to fetch latest release of proctor #78
[Rajat] Add Github client to fetch latest release of proctor #78
Conversation
@RajatVaryani wrapping the github client inside a struct is a good enough approach. see if you can reverse engineer the http call and mock it, else leave the testing of github client code. Just inject the wrapper struct, mock it in application code's tests and you're good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RajatVaryani requested one change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new change request
cmd/version/github/client.go
Outdated
return &client{github.NewClient(nil)} | ||
} | ||
|
||
func (gc *client) LatestRelease(owner, repository string) (*github.RepositoryRelease, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of returning '*github.RepositoryRelease' in the LatestRelease function, you can return string directly. Then in the caller you can directly use the value instead of '*release.TagName' in version.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The PR references #55. I am using a mature github client. The only pitfall with the library is that mocking is not easy as the github client does not expose any interfaces. This is a draft PR suggesting that. @olttwa How should we go forward with this?