-
Notifications
You must be signed in to change notification settings - Fork 325
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
Added accessTier check to download call for BlobHandler.ts to fail on… #2483
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
@@ -80,6 +80,10 @@ export default class BlobHandler extends BaseHandler implements IBlobHandler { | |||
options.modifiedAccessConditions | |||
); | |||
|
|||
if (blob.properties.accessTier === Models.AccessTier.Archive) { | |||
throw StorageErrorFactory.getBlobArchived(context.contextId!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please confirm the error returned here is same as the error return from product Azure server. (status code, error code, error message.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blueww some tests are failing - I will check the failures to see what's causing it.
Updated sas.test.ts test to handle new error.detail.code for Archived…
tests/blob/apis/blob.test.ts
Outdated
@@ -253,6 +253,22 @@ describe("BlobAPIs", () => { | |||
assert.fail(); | |||
}); | |||
|
|||
it("download should not work when blob in Archive tier", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add @loki @sql
as other test cases, to indicate the case can run on both loki and sql.
@@ -2122,7 +2122,7 @@ describe("Shared Access Signature (SAS) authentication", () => { | |||
} | |||
assert.ok(error !== undefined); | |||
assert.equal(error.statusCode, 409); | |||
assert.equal(error.details.code, "BlobArchived"); | |||
assert.equal(error.details.code, "CannotVerifyCopySource"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SQL test case failure on this, looks related with sourceBlob.setAccessTier("Archive");
on line 2113 don't have await, it's async call, without await the access tier might still not convert to archive.
Add await should can resolve the failure.
await sourceBlob.setAccessTier("Archive");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed the case
… archived blobs.
#2473
Thanks for contribution! Please go through following checklist before sending PR.
PR Branch Destination
main
branch.legacy-dev
branch.Always Add Test Cases
Make sure test cases are added to cover the code change.
Add Change Log
Add change log for the code change in
Upcoming Release
section inChangeLog.md
.Development Guideline
Please go to CONTRIBUTION.md for steps about setting up development environment and recommended Visual Studio Code extensions.