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

api: return 404 for alloc FS list/stat endpoints #11482

Merged
merged 2 commits into from
Nov 17, 2021
Merged

api: return 404 for alloc FS list/stat endpoints #11482

merged 2 commits into from
Nov 17, 2021

Conversation

tgross
Copy link
Member

@tgross tgross commented Nov 9, 2021

Fixes #11480

If the alloc filesystem doesn't have a file requested by the List Files (/v1/client/fs/ls) or Stat File API (/v1/client/fs/stat), we currently return a HTTP 500 error with the expected "file not found" error message. Return a HTTP 404 error instead.

This change doesn't help the streaming endpoints, but all our callers currently call the /v1/client/fs/stat endpoint first.

@tgross tgross added this to the 1.2.1 milestone Nov 9, 2021
If the alloc filesystem doesn't have a file requested by the List
Files or Stat File API, we currently return a HTTP 500 error with the
expected "file not found" error message. Return a HTTP 404 error
instead.
@tgross
Copy link
Member Author

tgross commented Nov 9, 2021

This missed 1.2.0-rc1, so leaving this in draft state until after the 1.2.0 GA goes out.

@DerekStrickland
Copy link
Contributor

With the help of the UI team, I tracked down some UI related code and acceptance tests that I think will have to change or be deleted along with or shortly after this PR. cc @ChaiWithJai @lgfa29

@tgross
Copy link
Member Author

tgross commented Nov 9, 2021

I can follow-up with @ChaiWithJai and try my hand at a little bit of UI work 😀

@ChaiWithJai
Copy link
Contributor

I can follow-up with @ChaiWithJai and try my hand at a little bit of UI work 😀

I'm on it!

@github-actions
Copy link

github-actions bot commented Nov 12, 2021

Ember Asset Size action

As of 5431400

Files that got Smaller 🎉:

File raw gzip
nomad-ui.js -68 B -39 B

Files that stayed the same size 🤷‍:

File raw gzip
vendor.js 0 B 0 B
nomad-ui.css 0 B 0 B
vendor.css 0 B 0 B

@github-actions
Copy link

github-actions bot commented Nov 12, 2021

Ember Test Audit comparison

main 5431400 change
passes 1199 1199 0
failures 0 0 0
flaky 0 0 0
duration 9m 42s 043ms 8m 16s 328ms -1m 25s 715ms

@github-actions
Copy link

Ember Test Audit flaky tests

Ember Test Audit detected these flaky tests on main:

  • Acceptance | task group detail: /jobs/:id/:task-group second breadcrumb should link to the job for the task group

Ember Test Audit detected these flaky tests on 70acdb6:

  • Acceptance | task group detail: /jobs/:id/:task-group second breadcrumb should link to the job for the task group
  • Integration | Component | TopoViz: clicking on an allocation in a deeply nested TopoViz::Node will associate sibling allocations with curves
  • Integration | Component | TopoViz: when the count of sibling allocations is high enough relative to the node count, curves are not rendered
  • Integration | Utility | exec-socket-xterm-adapter: resizing the window passes a resize message through the socket

Previously the FS handler would interpret a 500 status as a 404
in the adapter layer by checking if the response body contained
the text  or is the response status
was 500 and then throw an error code for 404.
@tgross
Copy link
Member Author

tgross commented Nov 17, 2021

The UI changes LGTM but it's my PR so I can't be the one to approve it 😀

Copy link
Contributor

@DerekStrickland DerekStrickland left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

Sorry, late to the party 😅

Minor comment on the tests, but definitely not a blocker. But maybe something we should fix in a follow-up PR.

@@ -361,7 +361,8 @@ export default function browseFilesystem({
...visitSegments({ allocation: this.allocation, task: this.task }),
path: '/what-is-this',
});
assert.equal(FS.error.title, 'Not Found', '500 is interpreted as 404');
assert.notEqual(FS.error.title, 'Not Found', '500 is not interpreted as 404');
assert.equal(FS.error.title, 'Server Error', '500 is not interpreted as 500');
Copy link
Contributor

@lgfa29 lgfa29 Nov 17, 2021

Choose a reason for hiding this comment

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

These tests are a bit weird to me. Since the API now returns a proper 404, the endpoint stub should've been changed to return a 404 as well instead.

The two asserts are also kind of redundant. If one passes, the other will not fail since the error title can't be equal to two things at the same time.

@github-actions
Copy link

github-actions bot commented Nov 8, 2022

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling Stat on a non existent file returns 500 rather than 404
4 participants