Skip to content

Conversation

@amusipatla-wandb
Copy link
Contributor

@amusipatla-wandb amusipatla-wandb commented Nov 7, 2024

Description

This PR adds unit tests and mocks for the azure file transfer download implementation. This specifically tests the following cases:

  1. erroring with invalid reference (not s3 ref)
  2. erroring with an invalid s3 reference (valid format but no object)
  3. downloading an unversioned obj
  4. downloading the given version when it exists
  5. erroring when no version has a matching checksum.
  6. downloading all the items under the reference when uploaded with checksum=False (and so digest = reference)

in particular due to limitations with mocking + overriding clients in tests, this does not include a test for finding and downloading the correct version when versionId not given (and latest obj doesn't have a matching etag), which was included in the s3 unit tests.

  • I updated CHANGELOG.md, or it's not applicable

Testing

How was this PR tested?

@amusipatla-wandb amusipatla-wandb requested a review from a team as a code owner November 7, 2024 16:36
@amusipatla-wandb amusipatla-wandb requested a review from a team November 7, 2024 16:40
return fmt.Errorf("AzureFileTransfer: Download: %s: %w", message, err)
}

type BlobClientWrapper struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added these wrappers because of the self-referential return value of WithVersionId. open to ideas on other ways to deal with that

@codecov
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 49.01961% with 26 lines in your changes missing coverage. Please review.

Project coverage is 68.91%. Comparing base (f03a814) to head (68d93a1).

Files with missing lines Patch % Lines
core/internal/filetransfer/file_transfer_azure.go 48.00% 24 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@                        Coverage Diff                         @@
##           amusipatla/azure-file-transfer    #8801      +/-   ##
==================================================================
+ Coverage                           68.72%   68.91%   +0.19%     
==================================================================
  Files                                 549      549              
  Lines                               58131    58165      +34     
==================================================================
+ Hits                                39949    40086     +137     
+ Misses                              17541    17412     -129     
- Partials                              641      667      +26     
Flag Coverage Δ
func 20.03% <ø> (ø)
system 55.81% <11.76%> (-0.02%) ⬇️
unit 50.72% <41.17%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
core/internal/filetransfer/file_transfers.go 100.00% <100.00%> (ø)
core/internal/filetransfer/file_transfer_azure.go 52.96% <48.00%> (+47.77%) ⬆️

... and 4 files with indirect coverage changes

@amusipatla-wandb amusipatla-wandb changed the base branch from amusipatla/azure-file-transfer to amusipatla/gcs-file-transfer-2 November 13, 2024 22:34
@amusipatla-wandb amusipatla-wandb changed the base branch from amusipatla/gcs-file-transfer-2 to amusipatla/azure-file-transfer-2 November 13, 2024 22:34
@amusipatla-wandb amusipatla-wandb changed the base branch from amusipatla/azure-file-transfer-2 to amusipatla/azure-file-transfer November 13, 2024 22:35
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.

2 participants