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

Fix latestReleaseTag() unit test #706

Merged
merged 2 commits into from
Sep 10, 2018

Conversation

mik-dass
Copy link
Contributor

@mik-dass mik-dass commented Sep 7, 2018

fixes #704

@cdrage
Copy link
Member

cdrage commented Sep 7, 2018

So.... we're exceeding GitHub's API limit:

	notify_test.go:18: error getting latest release TagName via API, error: GET https://api.github.com/repos/redhat-developer/odo/releases/latest: 403 API rate limit exceeded for 35.184.96.71. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) [rate reset in 19m23s]

Because we're using the API for the test being written... We need to re-work this test.

@ashetty1

@@ -31,8 +31,8 @@ func Test_getLatestReleaseTag(t *testing.T) {

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
releaseTag, _ := getLatestReleaseTag()
if test.success == true {
releaseTag, err := getLatestReleaseTag()
Copy link
Contributor

@anmolbabu anmolbabu Sep 8, 2018

Choose a reason for hiding this comment

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

Can we mock this func instead using something like monkeypatching golang library and avoid genuine api call altogether? More info @ https://github.com/bouk/monkey

Why an actual get call in UT ? I feel if you can mock the expected output tht would be more than sufficient in my opinion

Cc: @cdrage @syamgk

- remove the API call for compairing version
- test getLatestReleaseTag for a valid Version
@surajnarwade
Copy link
Contributor

@syamgk thanks a lot , this LGTM 🎉

@cdrage
Copy link
Member

cdrage commented Sep 10, 2018

This LGTM!

@cdrage cdrage merged commit 11e27cf into redhat-developer:master Sep 10, 2018
mik-dass added a commit to mik-dass/odo that referenced this pull request Oct 17, 2018
* Fix latestReleaseTag() unit test

* rephrase test

- remove the API call for compairing version
- test getLatestReleaseTag for a valid Version
@mik-dass mik-dass deleted the fix_release branch October 18, 2018 08:03
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.

Test_getLatestReleaseTage fails on Travis
5 participants