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

[tests-only] test: adjust tests related to issue 1667 #9308

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jun 4, 2024

Description

The issue was about test scenarios that send various unusual combinations of paths in the URL that have multiple / characters together - sending paths like /remote.php//dav/spacessomeSpaceId/textfile1.txt

Previously some of these were "crashing" the server and returning 5xx HTTP status codes. But that has been fixed "some time ago". The test scenarios had expectations for various 2xx and 4xx status codes, but the actual exact codes that are returned are a bit different from what was put in the tests. This PR adjusts the expected codes so that they match what really happens.

There are different codes like 200, 201, 204, 400, 404, 412 etc. because these kind of requests are, in a sense, all invalid. But it is also easy for a human to see what is intended by each request, and some server code paths are actually parsing and processing these requests fine, resulting in 2xx codes and the file action being done. Others are rejected, quite rightly, by the server code - the "invalid" format of the path might mean that the server cannot find the resource (404), or rejects the request (412, precondition failed etc.). I think that it is OK that the server responds in slightly different ways to these "bad" things. A least it does not give a 500 response any more.

So this PR makes the test scenarios pass and "document" the current behavior. This way, we will know if some server code change causes a change in any of this behavior - the test scenario(s) will start failing.

I refactored test step theHTTPStatusCodeOfResponsesOnEachEndpointShouldBe so that it better reports what the expected and actual status codes were when there is a problem. That was helpful to me when changing the test scenasrio expectations, and should be helpful to future developers.

Related Issue

How Has This Been Tested?

CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@phil-davis phil-davis self-assigned this Jun 4, 2024
@phil-davis phil-davis force-pushed the adjust-tests-issue-1667 branch 2 times, most recently from e25db19 to a7ed141 Compare June 4, 2024 08:19
@phil-davis phil-davis marked this pull request as ready for review June 4, 2024 08:35
@phil-davis phil-davis requested review from saw-jan and kobergj June 4, 2024 08:35
@phil-davis phil-davis force-pushed the adjust-tests-issue-1667 branch from a7ed141 to 96afdc3 Compare June 4, 2024 08:40
Copy link

sonarqubecloud bot commented Jun 4, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@phil-davis phil-davis merged commit 491e0e5 into master Jun 4, 2024
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the adjust-tests-issue-1667 branch June 4, 2024 09:09
ownclouders pushed a commit that referenced this pull request Jun 4, 2024
[tests-only] test: adjust tests related to issue 1667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using double slash in URL to access a folder gives 501 and other status codes
2 participants