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

pytest-api test: fix ping server step #997

Merged

Conversation

odulcy-mindee
Copy link
Collaborator

@odulcy-mindee odulcy-mindee commented Jul 26, 2022

This PR aims two solve problems:

  • to fix this error on CI : https://github.com/mindee/doctr/runs/7517599231?check_suite_focus=true
    curl command in CI is run but the API is not fully ready so the Ping server step often failed. There is an option --retry-all-errors since curl 7.71.0 but there is only curl 7.68.0 on ubuntu-latest (which is ubuntu 20.04) and that's not that simple to update curl to this version.
    I replaced curl by wget with option --spider.
    From man page:
--spider
When invoked with this option, Wget will behave as a Web spider, which means that it will not download the pages, just check that they are there.

charlesmindee
charlesmindee previously approved these changes Jul 26, 2022
Copy link
Collaborator

@charlesmindee charlesmindee left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@odulcy-mindee
Copy link
Collaborator Author

Work on Ping server step also done here: #985

@felixdittrich92
Copy link
Contributor

@frgfm

@felixdittrich92
Copy link
Contributor

Hi @odulcy-mindee I think both PR's will not solve the under issue mentioned by users it is only a fix for CI 😅

@odulcy-mindee
Copy link
Collaborator Author

@felixdittrich92 Yeah, I just discovered that haha

@odulcy-mindee
Copy link
Collaborator Author

A deprecated decorator from pytest_asyncio induced failures on this step: https://github.com/mindee/doctr/runs/7522290771?check_suite_focus=true.

There has been a new release on pytest_asyncio. It requires to update the decorators. See a similar problem here pytest-dev/pytest-asyncio#390.

@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #997 (6385990) into main (23d1a1e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #997   +/-   ##
=======================================
  Coverage   94.85%   94.85%           
=======================================
  Files         134      134           
  Lines        5558     5558           
=======================================
  Hits         5272     5272           
  Misses        286      286           
Flag Coverage Δ
unittests 94.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
doctr/transforms/functional/base.py 95.65% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

@felixdittrich92
Copy link
Contributor

@odulcy-mindee I think to solve this issue we should add tests for different envs (Linux, Windows, Mac) wdyt ? I have had some trouble to solve it in fact that i was not able to reproduce the issue :)

@frgfm frgfm self-assigned this Jul 26, 2022
@frgfm frgfm added ext: api Related to api folder type: bug Something isn't working topic: ci Related to CI labels Jul 26, 2022
@frgfm frgfm added this to the 0.5.2 milestone Jul 26, 2022
@frgfm
Copy link
Collaborator

frgfm commented Jul 26, 2022

Hey everyone 👋

Here are my humble thoughts about this:

  • for multi-OS testing, I think that would clutter the CI. This type of API is usually run on a Docker or similar isolated environment, so it makes sense that this is run a Linux-based docker
  • about the underlying steps, I've started checking the proper version specifier range for all our dependencies on the API, the underlying issue should be fixed soon :)
  • regarding the arg deprecation of pytest_asyncio, I've also experienced this on other projects, I'll fix this 👍

No need to close this PR, there are a few things we'll need 👌

@odulcy-mindee
Copy link
Collaborator Author

Ok, I was able to reproduce #847 on my Linux.

As @frgfm said, I think that it's still fine to test only on a Linux-based container. I'll continue to investigate the dependencies issues.

@felixdittrich92
Copy link
Contributor

Nice 👍 @frgfm has also something dependency related open in #957

@odulcy-mindee
Copy link
Collaborator Author

@felixdittrich92 @frgfm The problem is coming from Tuples on fastapi, see tiangolo/fastapi#4168, tiangolo/fastapi#3782 and tiangolo/fastapi#3665 (comment).

I tested fastapi>=0.73.0 and it worked 🥳

Copy link
Contributor

@felixdittrich92 felixdittrich92 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 looks good for me :)
@frgfm wdyt?

@odulcy-mindee
Copy link
Collaborator Author

@felixdittrich92 Yes, you're right, I'll add a small note in requirements.txt

Copy link
Contributor

@felixdittrich92 felixdittrich92 left a comment

Choose a reason for hiding this comment

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

Thanks :)

@felixdittrich92 felixdittrich92 merged commit 7d25563 into mindee:main Jul 29, 2022
@felixdittrich92 felixdittrich92 mentioned this pull request Jul 29, 2022
14 tasks
Copy link
Collaborator

@frgfm frgfm left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!
I'll check whether we can afford a looser version specifier (constraining pydantic in this case)

Something I don't get though:

  • since the specifier used to be >=0.65.2, when the docker is built, it was taking the highest version available (I think there is no indirect constraints here), which is 0.79 (0.78 up until recently)
  • so the only reason I can see that this change fixed the bug, is because the docker couldn't reuse the cache.

Is there something I missed? According to the threads, the faulty fastapi version range is within (0.66 - 0.73).

thanks!

Comment on lines -26 to +30
run: curl http://localhost:8002/docs
run: wget --spider --tries=12 http://localhost:$PORT/docs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you remind me the reason of this change? (not familiar with the spider option, the "tries" flag seems explicit)

Copy link
Contributor

Choose a reason for hiding this comment

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

spider does only an 'exist' check and avoid downloading anything

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@frgfm Also, curl has an option --retry-all-errors to retry in any case but this option is only available in latest version of curl which can't be (easily) installed on Ubuntu 20.04. So it may still fail for various reasons that we can't catch. However, wget comes out of the box with a "retry on all errors".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@frgfm Concerning your comment on version, it's a good remark. I didn't changed anything on my side and it didn't install the latest version of fastapi 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext: api Related to api folder topic: ci Related to CI type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doctr api doc error on docker
4 participants