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

stripe login: poll for api key #4

Merged
merged 1 commit into from Jul 1, 2019
Merged

stripe login: poll for api key #4

merged 1 commit into from Jul 1, 2019

Conversation

jmuia-stripe
Copy link
Contributor

Reviewers

r? @ob-stripe @brandonl-stripe
cc @tomer-stripe

Summary

Implements the function to poll for the API key.

A counter for poll attempts is an easier model to implement than a polling timeout.

NB. in a follow-up we can extract the http client rather than simply making the current one public.

@stripe-ci
Copy link

Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

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

Some comments, and I think we need a test for this. Once you make the interval and max attempts values arguments, we can write a test with a short interval and a low max attempts.

You can take a look at e.g. stripeauth/client_test.go for an example of how to mock a server to test a client.

login/poll.go Outdated Show resolved Hide resolved
login/poll.go Outdated Show resolved Hide resolved
client := stripeauth.NewHTTPClient("")

var count = 0
for count < maxAttempts {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should there be a test to verify the polling functionality works right?

@jmuia-stripe
Copy link
Contributor Author

ptal @ob-stripe

@stripe-ci stripe-ci assigned ob-stripe and unassigned jmuia-stripe Jun 27, 2019
Copy link
Contributor

@ob-stripe ob-stripe left a comment

Choose a reason for hiding this comment

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

lgtm!

@ob-stripe
Copy link
Contributor

Sorry for the delay! This looks great, especially the tests!

@ob-stripe ob-stripe merged commit ef548c8 into master Jul 1, 2019
@tomer-stripe tomer-stripe deleted the jmuia.login-poll branch July 15, 2019 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants