Skip to content

[QA] Fail api test while checking status code #1636

Closed

Description

@prashant-gurung899

The following scenario has been failing frequently with status code check failure:
Check builds:
https://ci.opencloud.eu/repos/3/pipeline/585/487
https://ci.opencloud.eu/repos/3/pipeline/582/505
https://ci.opencloud.eu/repos/3/pipeline/580/505

Scenario Outline: send last chunk twice                                                                                   # /woodpecker/src/github.com/opencloud-eu/opencloud/tests/acceptance/features/coreApiWebdavUploadTUS/lowLevelUpload.feature:45
    Given using <dav-path-version> DAV path                                                                                 # FeatureContext::usingOldOrNewOrSpacesDavPath()
    And user "Alice" has created a new TUS resource on the WebDAV API with these headers:                                   # TUSContext::userHasCreatedNewTUSResourceWithHeaders()
      | Upload-Length   | 10                    |
      | Upload-Metadata | filename ZmlsZS50eHQ= |
    When user "Alice" sends a chunk to the last created TUS Location with offset "0" and data "123" using the WebDAV API    # TUSContext::userSendsAChunkToTUSLocationWithOffsetAndData()
    And user "Alice" sends a chunk to the last created TUS Location with offset "3" and data "4567890" using the WebDAV API # TUSContext::userSendsAChunkToTUSLocationWithOffsetAndData()
    And user "Alice" sends a chunk to the last created TUS Location with offset "3" and data "0000000" using the WebDAV API # TUSContext::userSendsAChunkToTUSLocationWithOffsetAndData()
    Then the HTTP status code should be "404"                                                                               # FeatureContext::thenTheHTTPStatusCodeShouldBe()
    And the content of file "/file.txt" for user "Alice" should be "1234567890"                                             # FeatureContext::contentOfFileForUserShouldBe()

    Examples:
      | dav-path-version |
      | old              |
      | new              |
      | spaces           |
        Failed step: Then the HTTP status code should be "404"
        HTTP status code 409 is not the expected value 404
        Failed asserting that 409 matches expected '404'.

Also listed here: opencloud-eu/qa#50

CC @individual-it @ScharfViktor

Activity

  1. individual-it commented on Oct 10, 2025

    @individual-it
    Contributor

    Here what the TUS protocol description says:

    ...
    The Upload-Offset header’s value MUST be equal to the current offset of the resource. In order to achieve parallel upload the Concatenation extension MAY be used. If the offsets do not match, the Server MUST respond with the 409 Conflict status without modifying the upload resource.
    ...
    If the server receives a PATCH request against a non-existent resource it SHOULD return a 404 Not Found status.

    Here my guess what happens:

    1. TUS resource is created
    2. first chunk is send => 204
    3. second chunk is send => 204
    4. mostly the server is fast enough, deletes the TUS resource and replies correctly with 404, but sometimes the TUS resource still exists and then the server replies with 409

    not sure who knows about that codepath @rhafer @micbar @aduffeck , do you think the assumption above is correct? If so I would suggest to accept both 404 and 409 in this test. Alternatively we could wait and retry till eventually 404 is returned because the resource does not exist anymore

  2. individual-it commented on Dec 8, 2025

    @individual-it
    Contributor

    @rhafer @micbar @aduffeck what should we do here?

  3. rhafer commented on Dec 8, 2025

    @rhafer
    Member

    do you think the assumption above is correct?

    Yes.

    If so I would suggest to accept both 404 and 409 in this test. Alternatively we could wait and retry till eventually 404 is returned because the resource does not exist anymore

    If you want to keep the check for the final content of the file I think the correct fix would be to wait for the 404.

    It might make sense to introduce another test to check for the 409 by sending 5 or 6 bytes with offset 3 multiple times.

  4. self-assigned this
    on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions