Skip to content

Commit d81e157

Browse files
authored
[storage] Update to use randomUUID (#28026)
### Packages impacted by this PR - @azure/storage-blob - @azure/storage-file-share - @azure-rest/synapse-access-control ### Issues associated with this PR ### Describe the problem that is addressed by this PR Removes UUID package in favor of core-util randomUUID ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
1 parent cf2e157 commit d81e157

File tree

30 files changed

+80
-83
lines changed

30 files changed

+80
-83
lines changed

sdk/storage/perf-tests/storage-blob-track-1/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
"author": "",
99
"license": "ISC",
1010
"devDependencies": {
11+
"@azure/core-util": "^1.6.1",
1112
"@azure/storage-blob": "^10.5.0",
1213
"@azure/test-utils-perf": "file:../../../test-utils/perf/azure-test-utils-perf-1.0.0.tgz",
1314
"@types/node": "^18.0.0",
14-
"@types/uuid": "^8.0.0",
1515
"dotenv": "^16.0.0",
16-
"uuid": "^8.3.0",
1716
"tslib": "^2.0.0",
1817
"rimraf": "^3.0.0",
1918
"ts-node": "^8.3.0",

sdk/storage/perf-tests/storage-blob-track-1/test/download.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { v4 as generateUuid } from "uuid";
4+
import { randomUUID } from "@azure/core-util";
55
import { Aborter, BlobURL, BlockBlobURL } from "@azure/storage-blob";
66
import { PerfOptionDictionary, drainStream } from "@azure/test-utils-perf";
77
import { StorageBlobTest } from "./storageTest.spec";
@@ -17,11 +17,11 @@ export class StorageBlobDownloadTest extends StorageBlobTest<StorageBlobDownload
1717
description: "Size in bytes",
1818
shortName: "sz",
1919
longName: "size",
20-
defaultValue: 10240
21-
}
20+
defaultValue: 10240,
21+
},
2222
};
2323

24-
static blobName = generateUuid();
24+
static blobName = randomUUID();
2525
blockBlobClient: BlockBlobURL;
2626

2727
constructor() {

sdk/storage/perf-tests/storage-blob-track-1/test/listBlobs.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { v4 as generateUuid } from "uuid";
4+
import { randomUUID } from "@azure/core-util";
55
import { Aborter, BlockBlobURL } from "@azure/storage-blob";
66
import { executeParallel, PerfOptionDictionary } from "@azure/test-utils-perf";
77
import { StorageBlobTest } from "./storageTest.spec";
@@ -15,15 +15,15 @@ export class StorageBlobListTest extends StorageBlobTest<StorageBlobListTestOpti
1515
required: true,
1616
description: "Number of blobs to be listed",
1717
longName: "count",
18-
defaultValue: 10
19-
}
18+
defaultValue: 10,
19+
},
2020
};
2121

2222
public async globalSetup() {
2323
await super.globalSetup();
2424
await executeParallel(
2525
async (_count: number, _parallelIndex: number) => {
26-
const blockBlobClient = BlockBlobURL.fromContainerURL(this.containerClient, generateUuid());
26+
const blockBlobClient = BlockBlobURL.fromContainerURL(this.containerClient, randomUUID());
2727
blockBlobClient.upload(Aborter.none, Buffer.alloc(0), 0);
2828
},
2929
this.parsedOptions.count.value!,

sdk/storage/perf-tests/storage-blob-track-1/test/storageTest.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { v4 as generateUuid } from "uuid";
4+
import { randomUUID } from "@azure/core-util";
55
import {
66
Aborter,
77
ContainerURL,
88
ServiceURL,
99
SharedKeyCredential,
10-
StorageURL
10+
StorageURL,
1111
} from "@azure/storage-blob";
1212
import { PerfTest, getEnvVar } from "@azure/test-utils-perf";
1313

@@ -18,7 +18,7 @@ dotenv.config();
1818
export abstract class StorageBlobTest<TOptions> extends PerfTest<TOptions> {
1919
blobServiceClient: ServiceURL;
2020
containerClient: ContainerURL;
21-
static containerName = generateUuid();
21+
static containerName = randomUUID();
2222

2323
constructor() {
2424
super();

sdk/storage/perf-tests/storage-blob-track-1/test/upload.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license.
33

4-
import { v4 as generateUuid } from "uuid";
4+
import { randomUUID } from "@azure/core-util";
55
import { Aborter, BlockBlobURL } from "@azure/storage-blob";
66
import { PerfOptionDictionary } from "@azure/test-utils-perf";
77
import { StorageBlobTest } from "./storageTest.spec";
@@ -19,13 +19,13 @@ export class StorageBlobUploadTest extends StorageBlobTest<StorageBlobUploadTest
1919
description: "Size in bytes",
2020
shortName: "sz",
2121
longName: "size",
22-
defaultValue: 10240
23-
}
22+
defaultValue: 10240,
23+
},
2424
};
2525

2626
constructor() {
2727
super();
28-
this.blobName = generateUuid();
28+
this.blobName = randomUUID();
2929
this.blockBlobClient = BlockBlobURL.fromContainerURL(this.containerClient, this.blobName);
3030
this.buffer = Buffer.alloc(this.parsedOptions.size.value!);
3131
}

sdk/storage/perf-tests/storage-blob/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
"license": "ISC",
1010
"dependencies": {
1111
"@azure/core-rest-pipeline": "^1.1.0",
12-
"@azure/core-util": "^1.3.2",
12+
"@azure/core-util": "^1.6.1",
1313
"@azure/storage-blob": "^12.23.0-beta.1",
1414
"@azure/test-utils-perf": "^1.0.0",
15-
"dotenv": "^16.0.0",
16-
"uuid": "^8.3.0"
15+
"dotenv": "^16.0.0"
1716
},
1817
"devDependencies": {
19-
"@types/uuid": "^8.0.0",
2018
"@types/node": "^18.0.0",
2119
"@types/node-fetch": "^2.5.0",
2220
"eslint": "^8.0.0",

sdk/storage/perf-tests/storage-blob/test/utils/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT license.
3+
14
export function getValueInConnString(
25
connectionString: string,
36
argument:

sdk/storage/perf-tests/storage-file-datalake/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
"author": "",
99
"license": "ISC",
1010
"dependencies": {
11+
"@azure/core-util": "^1.6.1",
1112
"@azure/storage-file-datalake": "^12.11.0-beta.2",
1213
"@azure/test-utils-perf": "^1.0.0",
13-
"dotenv": "^16.0.0",
14-
"uuid": "^8.3.0"
14+
"dotenv": "^16.0.0"
1515
},
1616
"devDependencies": {
17-
"@types/uuid": "^8.0.0",
1817
"@types/node": "^18.0.0",
1918
"eslint": "^8.0.0",
2019
"prettier": "^2.5.1",

sdk/storage/perf-tests/storage-file-datalake/test/append.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import { PerfOptionDictionary } from "@azure/test-utils-perf";
55
import { StorageDFSTest } from "./storageTest.spec";
66
import { DataLakeFileClient } from "@azure/storage-file-datalake";
7-
import { v4 as generateUuid } from "uuid";
7+
import { randomUUID } from "@azure/core-util";
8+
89
interface StorageDFSAppendTestOptions {
910
size: number;
1011
}
@@ -24,7 +25,7 @@ export class StorageDFSAppendTest extends StorageDFSTest<StorageDFSAppendTestOpt
2425

2526
constructor() {
2627
super();
27-
this.fileClient = this.directoryClient.getFileClient(generateUuid());
28+
this.fileClient = this.directoryClient.getFileClient(randomUUID());
2829
this.buffer = Buffer.alloc(this.parsedOptions.size.value!);
2930
}
3031

sdk/storage/perf-tests/storage-file-datalake/test/read.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import { drainStream, PerfOptionDictionary } from "@azure/test-utils-perf";
55
import { StorageDFSTest } from "./storageTest.spec";
66
import { DataLakeFileClient } from "@azure/storage-file-datalake";
7-
import { v4 as generateUuid } from "uuid";
7+
import { randomUUID } from "@azure/core-util";
8+
89
interface StorageDFSReadTestOptions {
910
size: number;
1011
}
@@ -19,7 +20,7 @@ export class StorageDFSReadTest extends StorageDFSTest<StorageDFSReadTestOptions
1920
defaultValue: 1024,
2021
},
2122
};
22-
static fileName = generateUuid();
23+
static fileName = randomUUID();
2324
fileClient: DataLakeFileClient;
2425

2526
constructor() {

0 commit comments

Comments
 (0)