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

Add support for context #276

Merged
merged 6 commits into from
May 3, 2020

Conversation

suhaibmujahid
Copy link
Contributor

@suhaibmujahid suhaibmujahid commented Apr 24, 2020

PR Description

This PR is in response to the changes requested by @ghostsquad in #182.

What does this fix or add?
It adds support for context in all of the API requests.

Checklist

@suhaibmujahid suhaibmujahid force-pushed the support-context branch 3 times, most recently from 3428339 to b39c862 Compare April 24, 2020 08:35
@ghostsquad
Copy link
Contributor

@suhaibmujahid this is great! thank you. I'll be reviewing this over the weekend.

@suhaibmujahid
Copy link
Contributor Author

@ghostsquad great, please let me know if you want me to perform any changes.

Copy link
Owner

@andygrunwald andygrunwald left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your time and effort @suhaibmujahid.
This PR is huge and moves the project into a better direction.

I went through it and made a few comments. I am sure I missed a few spots. You know how it is when such a big PR lands ("it is fine" ;)).

Two topics are coming into my mind, reviewing this (next to the comments):
Godocs
Nearly all comments are renamed from <NAME> to <NAME>WithContext. The godoc is not adjusted, means, it still says // <NAME> ..... This leads to complaining go tooling because the comments don't start with // <NAME>WithContext .....
Do you see any possibility that we can get this adjusted?

Unit tests
We don't have a single unit test for the <NAME>WithContext functions.
As far as I can see, they are simply copies and are implicit tested by the original unit tests.
But from my experience, bugs can happen everywhere. Not sure if we should copy all unit tests if this is useful or ends up in bloat code.
What do you think about this?


Additionally, I merged a few other PRs in the meantime which leads to a small merge conflict.
Can you resolve this?

Thanks again. Much appreciated!

issue.go Outdated Show resolved Hide resolved
jira.go Outdated Show resolved Hide resolved
issuelinktype.go Outdated Show resolved Hide resolved
issuelinktype.go Outdated Show resolved Hide resolved
request_legacy.go Show resolved Hide resolved
request_context.go Show resolved Hide resolved
metaissue.go Outdated Show resolved Hide resolved
suhaibmujahid and others added 2 commits May 3, 2020 07:08
Co-authored-by: Andy Grunwald <andygrunwald@gmail.com>
@suhaibmujahid
Copy link
Contributor Author

Thank you @andygrunwald for the code review.

I did rebase based on the master, solve the conflicts, fixed the comments for Godocs, and incorporated your other suggestions.

For unit tests, I do not think we need to do anything for now for the following reasons:

  1. All the WithContext functions are implicit tested by the original unit tests as you mentioned.
  2. The functions will be renamed in v2 to remove the WithContext suffixes as proposed originally by @ghostsquad (I suggest to keep NewRequestWithContext since it match the standard http package).
  3. I do not think the new tests will add any value if we just copy the old tests and call them with context.Background() since this is what already happening now.

Thanks again!

@andygrunwald
Copy link
Owner

Thanks @suhaibmujahid.
Looks good to me. I will go ahead and merge it.

From now, I don't see anything that we will break. If we break something, we will either fix it and move forward or roll it back and see what happens. In the end, it is still a huge PR.

Thanks a lot for your effort here.
I would be curious to get your experience from your application use case, using the new lib with context support.

@andygrunwald andygrunwald merged commit e1f4265 into andygrunwald:master May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants