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

Make content-type response checks on '/versions` endpoint optional #670

Merged
merged 1 commit into from Jan 15, 2021

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Jan 11, 2021

Closes #668 and closes #669.

  • Fix misleading error message on /versions endpoint validation.
  • Make checks on the header=present and media type parameters of the Content-Type header of /versions completely optional.

@ml-evs ml-evs requested a review from CasperWA as a code owner January 11, 2021 15:10
@ml-evs ml-evs marked this pull request as draft January 11, 2021 15:22
@codecov
Copy link

codecov bot commented Jan 11, 2021

Codecov Report

Merging #670 (fe9a910) into master (5fb7590) will increase coverage by 0.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #670      +/-   ##
==========================================
+ Coverage   93.30%   93.58%   +0.28%     
==========================================
  Files          61       61              
  Lines        3300     3306       +6     
==========================================
+ Hits         3079     3094      +15     
+ Misses        221      212       -9     
Flag Coverage Δ
project 93.58% <100.00%> (+0.28%) ⬆️
validator 66.00% <81.25%> (-0.06%) ⬇️

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

Impacted Files Coverage Δ
optimade/validator/validator.py 84.35% <100.00%> (+2.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fb7590...fe9a910. Read the comment docs.

@ml-evs ml-evs marked this pull request as ready for review January 11, 2021 15:32
@ml-evs
Copy link
Member Author

ml-evs commented Jan 11, 2021

Any objection to me using this PR to disable the codecov status checks appearing in GH actions? We'd still get the coverage report as comment, which is more useful.

It's annoying seeing the ❌ on the main repo page for 0.005% coverage drops, I don't think they ever fixed the problems with the threshold parameter in codecov (namely that it doesn't work).

CasperWA
CasperWA previously approved these changes Jan 11, 2021
Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

Looks alright. Any way to test it?

Also, the two different parts of this PR (validator fix and codecov change) should be merged as a separate commit each.

The suggested changes here are not critical, and even if rejected it can still be merged, hence the approval. If it's updated, I'll approve right away.

optimade/validator/validator.py Outdated Show resolved Hide resolved
optimade/validator/validator.py Outdated Show resolved Hide resolved
@ml-evs
Copy link
Member Author

ml-evs commented Jan 11, 2021

Looks alright. Any way to test it?

Well it now passes for the netlify preview (showing the optional failure) and still passes on all implementations that already had the headers, so think we're okay.

@CasperWA
Copy link
Member

CasperWA commented Jan 11, 2021

Looks alright. Any way to test it?

Well it now passes for the netlify preview (showing the optional failure) and still passes on all implementations that already had the headers, so think we're okay.

Ah you ran it locally for the providers PR? Great! I mean.. it's not a real "test" ... but it'll do ;)

CasperWA
CasperWA previously approved these changes Jan 11, 2021
@ml-evs ml-evs marked this pull request as draft January 11, 2021 17:04
@CasperWA
Copy link
Member

You can merge from the CLI (using --ff-only) or rebase+merge, but I think you might lose the commit verification? No need to create a merge commit.

@ml-evs
Copy link
Member Author

ml-evs commented Jan 11, 2021

Panic reverted this to a draft, following the discussion:

#669 (comment)

@ml-evs
Copy link
Member Author

ml-evs commented Jan 11, 2021

Right, reworked it slightly to allow for this mixed requirement... hopefully no major issues!

@ml-evs ml-evs marked this pull request as ready for review January 11, 2021 20:09
@ml-evs ml-evs requested a review from CasperWA January 11, 2021 20:09
@ml-evs ml-evs changed the title Make header checks on '/versions` optional Make 'header=present' parameter check on '/versions` optional Jan 11, 2021
@ml-evs ml-evs changed the title Make 'header=present' parameter check on '/versions` optional Make content-type response checks on '/versions` endpoint optional Jan 12, 2021
@ml-evs
Copy link
Member Author

ml-evs commented Jan 15, 2021

Any objection to me using this PR to disable the codecov status checks appearing in GH actions? We'd still get the coverage report as comment, which is more useful.

It's annoying seeing the x on the main repo page for 0.005% coverage drops, I don't think they ever fixed the problems with the threshold parameter in codecov (namely that it doesn't work).

Removing the codecov changes here as #672 fixes the threshold for GH status checks

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

Very minor clarifications of error messages.
Still missing a test 😅 (can be merged without, no worries).

optimade/validator/validator.py Outdated Show resolved Hide resolved
optimade/validator/validator.py Outdated Show resolved Hide resolved
@ml-evs
Copy link
Member Author

ml-evs commented Jan 15, 2021

Still missing a test sweat_smile (can be merged without, no worries).

I was actually writing one before I was rudely interrupted by a meeting... you'll see how convoluted it is, even for this simple endpoint, though perhaps this is the most important one to test due to the lack of pydantic models.

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

Just adding all investigated counts for all tests.
And great work on the test!!

tests/validator/test_utils.py Show resolved Hide resolved
tests/validator/test_utils.py Show resolved Hide resolved
tests/validator/test_utils.py Show resolved Hide resolved
tests/validator/test_utils.py Show resolved Hide resolved
tests/validator/test_utils.py Show resolved Hide resolved
- Make checks on type and header parameter in content-type for '/versions' optional additionally allowing 'text/plain' (closes #669)
- Report correct base URL on /versions validation failure (closes #668)
- Added mock tests for /versions in various scenarios
@ml-evs
Copy link
Member Author

ml-evs commented Jan 15, 2021

Resolved and rebased back into one commit, should be good to go! Probably worth a release after this too.

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

Merge away if all checks succeed 👍

@ml-evs ml-evs merged commit 9569362 into master Jan 15, 2021
@ml-evs ml-evs deleted the ml-evs/validator_fixes branch January 15, 2021 17:39
@ml-evs ml-evs added validator Related to the OPTIMADE validator bug Something isn't working enhancement New feature or request labels Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request validator Related to the OPTIMADE validator
Projects
None yet
2 participants