From 3150ae8c4a419fe14889a65e06d74ed9514ff062 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 13:17:55 +0000 Subject: [PATCH 01/13] [Identity] Performance tests --- common/config/rush/common-versions.json | 6 +- common/config/rush/pnpm-lock.yaml | 24 +++- rush.json | 5 + sdk/identity/perf-tests/identity/CHANGELOG.md | 0 sdk/identity/perf-tests/identity/README.md | 13 +++ sdk/identity/perf-tests/identity/package.json | 48 ++++++++ sdk/identity/perf-tests/identity/sample.env | 10 ++ .../DeviceCodeCredential/persistence.spec.js | 108 ++++++++++++++++++ .../DeviceCodeCredential/persistence.spec.ts | 30 +++++ .../perf-tests/identity/test/index.spec.js | 7 ++ .../perf-tests/identity/test/index.spec.ts | 10 ++ .../perf-tests/identity/tsconfig.json | 0 12 files changed, 257 insertions(+), 4 deletions(-) create mode 100644 sdk/identity/perf-tests/identity/CHANGELOG.md create mode 100644 sdk/identity/perf-tests/identity/README.md create mode 100644 sdk/identity/perf-tests/identity/package.json create mode 100644 sdk/identity/perf-tests/identity/sample.env create mode 100644 sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js create mode 100644 sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts create mode 100644 sdk/identity/perf-tests/identity/test/index.spec.js create mode 100644 sdk/identity/perf-tests/identity/test/index.spec.ts create mode 100644 sdk/identity/perf-tests/identity/tsconfig.json diff --git a/common/config/rush/common-versions.json b/common/config/rush/common-versions.json index c9062f0cd948..3dcd63710a54 100644 --- a/common/config/rush/common-versions.json +++ b/common/config/rush/common-versions.json @@ -63,6 +63,10 @@ "@types/node": ["^10.0.0", "^10.12.0"], // @azure/test-utils-perfstress should depend on lowest version of @azure/core-http for maximum compatibility, allowing test // projects to choose a higher version if desired. - "@azure/core-http": ["^1.0.0"] + "@azure/core-http": ["^1.0.0"], + // Idenity is moving from v1 to v2. Moving all packages to v2 is going to take a bit of time, in the mean time we could use v2 on the perf-identity tests. + "@azure/identity": [ + "^1.1.0", "^2.0.0-beta.1" + ] } } diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 17ef62a9905a..1f09222737f8 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -47,6 +47,7 @@ dependencies: '@rush-temp/perf-ai-form-recognizer': file:projects/perf-ai-form-recognizer.tgz '@rush-temp/perf-ai-text-analytics': file:projects/perf-ai-text-analytics.tgz '@rush-temp/perf-eventgrid': file:projects/perf-eventgrid.tgz + '@rush-temp/perf-identity': file:projects/perf-identity.tgz '@rush-temp/perf-keyvault-certificates': file:projects/perf-keyvault-certificates.tgz '@rush-temp/perf-keyvault-keys': file:projects/perf-keyvault-keys.tgz '@rush-temp/perf-keyvault-secrets': file:projects/perf-keyvault-secrets.tgz @@ -9342,7 +9343,7 @@ packages: optionalDependencies: keytar: 7.4.0 resolution: - integrity: sha512-6a4mBDTUOibIRz2TNwoMtOj1X6tfoe+lkJKk1Y8kOu6gMhqCQwxOPsarleypvs3HsqGVvXurYXFkuINPlKyeAw== + integrity: sha512-Rxclm5Iv5UIw2K8xTPq1P0VexF+rYU1qAEr+/nAPheuL7yzY+R4T54cXnaMwemjlVnpYFv0qTwNl5dz6kZ89HA== tarball: file:projects/identity.tgz version: 0.0.0 file:projects/iot-device-update.tgz: @@ -9415,7 +9416,7 @@ packages: dev: false name: '@rush-temp/keyvault-admin' resolution: - integrity: sha512-YRk0zCoJ01s007eNe07gwSBmheamsYH4taZr+bj4Qry7871DFusWvO90z8rCpM1bju8JBdwYisCoa19/D0EoAg== + integrity: sha512-L7hUgwBQw+msuFgnLHwuQp26YuTs90WiQR88wayzVV2JIeG0fHZCKn6rwNnQWvWGGTE0/ZdcWf7OZmdTTWWXsA== tarball: file:projects/keyvault-admin.tgz version: 0.0.0 file:projects/keyvault-certificates.tgz: @@ -9795,6 +9796,22 @@ packages: integrity: sha512-IQoql5tEhOX/8VOIA+TIl95RGaqZpGF73Xho9DxQuJjcv1vpVKYUFh4tnWlsrFP3P4E64MbDFsVvCPd27mw3dQ== tarball: file:projects/perf-eventgrid.tgz version: 0.0.0 + file:projects/perf-identity.tgz: + dependencies: + '@types/uuid': 8.3.0 + dotenv: 8.2.0 + eslint: 7.22.0 + prettier: 1.19.1 + rimraf: 3.0.2 + ts-node: 9.1.1_typescript@4.2.3 + tslib: 2.1.0 + typescript: 4.2.3 + dev: false + name: '@rush-temp/perf-identity' + resolution: + integrity: sha512-dGWFtEBT8TQxKH65+/OO266Cj2gcGgXT/bdyjq3MCENgBQ5MiD01quuKiPncS1BUA2iEieCvxlE5T5dJvgxWTw== + tarball: file:projects/perf-identity.tgz + version: 0.0.0 file:projects/perf-keyvault-certificates.tgz: dependencies: '@azure/identity': 1.2.4 @@ -9828,7 +9845,7 @@ packages: dev: false name: '@rush-temp/perf-keyvault-keys' resolution: - integrity: sha512-SNFFr2ahj1tJkoCp54GL8F+WghCR+zOco41nIyDOVRTGYgf4txYUgD8aXShnlcvykuHVxwDAmXwm2kkaWVbQMw== + integrity: sha512-SH2hZ0zz7laglE5GD3oux2JLzq7/mE6s9MfwbtVeTNDxqsHnLwPlWdJV0wU+Zl5OMnM0oBVpwhqInAhM4cJdKg== tarball: file:projects/perf-keyvault-keys.tgz version: 0.0.0 file:projects/perf-keyvault-secrets.tgz: @@ -10858,6 +10875,7 @@ specifiers: '@rush-temp/perf-ai-form-recognizer': file:./projects/perf-ai-form-recognizer.tgz '@rush-temp/perf-ai-text-analytics': file:./projects/perf-ai-text-analytics.tgz '@rush-temp/perf-eventgrid': file:./projects/perf-eventgrid.tgz + '@rush-temp/perf-identity': file:./projects/perf-identity.tgz '@rush-temp/perf-keyvault-certificates': file:./projects/perf-keyvault-certificates.tgz '@rush-temp/perf-keyvault-keys': file:./projects/perf-keyvault-keys.tgz '@rush-temp/perf-keyvault-secrets': file:./projects/perf-keyvault-secrets.tgz diff --git a/rush.json b/rush.json index cd0e8b93f64c..81946960e79f 100644 --- a/rush.json +++ b/rush.json @@ -687,6 +687,11 @@ "projectFolder": "sdk/keyvault/perf-tests/keyvault-secrets", "versionPolicyName": "test" }, + { + "packageName": "@azure-tests/perf-identity", + "projectFolder": "sdk/identity/perf-tests/identity", + "versionPolicyName": "test" + }, { "packageName": "@azure/mixedreality-authentication", "projectFolder": "sdk/mixedreality/mixedreality-authentication", diff --git a/sdk/identity/perf-tests/identity/CHANGELOG.md b/sdk/identity/perf-tests/identity/CHANGELOG.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/sdk/identity/perf-tests/identity/README.md b/sdk/identity/perf-tests/identity/README.md new file mode 100644 index 000000000000..454ade231f6d --- /dev/null +++ b/sdk/identity/perf-tests/identity/README.md @@ -0,0 +1,13 @@ +### Guide + +**Important:** +These tests won't work on Node 8 nor Node 15. + +1. Install `@azure/msal-node-extensions@1.0.0-alpha.6` globally with `npm i -g @azure/msal-node-extensions@1.0.0-alpha.6`. +2. Build the Identity perf tests package `rush build -t perf-identity`. +3. Copy the `sample.env` file and name it as `.env`. +4. Populate the `.env` file with your Azure Credentials. +5. Refer to the [rate limits](https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/directory-service-limits-restrictions) and then run the tests as follows: + +- `DeviceCodeCredential` test for the `tokenCachePersistenceOptions`. + - `npm run perf-test:node -- DeviceCodeCredentialPersistenceTest --warmup 1 --iterations 1 --parallel 5` diff --git a/sdk/identity/perf-tests/identity/package.json b/sdk/identity/perf-tests/identity/package.json new file mode 100644 index 000000000000..f33cf73d0e33 --- /dev/null +++ b/sdk/identity/perf-tests/identity/package.json @@ -0,0 +1,48 @@ +{ + "name": "@azure-tests/perf-identity", + "version": "1.0.0", + "description": "", + "main": "", + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@azure/identity": "^2.0.0-beta.1", + "@azure/msal-node-extensions": "^1.0.0-alpha.6", + "@azure/test-utils-perfstress": "^1.0.0", + "dotenv": "^8.2.0" + }, + "devDependencies": { + "@types/uuid": "^8.0.0", + "eslint": "^7.15.0", + "prettier": "^1.16.4", + "rimraf": "^3.0.0", + "ts-node": "^9.0.0", + "tslib": "^2.0.0", + "typescript": "~4.2.0" + }, + "private": true, + "scripts": { + "perf-test:node": "ts-node test/index.spec.ts", + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build": "tsc -p .", + "build:samples": "echo skipped", + "build:test": "echo skipped", + "check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log", + "format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "integration-test": "echo skipped", + "lint:fix": "eslint --no-eslintrc -c ../../../.eslintrc.internal.json package.json test --ext .ts --fix --fix-type [problem,suggestion]", + "lint": "eslint --no-eslintrc -c ../../../.eslintrc.internal.json package.json test --ext .ts", + "pack": "npm pack 2>&1", + "prebuild": "npm run clean", + "unit-test:browser": "echo skipped", + "unit-test:node": "echo skipped", + "unit-test": "echo skipped", + "test:browser": "echo skipped", + "test:node": "echo skipped", + "test": "echo skipped" + } +} diff --git a/sdk/identity/perf-tests/identity/sample.env b/sdk/identity/perf-tests/identity/sample.env new file mode 100644 index 000000000000..cf9fab04a660 --- /dev/null +++ b/sdk/identity/perf-tests/identity/sample.env @@ -0,0 +1,10 @@ +# None of these environment variables are needed while we only have the InteractiveBrowserCredentialPersistenceTest test. +# But they will be useful in the future: +# +# AZURE_TENANT_ID= +# AZURE_CLIENT_ID= +# AZURE_CLIENT_SECRET= +# AZURE_CLIENT_CERTIFICATE_PATH= +# AZURE_USERNAME= +# AZURE_PASSWORD= +# diff --git a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js new file mode 100644 index 000000000000..3d1d40eaa06b --- /dev/null +++ b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js @@ -0,0 +1,108 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +exports.__esModule = true; +exports.DeviceCodeCredentialPersistenceTest = exports.DeviceCodeCredentialTest = void 0; +var test_utils_perfstress_1 = require("@azure/test-utils-perfstress"); +var identity_1 = require("@azure/identity"); +var scope = "https://servicebus.azure.net/.default"; +var DeviceCodeCredentialTest = /** @class */ (function (_super) { + __extends(DeviceCodeCredentialTest, _super); + function DeviceCodeCredentialTest() { + var _this = _super.call(this) || this; + _this.options = {}; + _this.credential = new identity_1.DeviceCodeCredential({ + tokenCachePersistenceOptions: { + name: "nodeTestSilent", + allowUnencryptedStorage: true + } + }); + return _this; + } + DeviceCodeCredentialTest.prototype.globalSetup = function () { + return __awaiter(this, void 0, void 0, function () { + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + _a = this; + return [4 /*yield*/, this.credential.authenticate(scope)]; + case 1: + _a.account = _b.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return DeviceCodeCredentialTest; +}(test_utils_perfstress_1.PerfStressTest)); +exports.DeviceCodeCredentialTest = DeviceCodeCredentialTest; +var DeviceCodeCredentialPersistenceTest = /** @class */ (function (_super) { + __extends(DeviceCodeCredentialPersistenceTest, _super); + function DeviceCodeCredentialPersistenceTest() { + return _super !== null && _super.apply(this, arguments) || this; + } + DeviceCodeCredentialPersistenceTest.prototype.runAsync = function () { + return __awaiter(this, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.credential.getToken(scope)]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + }); + }; + return DeviceCodeCredentialPersistenceTest; +}(DeviceCodeCredentialTest)); +exports.DeviceCodeCredentialPersistenceTest = DeviceCodeCredentialPersistenceTest; diff --git a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts new file mode 100644 index 000000000000..6a61841ce713 --- /dev/null +++ b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts @@ -0,0 +1,30 @@ +import { PerfStressTest } from "@azure/test-utils-perfstress"; +import { DeviceCodeCredential, AuthenticationRecord } from "@azure/identity"; + +const scope = `https://servicebus.azure.net/.default`; + +export abstract class DeviceCodeCredentialTest extends PerfStressTest { + options = {}; + credential: DeviceCodeCredential; + account: AuthenticationRecord; + + constructor() { + super(); + this.credential = new DeviceCodeCredential({ + tokenCachePersistenceOptions: { + name: "nodeTestSilent", + allowUnencryptedStorage: true + } + }); + } + + async globalSetup(): Promise { + this.account = await this.credential.authenticate(scope); + } +} + +export class DeviceCodeCredentialPersistenceTest extends DeviceCodeCredentialTest { + async runAsync(): Promise { + await this.credential.getToken(scope); + } +} diff --git a/sdk/identity/perf-tests/identity/test/index.spec.js b/sdk/identity/perf-tests/identity/test/index.spec.js new file mode 100644 index 000000000000..58cafff6b79a --- /dev/null +++ b/sdk/identity/perf-tests/identity/test/index.spec.js @@ -0,0 +1,7 @@ +"use strict"; +exports.__esModule = true; +var test_utils_perfstress_1 = require("@azure/test-utils-perfstress"); +var persistence_spec_1 = require("./DeviceCodeCredential/persistence.spec"); +console.log("=== Starting the perfStress test ==="); +var perfStressProgram = new test_utils_perfstress_1.PerfStressProgram(test_utils_perfstress_1.selectPerfStressTest([persistence_spec_1.DeviceCodeCredentialPersistenceTest])); +perfStressProgram.run(); diff --git a/sdk/identity/perf-tests/identity/test/index.spec.ts b/sdk/identity/perf-tests/identity/test/index.spec.ts new file mode 100644 index 000000000000..3f54d4f80c3b --- /dev/null +++ b/sdk/identity/perf-tests/identity/test/index.spec.ts @@ -0,0 +1,10 @@ +import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress"; +import { DeviceCodeCredentialPersistenceTest } from "./DeviceCodeCredential/persistence.spec"; + +console.log("=== Starting the perfStress test ==="); + +const perfStressProgram = new PerfStressProgram( + selectPerfStressTest([DeviceCodeCredentialPersistenceTest]) +); + +perfStressProgram.run(); diff --git a/sdk/identity/perf-tests/identity/tsconfig.json b/sdk/identity/perf-tests/identity/tsconfig.json new file mode 100644 index 000000000000..e69de29bb2d1 From 1751aafd40dfe80a0b1cb13679a38a378e90258f Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 13:24:55 +0000 Subject: [PATCH 02/13] removed built .js file --- sdk/identity/perf-tests/identity/.gitignore | 1 + sdk/identity/perf-tests/identity/package.json | 2 +- .../DeviceCodeCredential/persistence.spec.js | 108 ------------------ 3 files changed, 2 insertions(+), 109 deletions(-) create mode 100644 sdk/identity/perf-tests/identity/.gitignore delete mode 100644 sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js diff --git a/sdk/identity/perf-tests/identity/.gitignore b/sdk/identity/perf-tests/identity/.gitignore new file mode 100644 index 000000000000..3598db9de2e4 --- /dev/null +++ b/sdk/identity/perf-tests/identity/.gitignore @@ -0,0 +1 @@ +test/**/*.js diff --git a/sdk/identity/perf-tests/identity/package.json b/sdk/identity/perf-tests/identity/package.json index f33cf73d0e33..037c8460772a 100644 --- a/sdk/identity/perf-tests/identity/package.json +++ b/sdk/identity/perf-tests/identity/package.json @@ -29,7 +29,7 @@ "build:samples": "echo skipped", "build:test": "echo skipped", "check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", - "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log", + "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log test/**/*.js", "format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "echo skipped", "integration-test:node": "echo skipped", diff --git a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js deleted file mode 100644 index 3d1d40eaa06b..000000000000 --- a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -exports.__esModule = true; -exports.DeviceCodeCredentialPersistenceTest = exports.DeviceCodeCredentialTest = void 0; -var test_utils_perfstress_1 = require("@azure/test-utils-perfstress"); -var identity_1 = require("@azure/identity"); -var scope = "https://servicebus.azure.net/.default"; -var DeviceCodeCredentialTest = /** @class */ (function (_super) { - __extends(DeviceCodeCredentialTest, _super); - function DeviceCodeCredentialTest() { - var _this = _super.call(this) || this; - _this.options = {}; - _this.credential = new identity_1.DeviceCodeCredential({ - tokenCachePersistenceOptions: { - name: "nodeTestSilent", - allowUnencryptedStorage: true - } - }); - return _this; - } - DeviceCodeCredentialTest.prototype.globalSetup = function () { - return __awaiter(this, void 0, void 0, function () { - var _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - _a = this; - return [4 /*yield*/, this.credential.authenticate(scope)]; - case 1: - _a.account = _b.sent(); - return [2 /*return*/]; - } - }); - }); - }; - return DeviceCodeCredentialTest; -}(test_utils_perfstress_1.PerfStressTest)); -exports.DeviceCodeCredentialTest = DeviceCodeCredentialTest; -var DeviceCodeCredentialPersistenceTest = /** @class */ (function (_super) { - __extends(DeviceCodeCredentialPersistenceTest, _super); - function DeviceCodeCredentialPersistenceTest() { - return _super !== null && _super.apply(this, arguments) || this; - } - DeviceCodeCredentialPersistenceTest.prototype.runAsync = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.credential.getToken(scope)]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }; - return DeviceCodeCredentialPersistenceTest; -}(DeviceCodeCredentialTest)); -exports.DeviceCodeCredentialPersistenceTest = DeviceCodeCredentialPersistenceTest; From b0f32dde192a38db98ae18e93ae80e3ebeaa4d84 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 13:41:08 +0000 Subject: [PATCH 03/13] The shrinkwrap file was out of date. --- common/config/rush/pnpm-lock.yaml | 89 ++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 1f09222737f8..1ce087c50af6 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -370,6 +370,14 @@ packages: node: '>=0.8.0' resolution: integrity: sha512-Zyus+skNaVWL5fXfSjC17c94XZ95Z3a+bZc7YKkP26KT3Dj26jbfz2oT9KJxAT4XVtH/1WPY/fPFeEFTRvytJQ== + /@azure/msal-common/1.7.2: + dependencies: + debug: 4.3.1 + dev: false + engines: + node: '>=0.8.0' + resolution: + integrity: sha512-3/voCdFKONENX+5tMrNOBSrVJb6NbE7YB8vc4FZ/4ZbjpK7GVtq9Bu1MW+HZhrmsUzSF/joHx0ZIJDYIequ/jg== /@azure/msal-common/2.1.0: dependencies: debug: 4.3.1 @@ -386,6 +394,18 @@ packages: node: '>=0.8.0' resolution: integrity: sha512-EihnqHh2EE6xcB0Dh2LF30jE1Ga9cgh9PyRkX4fj+KpvYfL4ae57hvQwJGkynUgpf3V1xQxU5yaJVXOElfXiGw== + /@azure/msal-node-extensions/1.0.0-alpha.6: + dependencies: + '@azure/msal-common': 1.7.2 + bindings: 1.5.0 + keytar: 7.0.0 + nan: 2.14.2 + dev: false + engines: + node: '>=10' + requiresBuild: true + resolution: + integrity: sha512-fVufHc02C+daYOMAHBnE998abB4qUIeJ9gmTxmSelHhGfBGvvzMbCohCu4sTlSVDKUndF3yD/Nxvw/cEtpcZKg== /@azure/msal-node/1.0.0-beta.6: dependencies: '@azure/msal-common': 4.0.3 @@ -1483,7 +1503,6 @@ packages: integrity: sha512-P009oYkeHyU742iSZJzZZywj4QRJdnTWffaKuJQLablCZ1uz6/cW4yaRgcDaoQ+uwOxxnt0gRUcwfsNP2ri0gw== /aproba/1.2.0: dev: false - optional: true resolution: integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== /archy/1.0.0: @@ -1495,7 +1514,6 @@ packages: delegates: 1.0.0 readable-stream: 2.3.7 dev: false - optional: true resolution: integrity: sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== /arg/4.1.3: @@ -1723,6 +1741,12 @@ packages: node: '>=8' resolution: integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== + /bindings/1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + dev: false + resolution: + integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== /bl/4.1.0: dependencies: buffer: 5.7.1 @@ -2033,7 +2057,6 @@ packages: dev: false engines: node: '>=0.10.0' - optional: true resolution: integrity: sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= /color-convert/1.9.3: @@ -2117,7 +2140,6 @@ packages: integrity: sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ== /console-control-strings/1.1.0: dev: false - optional: true resolution: integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= /contains-path/0.1.0: @@ -2355,7 +2377,6 @@ packages: dev: false engines: node: '>=8' - optional: true resolution: integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw== /deep-eql/3.0.1: @@ -2370,7 +2391,6 @@ packages: dev: false engines: node: '>=4.0.0' - optional: true resolution: integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== /deep-freeze/0.0.1: @@ -2425,7 +2445,6 @@ packages: integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk= /delegates/1.0.0: dev: false - optional: true resolution: integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= /depd/1.1.2: @@ -2443,7 +2462,6 @@ packages: engines: node: '>=0.10' hasBin: true - optional: true resolution: integrity: sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= /di/0.0.1: @@ -2970,7 +2988,6 @@ packages: dev: false engines: node: '>=6' - optional: true resolution: integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== /expand-tilde/2.0.2: @@ -3371,7 +3388,6 @@ packages: strip-ansi: 3.0.1 wide-align: 1.1.3 dev: false - optional: true resolution: integrity: sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= /gensync/1.0.0-beta.2: @@ -3429,7 +3445,6 @@ packages: integrity: sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= /github-from-package/0.0.0: dev: false - optional: true resolution: integrity: sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4= /glob-parent/5.1.2: @@ -3620,7 +3635,6 @@ packages: integrity: sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== /has-unicode/2.0.1: dev: false - optional: true resolution: integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= /has/1.0.3: @@ -3949,7 +3963,6 @@ packages: dev: false engines: node: '>=0.10.0' - optional: true resolution: integrity: sha1-754xOG8DGn8NZDr4L95QxFfvAMs= /is-fullwidth-code-point/2.0.0: @@ -4605,6 +4618,14 @@ packages: debug: '*' resolution: integrity: sha512-Is71g0f1dIpbLTXA+ULpev1i1soczQ1Dr8oum3zSmBFsDl3IWUlTLytsCb9os4v9xvUVWGDz0sCmLO4veANnSw== + /keytar/7.0.0: + dependencies: + node-addon-api: 3.1.0 + prebuild-install: 5.3.5 + dev: false + requiresBuild: true + resolution: + integrity: sha512-uvmdb5ZE2NgegcUDrmhutI9BUh+bTbt8+bwPliOMiLiWmrV76Tfg6DyI7Ud903a/4xlkJpKGnR0TyRpRyFOc3A== /keytar/7.4.0: dependencies: node-addon-api: 3.1.0 @@ -4942,7 +4963,6 @@ packages: dev: false engines: node: '>=8' - optional: true resolution: integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA== /min-document/2.19.0: @@ -5065,6 +5085,10 @@ packages: node: '>=0.8.0' resolution: integrity: sha512-Xsh+jiizuC5tjjK9J0RB5i/VE9CvOzBukxtxexffFQTm7vO6vqfUDB6mrsmHn5ts+rdAL89KryQFaDpVJRf4Cw== + /nan/2.14.2: + dev: false + resolution: + integrity: sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== /nanoid/3.1.22: dev: false engines: @@ -5074,7 +5098,6 @@ packages: integrity: sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ== /napi-build-utils/1.0.2: dev: false - optional: true resolution: integrity: sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== /natural-compare/1.4.0: @@ -5130,7 +5153,6 @@ packages: dependencies: semver: 5.7.1 dev: false - optional: true resolution: integrity: sha512-smhrivuPqEM3H5LmnY3KU6HfYv0u4QklgAxfFyRNujKUzbUcYZ+Jc2EhukB9SRcD2VpqhxM7n/MIcp1Ua1/JMg== /node-abort-controller/1.2.0: @@ -5139,7 +5161,6 @@ packages: integrity: sha512-x6Pv6ACfOUmYGDW/SRjSKBJs7waJRxRPQ9FeXFqfBtEtvJQBfuPl5P74p0Ow+vl0w6WURvXwn+xq/3S95Z7e5Q== /node-addon-api/3.1.0: dev: false - optional: true resolution: integrity: sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw== /node-environment-flags/1.0.6: @@ -5161,7 +5182,6 @@ packages: integrity: sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg== /noop-logger/0.1.1: dev: false - optional: true resolution: integrity: sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI= /normalize-package-data/2.5.0: @@ -5219,14 +5239,12 @@ packages: gauge: 2.7.4 set-blocking: 2.0.0 dev: false - optional: true resolution: integrity: sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== /number-is-nan/1.0.1: dev: false engines: node: '>=0.10.0' - optional: true resolution: integrity: sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= /nyc/14.1.1: @@ -5656,6 +5674,29 @@ packages: node: '>=4' resolution: integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + /prebuild-install/5.3.5: + dependencies: + detect-libc: 1.0.3 + expand-template: 2.0.3 + github-from-package: 0.0.0 + minimist: 1.2.5 + mkdirp: 0.5.5 + napi-build-utils: 1.0.2 + node-abi: 2.21.0 + noop-logger: 0.1.1 + npmlog: 4.1.2 + pump: 3.0.0 + rc: 1.2.8 + simple-get: 3.1.0 + tar-fs: 2.1.1 + tunnel-agent: 0.6.0 + which-pm-runs: 1.0.0 + dev: false + engines: + node: '>=6' + hasBin: true + resolution: + integrity: sha512-YmMO7dph9CYKi5IR/BzjOJlRzpxGGVo1EsLSUZ0mt/Mq0HWZIHOKHHcHdT69yG54C9m6i45GpItwRHpk0Py7Uw== /prebuild-install/6.0.1: dependencies: detect-libc: 1.0.3 @@ -5908,7 +5949,6 @@ packages: strip-json-comments: 2.0.1 dev: false hasBin: true - optional: true resolution: integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== /read-pkg-up/2.0.0: @@ -6424,7 +6464,6 @@ packages: integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== /simple-concat/1.0.1: dev: false - optional: true resolution: integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== /simple-get/3.1.0: @@ -6433,7 +6472,6 @@ packages: once: 1.4.0 simple-concat: 1.0.1 dev: false - optional: true resolution: integrity: sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA== /sinon/9.2.4: @@ -6713,7 +6751,6 @@ packages: dev: false engines: node: '>=0.10.0' - optional: true resolution: integrity: sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= /string-width/2.1.1: @@ -7349,7 +7386,6 @@ packages: integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= /which-pm-runs/1.0.0: dev: false - optional: true resolution: integrity: sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs= /which-typed-array/1.1.4: @@ -9798,6 +9834,7 @@ packages: version: 0.0.0 file:projects/perf-identity.tgz: dependencies: + '@azure/msal-node-extensions': 1.0.0-alpha.6 '@types/uuid': 8.3.0 dotenv: 8.2.0 eslint: 7.22.0 @@ -9809,7 +9846,7 @@ packages: dev: false name: '@rush-temp/perf-identity' resolution: - integrity: sha512-dGWFtEBT8TQxKH65+/OO266Cj2gcGgXT/bdyjq3MCENgBQ5MiD01quuKiPncS1BUA2iEieCvxlE5T5dJvgxWTw== + integrity: sha512-loyOu4Ah/n9RjrRrkjLWU7hUce6ern2qoLYgLDUl5UMmMIOutOBngl8vXzvRT1NEdfzbc4/YHvimpkVQOi5DXw== tarball: file:projects/perf-identity.tgz version: 0.0.0 file:projects/perf-keyvault-certificates.tgz: From 32c99bc91075bc70edfe13374341803446e3d330 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 17:40:21 +0000 Subject: [PATCH 04/13] deleted index.spec.js --- sdk/identity/perf-tests/identity/test/index.spec.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 sdk/identity/perf-tests/identity/test/index.spec.js diff --git a/sdk/identity/perf-tests/identity/test/index.spec.js b/sdk/identity/perf-tests/identity/test/index.spec.js deleted file mode 100644 index 58cafff6b79a..000000000000 --- a/sdk/identity/perf-tests/identity/test/index.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -exports.__esModule = true; -var test_utils_perfstress_1 = require("@azure/test-utils-perfstress"); -var persistence_spec_1 = require("./DeviceCodeCredential/persistence.spec"); -console.log("=== Starting the perfStress test ==="); -var perfStressProgram = new test_utils_perfstress_1.PerfStressProgram(test_utils_perfstress_1.selectPerfStressTest([persistence_spec_1.DeviceCodeCredentialPersistenceTest])); -perfStressProgram.run(); From 8f6ac26ddc1a520df783ba175883a5d103dba7bb Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 17:45:44 +0000 Subject: [PATCH 05/13] added the missing tsconfig.json --- sdk/identity/perf-tests/identity/.gitignore | 1 - sdk/identity/perf-tests/identity/package.json | 2 +- sdk/identity/perf-tests/identity/test/index.spec.js | 7 +++++++ sdk/identity/perf-tests/identity/tsconfig.json | 12 ++++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) delete mode 100644 sdk/identity/perf-tests/identity/.gitignore create mode 100644 sdk/identity/perf-tests/identity/test/index.spec.js diff --git a/sdk/identity/perf-tests/identity/.gitignore b/sdk/identity/perf-tests/identity/.gitignore deleted file mode 100644 index 3598db9de2e4..000000000000 --- a/sdk/identity/perf-tests/identity/.gitignore +++ /dev/null @@ -1 +0,0 @@ -test/**/*.js diff --git a/sdk/identity/perf-tests/identity/package.json b/sdk/identity/perf-tests/identity/package.json index 037c8460772a..f33cf73d0e33 100644 --- a/sdk/identity/perf-tests/identity/package.json +++ b/sdk/identity/perf-tests/identity/package.json @@ -29,7 +29,7 @@ "build:samples": "echo skipped", "build:test": "echo skipped", "check-format": "prettier --list-different --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", - "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log test/**/*.js", + "clean": "rimraf dist dist-esm test-dist typings *.tgz *.log", "format": "prettier --write --config ../../../../.prettierrc.json --ignore-path ../../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "integration-test:browser": "echo skipped", "integration-test:node": "echo skipped", diff --git a/sdk/identity/perf-tests/identity/test/index.spec.js b/sdk/identity/perf-tests/identity/test/index.spec.js new file mode 100644 index 000000000000..58cafff6b79a --- /dev/null +++ b/sdk/identity/perf-tests/identity/test/index.spec.js @@ -0,0 +1,7 @@ +"use strict"; +exports.__esModule = true; +var test_utils_perfstress_1 = require("@azure/test-utils-perfstress"); +var persistence_spec_1 = require("./DeviceCodeCredential/persistence.spec"); +console.log("=== Starting the perfStress test ==="); +var perfStressProgram = new test_utils_perfstress_1.PerfStressProgram(test_utils_perfstress_1.selectPerfStressTest([persistence_spec_1.DeviceCodeCredentialPersistenceTest])); +perfStressProgram.run(); diff --git a/sdk/identity/perf-tests/identity/tsconfig.json b/sdk/identity/perf-tests/identity/tsconfig.json index e69de29bb2d1..afd0da5d14c7 100644 --- a/sdk/identity/perf-tests/identity/tsconfig.json +++ b/sdk/identity/perf-tests/identity/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../../tsconfig.package", + "compilerOptions": { + "module": "CommonJS", + "target": "ES2015", + "lib": ["ES6", "ESNext.AsyncIterable"], + "noEmit": true + }, + "compileOnSave": true, + "exclude": ["node_modules"], + "include": ["./test/**/*.ts"] +} From 09711804becc452933a73ffaf432a9e75b971a19 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 17:57:40 +0000 Subject: [PATCH 06/13] Fixes after tsconfig --- .../identity/test/DeviceCodeCredential/persistence.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts index 6a61841ce713..2bd6f80d7ea2 100644 --- a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts +++ b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts @@ -1,12 +1,11 @@ import { PerfStressTest } from "@azure/test-utils-perfstress"; -import { DeviceCodeCredential, AuthenticationRecord } from "@azure/identity"; +import { DeviceCodeCredential } from "@azure/identity"; const scope = `https://servicebus.azure.net/.default`; export abstract class DeviceCodeCredentialTest extends PerfStressTest { options = {}; credential: DeviceCodeCredential; - account: AuthenticationRecord; constructor() { super(); @@ -19,7 +18,7 @@ export abstract class DeviceCodeCredentialTest extends PerfStressTest { } async globalSetup(): Promise { - this.account = await this.credential.authenticate(scope); + await this.credential.authenticate(scope); } } From 40c4bc0295fc247b24cb8880ea79a2e4fe379252 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 18:01:49 +0000 Subject: [PATCH 07/13] changelog and small tweaks --- sdk/identity/perf-tests/identity/CHANGELOG.md | 5 +++++ sdk/identity/perf-tests/identity/package.json | 2 +- .../identity/test/DeviceCodeCredential/persistence.spec.ts | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sdk/identity/perf-tests/identity/CHANGELOG.md b/sdk/identity/perf-tests/identity/CHANGELOG.md index e69de29bb2d1..b7643f298697 100644 --- a/sdk/identity/perf-tests/identity/CHANGELOG.md +++ b/sdk/identity/perf-tests/identity/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +- Added a first performance test that does silent authentication with persistence enabled with `DeviceCodeCredental`. diff --git a/sdk/identity/perf-tests/identity/package.json b/sdk/identity/perf-tests/identity/package.json index f33cf73d0e33..a9ebbe78692d 100644 --- a/sdk/identity/perf-tests/identity/package.json +++ b/sdk/identity/perf-tests/identity/package.json @@ -1,6 +1,6 @@ { "name": "@azure-tests/perf-identity", - "version": "1.0.0", + "version": "1.0.0-beta.1", "description": "", "main": "", "keywords": [], diff --git a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts index 2bd6f80d7ea2..d8c7245ae28c 100644 --- a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts +++ b/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts @@ -22,6 +22,9 @@ export abstract class DeviceCodeCredentialTest extends PerfStressTest { } } +/** + * This test does silent authentication with persistence enabled. + */ export class DeviceCodeCredentialPersistenceTest extends DeviceCodeCredentialTest { async runAsync(): Promise { await this.credential.getToken(scope); From f1c322aae7a8630f5f3f3a69ce37069abb8b3642 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 18:07:45 +0000 Subject: [PATCH 08/13] I swear I removed this. Making sure its removed this time --- sdk/identity/perf-tests/identity/test/index.spec.js | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 sdk/identity/perf-tests/identity/test/index.spec.js diff --git a/sdk/identity/perf-tests/identity/test/index.spec.js b/sdk/identity/perf-tests/identity/test/index.spec.js deleted file mode 100644 index 58cafff6b79a..000000000000 --- a/sdk/identity/perf-tests/identity/test/index.spec.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -exports.__esModule = true; -var test_utils_perfstress_1 = require("@azure/test-utils-perfstress"); -var persistence_spec_1 = require("./DeviceCodeCredential/persistence.spec"); -console.log("=== Starting the perfStress test ==="); -var perfStressProgram = new test_utils_perfstress_1.PerfStressProgram(test_utils_perfstress_1.selectPerfStressTest([persistence_spec_1.DeviceCodeCredentialPersistenceTest])); -perfStressProgram.run(); From 4a5382e9257e97001308215ffbee41f40edd80de Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 19:24:49 +0000 Subject: [PATCH 09/13] removign msal-node-extensions from the dependencies --- sdk/identity/perf-tests/identity/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/identity/perf-tests/identity/package.json b/sdk/identity/perf-tests/identity/package.json index a9ebbe78692d..02aee4615a06 100644 --- a/sdk/identity/perf-tests/identity/package.json +++ b/sdk/identity/perf-tests/identity/package.json @@ -8,7 +8,6 @@ "license": "ISC", "dependencies": { "@azure/identity": "^2.0.0-beta.1", - "@azure/msal-node-extensions": "^1.0.0-alpha.6", "@azure/test-utils-perfstress": "^1.0.0", "dotenv": "^8.2.0" }, From 6f5d014f223d3312cda4df5038259d92b0be51fd Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Wed, 31 Mar 2021 23:47:49 +0000 Subject: [PATCH 10/13] common-versions only needs the odd version, not the common ones --- common/config/rush/common-versions.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/common/config/rush/common-versions.json b/common/config/rush/common-versions.json index 3dcd63710a54..21ecb62d871a 100644 --- a/common/config/rush/common-versions.json +++ b/common/config/rush/common-versions.json @@ -65,8 +65,6 @@ // projects to choose a higher version if desired. "@azure/core-http": ["^1.0.0"], // Idenity is moving from v1 to v2. Moving all packages to v2 is going to take a bit of time, in the mean time we could use v2 on the perf-identity tests. - "@azure/identity": [ - "^1.1.0", "^2.0.0-beta.1" - ] + "@azure/identity": ["^2.0.0-beta.1"] } } From 6286426d71050ddb0235f59870bacfd526aac359 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Thu, 1 Apr 2021 00:18:01 +0000 Subject: [PATCH 11/13] fixing the build --- sdk/identity/perf-tests/identity/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/identity/perf-tests/identity/README.md b/sdk/identity/perf-tests/identity/README.md index 454ade231f6d..79c7f2eeeaf7 100644 --- a/sdk/identity/perf-tests/identity/README.md +++ b/sdk/identity/perf-tests/identity/README.md @@ -7,7 +7,7 @@ These tests won't work on Node 8 nor Node 15. 2. Build the Identity perf tests package `rush build -t perf-identity`. 3. Copy the `sample.env` file and name it as `.env`. 4. Populate the `.env` file with your Azure Credentials. -5. Refer to the [rate limits](https://docs.microsoft.com/en-us/azure/active-directory/enterprise-users/directory-service-limits-restrictions) and then run the tests as follows: +5. Refer to the [rate limits](https://docs.microsoft.com/azure/active-directory/enterprise-users/directory-service-limits-restrictions) and then run the tests as follows: - `DeviceCodeCredential` test for the `tokenCachePersistenceOptions`. - `npm run perf-test:node -- DeviceCodeCredentialPersistenceTest --warmup 1 --iterations 1 --parallel 5` From f01bf2ba959ec462c7578a6764482a62603ddb21 Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Thu, 1 Apr 2021 18:03:27 +0000 Subject: [PATCH 12/13] Using ClientSecretCredential --- sdk/identity/perf-tests/identity/CHANGELOG.md | 2 +- sdk/identity/perf-tests/identity/README.md | 4 ++-- sdk/identity/perf-tests/identity/sample.env | 13 +++-------- .../persistence.spec.ts | 22 ++++++++++--------- .../perf-tests/identity/test/index.spec.ts | 6 +++-- 5 files changed, 22 insertions(+), 25 deletions(-) rename sdk/identity/perf-tests/identity/test/{DeviceCodeCredential => ClientSecretCredential}/persistence.spec.ts (51%) diff --git a/sdk/identity/perf-tests/identity/CHANGELOG.md b/sdk/identity/perf-tests/identity/CHANGELOG.md index b7643f298697..71acd9f87d1b 100644 --- a/sdk/identity/perf-tests/identity/CHANGELOG.md +++ b/sdk/identity/perf-tests/identity/CHANGELOG.md @@ -2,4 +2,4 @@ ## 1.0.0-beta.1 (Unreleased) -- Added a first performance test that does silent authentication with persistence enabled with `DeviceCodeCredental`. +- Added a first performance test that does silent authentication with persistence enabled with `ClientSecretCredential`. diff --git a/sdk/identity/perf-tests/identity/README.md b/sdk/identity/perf-tests/identity/README.md index 79c7f2eeeaf7..95416839df8e 100644 --- a/sdk/identity/perf-tests/identity/README.md +++ b/sdk/identity/perf-tests/identity/README.md @@ -9,5 +9,5 @@ These tests won't work on Node 8 nor Node 15. 4. Populate the `.env` file with your Azure Credentials. 5. Refer to the [rate limits](https://docs.microsoft.com/azure/active-directory/enterprise-users/directory-service-limits-restrictions) and then run the tests as follows: -- `DeviceCodeCredential` test for the `tokenCachePersistenceOptions`. - - `npm run perf-test:node -- DeviceCodeCredentialPersistenceTest --warmup 1 --iterations 1 --parallel 5` +- `ClientSecretCredential` test for the `tokenCachePersistenceOptions`. + - `npm run perf-test:node -- ClientSecretCredentialPersistenceTest --warmup 1 --iterations 1 --parallel 5` diff --git a/sdk/identity/perf-tests/identity/sample.env b/sdk/identity/perf-tests/identity/sample.env index cf9fab04a660..a5abcef7604d 100644 --- a/sdk/identity/perf-tests/identity/sample.env +++ b/sdk/identity/perf-tests/identity/sample.env @@ -1,10 +1,3 @@ -# None of these environment variables are needed while we only have the InteractiveBrowserCredentialPersistenceTest test. -# But they will be useful in the future: -# -# AZURE_TENANT_ID= -# AZURE_CLIENT_ID= -# AZURE_CLIENT_SECRET= -# AZURE_CLIENT_CERTIFICATE_PATH= -# AZURE_USERNAME= -# AZURE_PASSWORD= -# +AZURE_TENANT_ID= +AZURE_CLIENT_ID= +AZURE_CLIENT_SECRET= diff --git a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts b/sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts similarity index 51% rename from sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts rename to sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts index d8c7245ae28c..42493f430cc3 100644 --- a/sdk/identity/perf-tests/identity/test/DeviceCodeCredential/persistence.spec.ts +++ b/sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts @@ -1,15 +1,22 @@ import { PerfStressTest } from "@azure/test-utils-perfstress"; -import { DeviceCodeCredential } from "@azure/identity"; +import { ClientSecretCredential } from "@azure/identity"; const scope = `https://servicebus.azure.net/.default`; -export abstract class DeviceCodeCredentialTest extends PerfStressTest { +/** + * This test does silent authentication with persistence enabled. + */ +export class ClientSecretCredentialPersistenceTest extends PerfStressTest { options = {}; - credential: DeviceCodeCredential; + credential: ClientSecretCredential; constructor() { super(); - this.credential = new DeviceCodeCredential({ + const tenantId = process.env.AZURE_TENANT_ID!; + const clientId = process.env.AZURE_CLIENT_ID!; + const clientSecret = process.env.AZURE_CLIENT_SECRET!; + + this.credential = new ClientSecretCredential(tenantId, clientId, clientSecret, { tokenCachePersistenceOptions: { name: "nodeTestSilent", allowUnencryptedStorage: true @@ -18,14 +25,9 @@ export abstract class DeviceCodeCredentialTest extends PerfStressTest { } async globalSetup(): Promise { - await this.credential.authenticate(scope); + await this.credential.getToken(scope); } -} -/** - * This test does silent authentication with persistence enabled. - */ -export class DeviceCodeCredentialPersistenceTest extends DeviceCodeCredentialTest { async runAsync(): Promise { await this.credential.getToken(scope); } diff --git a/sdk/identity/perf-tests/identity/test/index.spec.ts b/sdk/identity/perf-tests/identity/test/index.spec.ts index 3f54d4f80c3b..a38acf89e303 100644 --- a/sdk/identity/perf-tests/identity/test/index.spec.ts +++ b/sdk/identity/perf-tests/identity/test/index.spec.ts @@ -1,10 +1,12 @@ import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress"; -import { DeviceCodeCredentialPersistenceTest } from "./DeviceCodeCredential/persistence.spec"; +import { ClientSecretCredentialPersistenceTest } from "./ClientSecretCredential/persistence.spec"; +import * as dotenv from "dotenv"; +dotenv.config(); console.log("=== Starting the perfStress test ==="); const perfStressProgram = new PerfStressProgram( - selectPerfStressTest([DeviceCodeCredentialPersistenceTest]) + selectPerfStressTest([ClientSecretCredentialPersistenceTest]) ); perfStressProgram.run(); From 90785efc75b959c6808288e6a9fd84fca23c13cd Mon Sep 17 00:00:00 2001 From: Daniel Rodriguez Date: Thu, 1 Apr 2021 19:54:59 +0000 Subject: [PATCH 13/13] Moving the credential around --- .../persistence.spec.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts b/sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts index 42493f430cc3..2935b7b6eba5 100644 --- a/sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts +++ b/sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts @@ -1,4 +1,4 @@ -import { PerfStressTest } from "@azure/test-utils-perfstress"; +import { PerfStressTest, getEnvVar } from "@azure/test-utils-perfstress"; import { ClientSecretCredential } from "@azure/identity"; const scope = `https://servicebus.azure.net/.default`; @@ -8,27 +8,29 @@ const scope = `https://servicebus.azure.net/.default`; */ export class ClientSecretCredentialPersistenceTest extends PerfStressTest { options = {}; - credential: ClientSecretCredential; + static credential: ClientSecretCredential; - constructor() { - super(); - const tenantId = process.env.AZURE_TENANT_ID!; - const clientId = process.env.AZURE_CLIENT_ID!; - const clientSecret = process.env.AZURE_CLIENT_SECRET!; + async globalSetup(): Promise { + const tenantId = getEnvVar("AZURE_TENANT_ID"); + const clientId = getEnvVar("AZURE_CLIENT_ID"); + const clientSecret = getEnvVar("AZURE_CLIENT_SECRET"); - this.credential = new ClientSecretCredential(tenantId, clientId, clientSecret, { + // We want this credential to be initialized only if this test is executed. + // Other tests should not be required to set up this credential. + const credential = new ClientSecretCredential(tenantId, clientId, clientSecret, { tokenCachePersistenceOptions: { name: "nodeTestSilent", allowUnencryptedStorage: true } }); - } - async globalSetup(): Promise { - await this.credential.getToken(scope); + // This getToken call will cache the token. + await credential.getToken(scope); + + ClientSecretCredentialPersistenceTest.credential = credential; } async runAsync(): Promise { - await this.credential.getToken(scope); + await ClientSecretCredentialPersistenceTest.credential.getToken(scope); } }