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

[Storage] Async iterator for listing blobs and containers - storage-blob #3136

Merged
Merged
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9524d20
Async iterator for container - listBlobs
HarshaNalluru May 22, 2019
eecb12a
remove iter in the generator
HarshaNalluru May 22, 2019
28e8773
Add marker in the generator
HarshaNalluru May 22, 2019
dc03069
yield -> yield *
HarshaNalluru May 22, 2019
bb41616
Add sample using `.next().value`
HarshaNalluru May 23, 2019
da1afa5
containerClient - *listContainers
HarshaNalluru May 23, 2019
34e3772
udpdate - remove resumable from comment
HarshaNalluru May 23, 2019
eb3b1ca
Addressed comments
HarshaNalluru May 23, 2019
72cd066
Add description for options attribute
HarshaNalluru May 23, 2019
7d7cb2f
remove process.env
HarshaNalluru May 23, 2019
7922584
un-specify the type Models.xxx
HarshaNalluru May 24, 2019
d1cf6d0
remove !options
HarshaNalluru May 24, 2019
c8128b5
rectify indentation
HarshaNalluru May 24, 2019
49c1da6
Merge branch 'AsyncIteratorsStorageBlob' of https://github.com/Harsha…
HarshaNalluru May 24, 2019
c272c6a
listBlobs -> listBlobsFlat
HarshaNalluru May 28, 2019
5b07b44
Add test for ListContainers
HarshaNalluru May 28, 2019
cdd3d2e
remove .only
HarshaNalluru May 28, 2019
43d30c0
Add test for listBlobsFlat
HarshaNalluru May 28, 2019
bc932b3
resolve merge conflicts
HarshaNalluru May 29, 2019
3fb743a
Merge remote-tracking branch 'upstream/feature/storage' into AsyncIte…
HarshaNalluru May 30, 2019
842de33
Add test case for listBlobsFlat - for loop syntax
HarshaNalluru May 30, 2019
d7b7f71
Add test case for listContainers - for loop syntax
HarshaNalluru May 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion sdk/storage/storage-blob/test/containerclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe("ContainerClient", () => {
}
});

it("Verify AsyncIterator for listBlobsFlat", async () => {
it("Verify AsyncIterator(generator .next() syntax) for listBlobsFlat", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

would the special characters ( and ) affect later record and playback test generation?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, they won't. We handled those things gracefully 😊

const blobClients = [];
const prefix = "blockblob";
const metadata = {
Expand Down Expand Up @@ -256,6 +256,38 @@ describe("ContainerClient", () => {
}
});

it("Verify AsyncIterator(for-loop syntax) for listBlobsFlat", async () => {
const blobClients = [];
const prefix = "blockblob";
const metadata = {
keya: "a",
keyb: "c"
};
for (let i = 0; i < 4; i++) {
const blobClient = containerClient.createBlobClient(getUniqueName(`${prefix}/${i}`));
const blockBlobClient = blobClient.createBlockBlobClient();
await blockBlobClient.upload("", 0, {
metadata
});
blobClients.push(blobClient);
}

let i = 0;
for await (const blob of containerClient.listBlobsFlat({
include: ["snapshots", "metadata", "uncommittedblobs", "copy", "deleted"],
prefix,
maxresults: 2
})) {
assert.ok(blobClients[i].url.indexOf(blob.name));
assert.deepStrictEqual(blob.metadata, metadata);
i++;
}

for (const blob of blobClients) {
await blob.delete();
}
});

it("listBlobHierarchySegment with default parameters", async () => {
const blobClients = [];
for (let i = 0; i < 3; i++) {
Expand Down