-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Identity] Performance tests #14634
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
Merged
Merged
[Identity] Performance tests #14634
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3150ae8
[Identity] Performance tests
sadasant 1751aaf
removed built .js file
sadasant b0f32dd
The shrinkwrap file was out of date.
sadasant 32c99bc
deleted index.spec.js
sadasant 8f6ac26
added the missing tsconfig.json
sadasant 0971180
Fixes after tsconfig
sadasant 40c4bc0
changelog and small tweaks
sadasant f1c322a
I swear I removed this. Making sure its removed this time
sadasant 4a5382e
removign msal-node-extensions from the dependencies
sadasant 6f5d014
common-versions only needs the odd version, not the common ones
sadasant f004473
Merge remote-tracking branch 'Azure/master' into identity/performance…
sadasant 6286426
fixing the build
sadasant f01bf2b
Using ClientSecretCredential
sadasant 90785ef
Moving the credential around
sadasant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 `ClientSecretCredential`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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/azure/active-directory/enterprise-users/directory-service-limits-restrictions) and then run the tests as follows: | ||
|
|
||
| - `ClientSecretCredential` test for the `tokenCachePersistenceOptions`. | ||
| - `npm run perf-test:node -- ClientSecretCredentialPersistenceTest --warmup 1 --iterations 1 --parallel 5` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| { | ||
| "name": "@azure-tests/perf-identity", | ||
| "version": "1.0.0-beta.1", | ||
| "description": "", | ||
| "main": "", | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "@azure/identity": "^2.0.0-beta.1", | ||
| "@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" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| AZURE_TENANT_ID=<AD tenant id or name> | ||
| AZURE_CLIENT_ID=<ID of the user/service principal to authenticate as> | ||
| AZURE_CLIENT_SECRET=<client secret used to authenticate to Azure AD> |
36 changes: 36 additions & 0 deletions
36
sdk/identity/perf-tests/identity/test/ClientSecretCredential/persistence.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { PerfStressTest, getEnvVar } from "@azure/test-utils-perfstress"; | ||
| import { ClientSecretCredential } from "@azure/identity"; | ||
|
|
||
| const scope = `https://servicebus.azure.net/.default`; | ||
|
|
||
| /** | ||
| * This test does silent authentication with persistence enabled. | ||
| */ | ||
| export class ClientSecretCredentialPersistenceTest extends PerfStressTest { | ||
| options = {}; | ||
| static credential: ClientSecretCredential; | ||
|
|
||
| async globalSetup(): Promise<void> { | ||
| const tenantId = getEnvVar("AZURE_TENANT_ID"); | ||
| const clientId = getEnvVar("AZURE_CLIENT_ID"); | ||
| const clientSecret = getEnvVar("AZURE_CLIENT_SECRET"); | ||
|
|
||
| // 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 | ||
| } | ||
| }); | ||
|
|
||
| // This getToken call will cache the token. | ||
| await credential.getToken(scope); | ||
|
|
||
| ClientSecretCredentialPersistenceTest.credential = credential; | ||
| } | ||
|
|
||
| async runAsync(): Promise<void> { | ||
| await ClientSecretCredentialPersistenceTest.credential.getToken(scope); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { PerfStressProgram, selectPerfStressTest } from "@azure/test-utils-perfstress"; | ||
| import { ClientSecretCredentialPersistenceTest } from "./ClientSecretCredential/persistence.spec"; | ||
| import * as dotenv from "dotenv"; | ||
| dotenv.config(); | ||
|
|
||
| console.log("=== Starting the perfStress test ==="); | ||
|
|
||
| const perfStressProgram = new PerfStressProgram( | ||
| selectPerfStressTest([ClientSecretCredentialPersistenceTest]) | ||
| ); | ||
|
|
||
| perfStressProgram.run(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Why global?.. Is it not enough to add it as a dependency in the package.json?
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.
We can't have this dependency in our package.json since this means developers need to have Visual Studio or build-essential installed, and in some Node versions this dependency doesn't compile. We're working on it with the MSAL team.
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 meant.. dependency of the perf-test identity project, where you're mentioning
@azure/identity.