Errors related to testcases #61

Closed
opened 2025-12-28 18:00:01 +00:00 by sami · 1 comment
Owner

Originally created by @tatiana-nspcc on GitHub (Mar 6, 2024).

Originally assigned to: @tatiana-nspcc on GitHub.

When I started to edit Python tests in the testcases repository, I found several mistakes:

Current Behavior & Possible Solution

get_by_attribute:

  • attr_key: fileName - we process the upload correctly (it is added to the container as FileName), but in the get request, it returns as X-Attribute-Filename (due to automatic transformations, and it's unclear if it can be changed), but we expect that the get_by_attribute request will have the correct case (Filename) and here we can make exceptions again for FileName and FilePath if needed.
  • attr_key: file-Name: in get - X-Attribute-File-Name, in get_by_attribute it finds by File-Name, but not by file-Name. Here we can fix it so that it is found by attribute, but it will remain as is in get.
  • attr_key: cat%jpeg: in get - X-Attribute-Cat%jpeg, in get_by_attribute it does not find by cat%25jpeg in any case.

get:

  • And there is also an error that expects a 404 but gets a 400 when the session token is expired.

Expected Behavior

We expect the rest-gw to pass all tests for the http-gw.

Your Environment

NeoFS REST Gateway
Version: 0.7.1
GoVersion: go1.20.6

Originally created by @tatiana-nspcc on GitHub (Mar 6, 2024). Originally assigned to: @tatiana-nspcc on GitHub. <!-- Provide a general summary of the issue in the Title above --> When I started to edit Python tests in the `testcases` repository, I found several mistakes: ## Current Behavior & Possible Solution `get_by_attribute`: * attr_key: `fileName` - we process the upload correctly (it is added to the container as FileName), but in the `get` request, it returns as `X-Attribute-Filename` (due to automatic transformations, and it's unclear if it can be changed), but we expect that the `get_by_attribute` request will have the correct case (`Filename`) and here we can make exceptions again for `FileName` and `FilePath` if needed. * attr_key: `file-Name`: in `get` - `X-Attribute-File-Name`, in `get_by_attribute` it finds by `File-Name`, but not by `file-Name`. Here we can fix it so that it is found by attribute, but it will remain as is in `get`. * attr_key: `cat%jpeg`: in get - `X-Attribute-Cat%jpeg`, in `get_by_attribute` it does not find by `cat%25jpeg` in any case. `get`: * And there is also an error that expects a 404 but gets a 400 when the session token is expired. ## Expected Behavior <!-- Tell us what should happen --> We expect the rest-gw to pass all tests for the http-gw. ## Your Environment NeoFS REST Gateway Version: 0.7.1 GoVersion: go1.20.6
sami 2025-12-28 18:00:01 +00:00
  • closed this issue
  • added the
    bug
    S4
    I4
    U1
    labels
Author
Owner

@tatiana-nspcc commented on GitHub (Mar 13, 2024):

  • attr_key: fileName - we process the upload correctly (it is added to the container as FileName), but in the get request, it returns as X-Attribute-Filename (due to automatic transformations, and it's unclear if it can be changed), but we expect that the get_by_attribute request will have the correct case (Filename) and here we can make exceptions again for FileName and FilePath if needed.

Here we made an exception for FileName and FilePath, but all other attribute keys are transformed to the Canonical MIME Header Key , which corresponds to the format used on upload. That means that if some object was uploaded through another gate or cli with a sTRangE_attr_key it cannot be found by the get_by_attribute in the rest-gw.

  • attr_key: file-Name: in get - X-Attribute-File-Name, in get_by_attribute it finds by File-Name, but not by file-Name. Here we can fix it so that it is found by attribute, but it will remain as is in get.

Fixed as described above.

  • attr_key: cat%jpeg: in get - X-Attribute-Cat%jpeg, in get_by_attribute it does not find by cat%25jpeg in any case.

Now it works. But there was also an issue related to URL quote in testcases where spaces were replaced with "+" symbols. Due to https://datatracker.ietf.org/doc/html/rfc2396 we changed that test (" " -> "%20") in https://github.com/nspcc-dev/neofs-testcases/pull/735

get:

  • And there is also an error that expects a 404 but gets a 400 when the session token is expired.

It was probably a one-time glitch, not reproduced again.

@tatiana-nspcc commented on GitHub (Mar 13, 2024): > * attr_key: `fileName` - we process the upload correctly (it is added to the container as FileName), but in the `get` request, it returns as `X-Attribute-Filename` (due to automatic transformations, and it's unclear if it can be changed), but we expect that the `get_by_attribute` request will have the correct case (`Filename`) and here we can make exceptions again for `FileName` and `FilePath` if needed. Here we made an exception for `FileName` and `FilePath`, but all other attribute keys are transformed to the Canonical MIME Header Key , which corresponds to the format used on upload. That means that if some object was uploaded through another gate or cli with a sTRangE_attr_key it cannot be found by the `get_by_attribute` in the `rest-gw`. > * attr_key: `file-Name`: in `get` - `X-Attribute-File-Name`, in `get_by_attribute` it finds by `File-Name`, but not by `file-Name`. Here we can fix it so that it is found by attribute, but it will remain as is in `get`. Fixed as described above. > * attr_key: `cat%jpeg`: in get - `X-Attribute-Cat%jpeg`, in `get_by_attribute` it does not find by `cat%25jpeg` in any case. Now it works. But there was also an issue related to URL quote in `testcases` where spaces were replaced with "+" symbols. Due to https://datatracker.ietf.org/doc/html/rfc2396 we changed that test (" " -> "%20") in https://github.com/nspcc-dev/neofs-testcases/pull/735 > `get`: > > * And there is also an error that expects a 404 but gets a 400 when the session token is expired. It was probably a one-time glitch, not reproduced again.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-rest-gw#61
No description provided.