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] Tus tests for uploading to shared files with checksums #38484

Merged
merged 2 commits into from
Mar 11, 2021

Conversation

swoichha
Copy link
Contributor

@swoichha swoichha commented Mar 9, 2021

Description

This PR adds tests for:

  • Uploading to shared files

Related Issue

How Has This Been Tested?

  • 🤖

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • 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:
  • Changelog item, see TEMPLATE

Copy link
Contributor

@Talank Talank left a comment

Choose a reason for hiding this comment

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

LGTM

When user "Brian" creates a new TUS resource on the WebDAV API with these headers:
| Tus-Resumable | 1.0.0 |
| Upload-Length | 16 |
| Upload-Metadata | filename L1NoYXJlcy9GT0xERVIvdGV4dGZpbGUudHh0 |
Copy link
Contributor

Choose a reason for hiding this comment

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

it is hard to understand the encrypted name and would have been better if there is a comment somewhere that says what is the actual name of this file.
But, that's just a suggestion. Everything looks good to me anyway. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The encrypted file name can be seen here https://github.com/owncloud/core/pull/38484/files#diff-0613ee3f838a6348f280cfa6593798e61953aea15b0fb94b85d92335095700d9R91.

So far for all the tests we haven't mentioned the encrypted file name(which is sent as metadata to created the file) in any comments so I don't if we should or shouldn't do it. @individual-it what do you think about this idea of mentioning encrypted filename in a comment?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to mention. maybe let's have an other PR doing that for all places

Copy link
Member

@individual-it individual-it left a comment

Choose a reason for hiding this comment

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

please also add tests where

  • the sharer upload a file in a shared folder and the receiver checks the checksum with propfind and in the header
  • upload with other checksum types
  • upload with chucks to a share (from both sides)
  • upload wrong checkssums (from both sides)

if you like some or all of those things could go in a separate PR

| Tus-Resumable | 1.0.0 |
| Tus-Version | 1.0.0 |
| Tus-Extension | creation,creation-with-upload,checksum |
| Tus-Checksum-Algorithm | md5,sha1,adler32 |
Copy link
Member

Choose a reason for hiding this comment

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

these tests are good, but IMO don't belong into this PR as it claims to be about shares

| Upload-Metadata | filename L1NoYXJlcy9GT0xERVIvdGV4dGZpbGUudHh0 |
And user "Brian" uploads file with checksum "MD5 827ccb0eea8a706c4c34a16891f84e7b" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API
Then as "Alice" file "/FOLDER/textfile.txt" should exist
And the content of file "/FOLDER/textfile.txt" for user "Alice" should be "uploaded content"
Copy link
Member

Choose a reason for hiding this comment

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

checking the checksum in header and by webdav would be useful

Copy link
Contributor

@dpakach dpakach left a comment

Choose a reason for hiding this comment

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

apart from everything mentioned already looks good

@swoichha swoichha force-pushed the tusTests-checksum-shared-file branch from 7fe3b9b to 397386d Compare March 10, 2021 08:43
@swoichha swoichha requested a review from Talank March 10, 2021 08:43
@swoichha
Copy link
Contributor Author

please also add tests where

  • the sharer upload a file in a shared folder and the receiver checks the checksum with propfind and in the header
  • upload with other checksum types
  • upload with chucks to a share (from both sides)
  • upload wrong checkssums (from both sides)

if you like some or all of those things could go in a separate PR

@individual-it I have added all these tests and removed changes done in tests for OPTIONS request, I will add them back later on new PR as this PR claims to be about shares.

And user "Alice" has created a new TUS resource on the WebDAV API with these headers:
| Upload-Length | 5 |
| Upload-Metadata | filename L0ZPTERFUi90ZXh0RmlsZS50eHQ= |
And user "Alice" uploads file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513954" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
And user "Alice" uploads file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513954" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API
When user "Alice" uploads file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513954" to the last created TUS Location with offset "0" and content "uploaded content" using the TUS protocol on the WebDAV API

I think this is supposed to be a When step

@swoichha swoichha requested a review from Talank March 10, 2021 09:23
@swoichha swoichha force-pushed the tusTests-checksum-shared-file branch from 397386d to bd4b4fb Compare March 10, 2021 09:23
Copy link
Contributor

@Talank Talank left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@swoichha swoichha force-pushed the tusTests-checksum-shared-file branch from bd4b4fb to 0abc926 Compare March 10, 2021 10:29
@swoichha swoichha force-pushed the tusTests-checksum-shared-file branch from 7d0ebfa to 51fafc8 Compare March 11, 2021 03:33
@sonarcloud
Copy link

sonarcloud bot commented Mar 11, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@swoichha swoichha merged commit d90b702 into master Mar 11, 2021
@delete-merged-branch delete-merged-branch bot deleted the tusTests-checksum-shared-file branch March 11, 2021 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants