Skip to content
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

Merged
merged 3 commits into from
Mar 26, 2019

Conversation

RajatVaryani
Copy link
Contributor

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?

@olttwa
Copy link
Member

olttwa commented Feb 18, 2019

@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.

@RajatVaryani RajatVaryani marked this pull request as ready for review February 20, 2019 13:25
@RajatVaryani
Copy link
Contributor Author

@jensoncs @olttwa Can you please review the PR?

@RajatVaryani
Copy link
Contributor Author

@jensoncs @olttwa Bumping up!

Copy link
Contributor

@jensoncs jensoncs left a 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.

cmd/version/version_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jensoncs jensoncs left a 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

return &client{github.NewClient(nil)}
}

func (gc *client) LatestRelease(owner, repository string) (*github.RepositoryRelease, error) {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jensoncs jensoncs merged commit 1517ace into gojek:master Mar 26, 2019
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