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

Replace status-only network calls in tests with HTTP mocks #149

Closed
lukasschwab opened this issue Oct 25, 2023 · 0 comments · Fixed by #150
Closed

Replace status-only network calls in tests with HTTP mocks #149

lukasschwab opened this issue Oct 25, 2023 · 0 comments · Fixed by #150
Assignees
Labels
enhancement Requests for new features or improvements.

Comments

@lukasschwab
Copy link
Owner

Motivation

A clear and concise description of what the problem is. For example, "I'm always frustrated when..."

teapot.fly.dev is a service I wrote and host — it reimplements the httpstat.us API (mirrors requested HTTP statuses).

It's best to avoid making real network requests in integration tests, especially for services besides the arXiv API (arguably unavoidable):

  • Networking introduces unnecessary test instability.
  • Domain names can change hands; the services they resolve can become malicious.

Solution

A clear and concise description of what you want to happen.

get_code_client should return a client that mocks HTTP responses. I assume there are good solutions for mocking requests.

Considered alternatives

A clear and concise description of any alternative solutions or features you've considered.

#148 replaces httpstat.us; it had all the disadvantages of teapot.fly.dev, with two additional downsides:

  • It has meaningful downtime, which renders tests for this library brittle — teapot.fly.dev should be highly available
  • I have no control over the httpstat.us domain/service

Additional context

Add any other context about the feature request here.

None

@lukasschwab lukasschwab added the enhancement Requests for new features or improvements. label Oct 25, 2023
@lukasschwab lukasschwab self-assigned this Oct 25, 2023
lukasschwab added a commit that referenced this issue Oct 25, 2023
+ Eliminates dependency on teapot.fly.dev; see #148.

+ Fixes #149.

In the future we should store some and mock some arXiv API responses. At
the very least, this offers some backup for when the API is down; of
course, it introduces the risk of divergence from the live API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests for new features or improvements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant