unstorage icon indicating copy to clipboard operation
unstorage copied to clipboard

feat(azure-storage-blob): add raw support

Open peterbud opened this issue 1 year ago • 7 comments

This PR adds raw item get/set support, similar to abandoned #442, but also adds test for that new procedures.

Also I have noticed that the current removeItem test fails, as delete operation with non-existent keys leads to an error. I assume the intention is not to fail in such cases, so I have not changed the removeItem test, but added a check before attempting to delete the blob at the Azure Blob driver.

peterbud avatar Jan 04 '25 14:01 peterbud

Codecov Report

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

Project coverage is 59.63%. Comparing base (4d61c78) to head (5a56d23). Report is 160 commits behind head on main.

Files with missing lines Patch % Lines
src/drivers/azure-storage-blob.ts 7.14% 26 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #565      +/-   ##
==========================================
- Coverage   65.05%   59.63%   -5.43%     
==========================================
  Files          39       42       +3     
  Lines        4055     3676     -379     
  Branches      487      590     +103     
==========================================
- Hits         2638     2192     -446     
- Misses       1408     1481      +73     
+ Partials        9        3       -6     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 04 '25 20:01 codecov[bot]

Thanks for bringing this up again, I unfortunately missed the PR. Let me go over the tests to validate we are fine here so we can proceed as soon as possible.

itpropro avatar Jan 06 '25 13:01 itpropro

Hi @itpropro , is there any update on your review please?

peterbud avatar Jan 13 '25 07:01 peterbud

Hi @itpropro , is there any update on your review please?

Hey, I added some additions to improve test coverage. Thanks for also fixing the removeItem inconsistency. Can you explain what the "properly encodes raw items" test covers that is not already covered by the "raw support" test in the test suite? If it covers the same as the internal test, I don't think it's necessary. After that we are good to go from my perspective, I tested the current code against Azurite and an online instance of a storage account.

@pi0 do you thinks it's better to check for the item first and only then delete or to just catch a failed delete to nowhere? I would prefer to silently catch for performance reasons.

itpropro avatar Jan 29 '25 00:01 itpropro

Can you explain what the "properly encodes raw items" test covers that is not already covered by the "raw support" test in the test suite?

I did not know that there is a default raw support test. I have seen that the fs driver has a raw items test, and I assumed this had to be added for drivers which implement these additional methods.

If not needed, then let's remove this test!

peterbud avatar Jan 29 '25 07:01 peterbud

No problem, all drivers use the testDriver test suite as a baseline. That one has a rawItem test here https://github.com/unjs/unstorage/blob/67b09a164fc9734435b29d83ccabcc1b0220389b/test/drivers/utils.ts#L136.

itpropro avatar Jan 29 '25 14:01 itpropro

I removed the redundant test. Should I extract the additional added tests to a separate PR @pi0 ?

itpropro avatar Jan 29 '25 14:01 itpropro

Hi team, is there anything else to be done on this PR to get it merged?

peterbud avatar Apr 17 '25 10:04 peterbud

it all looks good to me

i left one minor comment. we need Pooya to review it now and merge it

43081j avatar Apr 17 '25 12:04 43081j