From 1a1ac1485839fd7c251a2194fcb37c1730da6dbe Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:24:47 -0400 Subject: [PATCH 01/21] Added msal-node client-credential regression test --- .github/workflows/client-credential.yml | 44 +++ regression-tests/.gitignore | 1 + regression-tests/msal-node/Constants.js | 94 ++++++ .../msal-node/client-credential/index.js | 82 +++++ .../client-credential/package-lock.json | 281 ++++++++++++++++++ .../msal-node/client-credential/package.json | 16 + 6 files changed, 518 insertions(+) create mode 100644 .github/workflows/client-credential.yml create mode 100644 regression-tests/.gitignore create mode 100644 regression-tests/msal-node/Constants.js create mode 100644 regression-tests/msal-node/client-credential/index.js create mode 100644 regression-tests/msal-node/client-credential/package-lock.json create mode 100644 regression-tests/msal-node/client-credential/package.json diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml new file mode 100644 index 0000000000..7cddc86ba9 --- /dev/null +++ b/.github/workflows/client-credential.yml @@ -0,0 +1,44 @@ +name: msal-node client-credential Regression Test +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + paths: + - "lib/msal-node/**/*" + - "lib/msal-common/**/*" + - "!**.md" + - ".github/workflows/msal-node-e2e.yml" + merge_group: + types: [checks_requested] + +permissions: + contents: write + +jobs: + benchmark: + name: Run msal-node client-credential Regression Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - name: Run benchmark + run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt + + - name: Download previous benchmark data + uses: actions/cache@v3 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Benchmark.js Benchmark + tool: 'benchmarkjs' + output-file-path: regression-tests/msal-node/client-credential/output.txt + external-data-json-path: ./cache/benchmark-data.json + github-token: ${{ secrets.GITHUB_TOKEN }} + # Show alert with commit comment on detecting possible performance regression + alert-threshold: '10%' + comment-on-alert: true + fail-on-alert: false + alert-comment-cc-users: '@bgavrilMS @robbie-microsoft' diff --git a/regression-tests/.gitignore b/regression-tests/.gitignore new file mode 100644 index 0000000000..40b878db5b --- /dev/null +++ b/regression-tests/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/regression-tests/msal-node/Constants.js b/regression-tests/msal-node/Constants.js new file mode 100644 index 0000000000..708ad66519 --- /dev/null +++ b/regression-tests/msal-node/Constants.js @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +const NetworkUtils = class NetworkUtils { + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + static getNetworkResponse(headers, body, statusCode) { + return { + headers: headers, + body: body, + status: statusCode, + }; + } +}; + +const DEFAULT_OPENID_CONFIG_RESPONSE = { + headers: {}, + status: 200, + body: { + token_endpoint: + "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token", + token_endpoint_auth_methods_supported: [ + "client_secret_post", + "private_key_jwt", + "client_secret_basic", + ], + jwks_uri: + "https://login.microsoftonline.com/{tenant}/discovery/v2.0/keys", + response_modes_supported: ["query", "fragment", "form_post"], + subject_types_supported: ["pairwise"], + id_token_signing_alg_values_supported: ["RS256"], + response_types_supported: [ + "code", + "id_token", + "code id_token", + "id_token token", + ], + scopes_supported: ["openid", "profile", "email", "offline_access"], + issuer: "https://login.microsoftonline.com/{tenant}/v2.0", + request_uri_parameter_supported: false, + userinfo_endpoint: "https://graph.microsoft.com/oidc/userinfo", + authorization_endpoint: + "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize", + http_logout_supported: true, + frontchannel_logout_supported: true, + end_session_endpoint: + "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/logout", + claims_supported: [ + "sub", + "iss", + "cloud_instance_name", + "cloud_instance_host_name", + "cloud_graph_host_name", + "msgraph_host", + "aud", + "exp", + "iat", + "auth_time", + "acr", + "nonce", + "preferred_username", + "name", + "tid", + "ver", + "at_hash", + "c_hash", + "email", + ], + tenant_region_scope: null, + cloud_instance_name: "microsoftonline.com", + cloud_graph_host_name: "graph.windows.net", + msgraph_host: "graph.microsoft.com", + rbac_url: "https://pas.windows.net", + }, +}; + +const CONFIDENTIAL_CLIENT_AUTHENTICATION_RESULT = { + headers: {}, + status: 200, + body: { + token_type: "Bearer", + expires_in: 3599, + ext_expires_in: 3599, + refresh_in: 3598 / 2, + access_token: "thisIs.an.accessT0ken", + }, +}; + +module.exports = { + CONFIDENTIAL_CLIENT_AUTHENTICATION_RESULT, + DEFAULT_OPENID_CONFIG_RESPONSE, + NetworkUtils, +}; diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js new file mode 100644 index 0000000000..c0bd21b5f7 --- /dev/null +++ b/regression-tests/msal-node/client-credential/index.js @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +/* eslint-disable @typescript-eslint/no-unused-vars */ + +import benchmark from "benchmark"; +import * as msal from "@azure/msal-node"; +import { + CONFIDENTIAL_CLIENT_AUTHENTICATION_RESULT, + DEFAULT_OPENID_CONFIG_RESPONSE, + NetworkUtils, +} from "../Constants.js"; + +const clientConfig = { + auth: { + clientId: "client_id", + authority: "https://login.microsoftonline.com/tenant_id", + knownAuthorities: ["https://login.microsoftonline.com/tenant_id"], + clientSecret: "client_secret", + }, + system: { + networkClient: new class CustomHttpClient { + sendGetRequestAsync(url, options, cancellationToken) { + return new Promise((resolve, reject) => { + const networkResponse = NetworkUtils.getNetworkResponse( + DEFAULT_OPENID_CONFIG_RESPONSE.headers, + DEFAULT_OPENID_CONFIG_RESPONSE.body, + DEFAULT_OPENID_CONFIG_RESPONSE.status, + ); + resolve(networkResponse); + }); + } + sendPostRequestAsync(url, options) { + return new Promise((resolve, _reject) => { + const networkResponse = NetworkUtils.getNetworkResponse( + CONFIDENTIAL_CLIENT_AUTHENTICATION_RESULT.headers, + CONFIDENTIAL_CLIENT_AUTHENTICATION_RESULT.body, + CONFIDENTIAL_CLIENT_AUTHENTICATION_RESULT.status, + ); + resolve(networkResponse); + }); + } + } + }, +}; + +const NUM_CACHE_ITEMS = 10; + +const confidentialClientApplication = new msal.ConfidentialClientApplication(clientConfig); +const firstResourceRequest = { + scopes: ["resource-1/.default"], +}; +const lastResourceRequest = { + scopes: [`resource-${NUM_CACHE_ITEMS}/.default`], +}; + +(async () => { + // pre populate the cache + for (let i = 1; i <= NUM_CACHE_ITEMS; i++) { + const request = { + scopes: [`resource-${i}/.default`], + }; + await confidentialClientApplication.acquireTokenByClientCredential(request); + } + + const suite = new benchmark.Suite(); + suite + .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }) + .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", async () => { + await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); + }) + // add listeners + .on("cycle", (event) => { + // eslint-disable-next-line no-console + console.log(String(event.target)); + }) + .run({ "async": true }); +})(); diff --git a/regression-tests/msal-node/client-credential/package-lock.json b/regression-tests/msal-node/client-credential/package-lock.json new file mode 100644 index 0000000000..d5e2d2af7e --- /dev/null +++ b/regression-tests/msal-node/client-credential/package-lock.json @@ -0,0 +1,281 @@ +{ + "name": "client-credential", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "client-credential", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@azure/msal-node": "^1.18.0", + "benchmark": "^2.1.4" + } + }, + "node_modules/@azure/msal-common": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-13.2.0.tgz", + "integrity": "sha512-rnstQ7Zgn3fSTKNQO+/YNV34/QXJs0vni7IA0/3QB1EEyrJg14xyRmTqlw9ta+pdSuT5OJwUP8kI3D/rBwUIBw==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-node": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-1.18.0.tgz", + "integrity": "sha512-N6GX1Twxw524e7gaJvj7hKtrPRmZl9qGY7U4pmUdx4XzoWYRFfYk4H1ZjVhQ7pwb5Ks88NNhbXVCagsuYPTEFg==", + "dependencies": { + "@azure/msal-common": "13.2.0", + "jsonwebtoken": "^9.0.0", + "uuid": "^8.3.0" + }, + "engines": { + "node": "10 || 12 || 14 || 16 || 18" + } + }, + "node_modules/benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==", + "dependencies": { + "lodash": "^4.17.4", + "platform": "^1.3.3" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", + "integrity": "sha512-K8wx7eJ5TPvEjuiVSkv167EVboBDv9PZdDoF7BgeQnBLVvZWW9clr2PsQHVJDTKaEIH5JBIwHujGcHp7GgI2eg==", + "dependencies": { + "jws": "^3.2.2", + "lodash": "^4.17.21", + "ms": "^2.1.1", + "semver": "^7.3.8" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/platform": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", + "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + }, + "dependencies": { + "@azure/msal-common": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-13.2.0.tgz", + "integrity": "sha512-rnstQ7Zgn3fSTKNQO+/YNV34/QXJs0vni7IA0/3QB1EEyrJg14xyRmTqlw9ta+pdSuT5OJwUP8kI3D/rBwUIBw==" + }, + "@azure/msal-node": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-1.18.0.tgz", + "integrity": "sha512-N6GX1Twxw524e7gaJvj7hKtrPRmZl9qGY7U4pmUdx4XzoWYRFfYk4H1ZjVhQ7pwb5Ks88NNhbXVCagsuYPTEFg==", + "requires": { + "@azure/msal-common": "13.2.0", + "jsonwebtoken": "^9.0.0", + "uuid": "^8.3.0" + } + }, + "benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==", + "requires": { + "lodash": "^4.17.4", + "platform": "^1.3.3" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" + }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "jsonwebtoken": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", + "integrity": "sha512-K8wx7eJ5TPvEjuiVSkv167EVboBDv9PZdDoF7BgeQnBLVvZWW9clr2PsQHVJDTKaEIH5JBIwHujGcHp7GgI2eg==", + "requires": { + "jws": "^3.2.2", + "lodash": "^4.17.21", + "ms": "^2.1.1", + "semver": "^7.3.8" + } + }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "requires": { + "yallist": "^4.0.0" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "platform": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", + "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + } + } +} diff --git a/regression-tests/msal-node/client-credential/package.json b/regression-tests/msal-node/client-credential/package.json new file mode 100644 index 0000000000..f464545e7e --- /dev/null +++ b/regression-tests/msal-node/client-credential/package.json @@ -0,0 +1,16 @@ +{ + "name": "client-credential", + "version": "1.0.0", + "description": "Client Credential Regression Test", + "main": "index.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "MIT", + "dependencies": { + "@azure/msal-node": "^1.18.0", + "benchmark": "^2.1.4" + } +} \ No newline at end of file From eeda597599ad8ae2687b33ba6dd993a19a06247e Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:36:05 -0400 Subject: [PATCH 02/21] modified client-credential.yml --- .github/workflows/client-credential.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml index 7cddc86ba9..ef887a03bb 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential.yml @@ -3,6 +3,7 @@ on: pull_request: types: [opened, reopened, synchronize, ready_for_review] paths: + - "regression-tests/msal-node/client-credential/*" - "lib/msal-node/**/*" - "lib/msal-common/**/*" - "!**.md" From d6ac2cd9703f5322d4b9afa3aeec550306ae6c6f Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:36:55 -0400 Subject: [PATCH 03/21] modified client-credential.yml --- .github/workflows/client-credential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml index ef887a03bb..8fff587eb1 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential.yml @@ -7,7 +7,7 @@ on: - "lib/msal-node/**/*" - "lib/msal-common/**/*" - "!**.md" - - ".github/workflows/msal-node-e2e.yml" + - ".github/workflows/client-credential.yml" merge_group: types: [checks_requested] From 4a303fb316df683f804f2d83a6ce6a883053cda4 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:38:31 -0400 Subject: [PATCH 04/21] modified client-credential.yml --- .github/workflows/client-credential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml index 8fff587eb1..a2728845d4 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Run benchmark - run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt + run: cd regression-tests/msal-node/client-credential && npm install && node bench.js | tee output.txt - name: Download previous benchmark data uses: actions/cache@v3 From 3f40e169684e97c2f85bbcaf03e30d4d5eb5b56a Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:41:00 -0400 Subject: [PATCH 05/21] modified client-credential.yml --- .github/workflows/client-credential.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml index a2728845d4..57159bbbf6 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 - name: Run benchmark - run: cd regression-tests/msal-node/client-credential && npm install && node bench.js | tee output.txt + run: cd regression-tests/msal-node/client-credential && npm install && node index.js | tee output.txt - name: Download previous benchmark data uses: actions/cache@v3 @@ -36,7 +36,7 @@ jobs: name: Benchmark.js Benchmark tool: 'benchmarkjs' output-file-path: regression-tests/msal-node/client-credential/output.txt - external-data-json-path: ./cache/benchmark-data.json + external-data-json-path: ./cache/client-credential-benchmark-data.json github-token: ${{ secrets.GITHUB_TOKEN }} # Show alert with commit comment on detecting possible performance regression alert-threshold: '10%' From 72e01b743ed45ea0dde20f0b0f821c56c481d577 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:52:54 -0400 Subject: [PATCH 06/21] added fake regression for testing github actions, will remove later --- regression-tests/msal-node/client-credential/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index c0bd21b5f7..e30b9a61e1 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -68,9 +68,11 @@ const lastResourceRequest = { const suite = new benchmark.Suite(); suite .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { + await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); }) .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", async () => { + await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); }) // add listeners From 917e9c42e33b4eca9623242fa338d0a5fff48d15 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 13:54:01 -0400 Subject: [PATCH 07/21] added sleep function for regression test --- regression-tests/msal-node/client-credential/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index e30b9a61e1..fee438cfcd 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -65,6 +65,10 @@ const lastResourceRequest = { await confidentialClientApplication.acquireTokenByClientCredential(request); } + const sleep = (ms) => { + return new Promise(resolve => setTimeout(resolve, ms)); + } + const suite = new benchmark.Suite(); suite .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { From 476f58e5c7b6acc151e6f9d24ff08db916d1c678 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Mon, 31 Jul 2023 14:37:34 -0400 Subject: [PATCH 08/21] removed fake regression --- .github/workflows/client-credential.yml | 2 +- regression-tests/msal-node/client-credential/index.js | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml index 57159bbbf6..66ae6c20f8 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential.yml @@ -33,7 +33,7 @@ jobs: - name: Store benchmark result uses: benchmark-action/github-action-benchmark@v1 with: - name: Benchmark.js Benchmark + name: msal-node client-credential Regression Test tool: 'benchmarkjs' output-file-path: regression-tests/msal-node/client-credential/output.txt external-data-json-path: ./cache/client-credential-benchmark-data.json diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index fee438cfcd..c0bd21b5f7 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -65,18 +65,12 @@ const lastResourceRequest = { await confidentialClientApplication.acquireTokenByClientCredential(request); } - const sleep = (ms) => { - return new Promise(resolve => setTimeout(resolve, ms)); - } - const suite = new benchmark.Suite(); suite .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { - await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); }) .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", async () => { - await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); }) // add listeners From b3277980bd2280b86f777d895e27fccedcaa31c8 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Thu, 3 Aug 2023 16:01:42 -0400 Subject: [PATCH 09/21] Testing minSamples on GitHub actions --- .../client-credential}/.gitignore | 0 .../msal-node/client-credential/index.js | 80 +++++++++++++++++-- 2 files changed, 72 insertions(+), 8 deletions(-) rename regression-tests/{ => msal-node/client-credential}/.gitignore (100%) diff --git a/regression-tests/.gitignore b/regression-tests/msal-node/client-credential/.gitignore similarity index 100% rename from regression-tests/.gitignore rename to regression-tests/msal-node/client-credential/.gitignore diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index c0bd21b5f7..bbaad080fa 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -52,9 +52,11 @@ const confidentialClientApplication = new msal.ConfidentialClientApplication(cli const firstResourceRequest = { scopes: ["resource-1/.default"], }; -const lastResourceRequest = { - scopes: [`resource-${NUM_CACHE_ITEMS}/.default`], -}; +/* + * const lastResourceRequest = { + * scopes: [`resource-${NUM_CACHE_ITEMS}/.default`], + * }; + */ (async () => { // pre populate the cache @@ -67,13 +69,75 @@ const lastResourceRequest = { const suite = new benchmark.Suite(); suite - .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + .add("a", { + "minSamples": 150, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 150, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 150, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 150, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 150, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 200, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 200, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 200, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, + }) + .add("a", { + "minSamples": 200, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, }) - .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", async () => { - await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); + .add("a", { + "minSamples": 200, + "fn": async () => { + await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + }, }) - // add listeners + /* + * .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { + * await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + * }) + * .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", async () => { + * await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); + * }) + * add listeners + */ .on("cycle", (event) => { // eslint-disable-next-line no-console console.log(String(event.target)); From 5271450c5fe1290ddb2baef902f27fdbf86ce313 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Thu, 3 Aug 2023 16:50:23 -0400 Subject: [PATCH 10/21] reverted changes for testing. Added a minSamples value of 150 --- .../msal-node/client-credential/index.js | 71 ++----------------- 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index bbaad080fa..b5b7bc9aa4 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -52,11 +52,9 @@ const confidentialClientApplication = new msal.ConfidentialClientApplication(cli const firstResourceRequest = { scopes: ["resource-1/.default"], }; -/* - * const lastResourceRequest = { - * scopes: [`resource-${NUM_CACHE_ITEMS}/.default`], - * }; - */ +const lastResourceRequest = { + scopes: [`resource-${NUM_CACHE_ITEMS}/.default`], +}; (async () => { // pre populate the cache @@ -69,75 +67,18 @@ const firstResourceRequest = { const suite = new benchmark.Suite(); suite - .add("a", { - "minSamples": 150, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, - }) - .add("a", { - "minSamples": 150, + .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", { "fn": async () => { await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); }, - }) - .add("a", { "minSamples": 150, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, }) - .add("a", { - "minSamples": 150, + .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", { "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); + await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); }, - }) - .add("a", { "minSamples": 150, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, - }) - .add("a", { - "minSamples": 200, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, - }) - .add("a", { - "minSamples": 200, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, - }) - .add("a", { - "minSamples": 200, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, - }) - .add("a", { - "minSamples": 200, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, - }) - .add("a", { - "minSamples": 200, - "fn": async () => { - await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - }, }) - /* - * .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", async () => { - * await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); - * }) - * .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", async () => { - * await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); - * }) - * add listeners - */ .on("cycle", (event) => { // eslint-disable-next-line no-console console.log(String(event.target)); From 4427febf5406ebf42cd52fa26ac9faab3c37ed3e Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Tue, 8 Aug 2023 14:15:30 -0400 Subject: [PATCH 11/21] Added charts for gh-pages --- .github/workflows/gh-pages.yml | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000000..c453dfa4a2 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,46 @@ +# Do not run this workflow on pull request since this workflow has permission to modify contents. +# on: +# push: +# branches: +# - dev +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + paths: + - "regression-tests/msal-node/client-credential/*" + - "lib/msal-node/**/*" + - "lib/msal-common/**/*" + - "!**.md" + - ".github/workflows/client-credential.yml" + merge_group: + types: [checks_requested] + +permissions: + # deployments permission to deploy GitHub pages website + deployments: write + # contents permission to update benchmark contents in gh-pages branch + contents: write + +jobs: + benchmark: + name: Performance regression check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + - name: Run benchmark + run: cd regression-tests/msal-node/client-credential && npm install && node index.js | tee output.txt + + # gh-pages branch is updated and pushed automatically with extracted benchmark data + # By default, this action assumes that gh-pages is the GitHub Pages branch and that + # /dev/bench is a path to put the benchmark dashboard page. They can be tweaked by + # the gh-pages-branch, gh-repository and benchmark-data-dir-path inputs. + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: msal-node client-credential Regression Test + tool: 'benchmarkjs' + output-file-path: regression-tests/msal-node/client-credential/output.txt + github-token: ${{ secrets.GITHUB_TOKEN }} + # Push and deploy GitHub pages branch automatically + auto-push: true \ No newline at end of file From af3472bc38b5915403350c70e11915fae9a59466 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Tue, 8 Aug 2023 15:49:23 -0400 Subject: [PATCH 12/21] Added fake regression --- regression-tests/msal-node/client-credential/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index b5b7bc9aa4..3a3aeee1bd 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -69,12 +69,14 @@ const lastResourceRequest = { suite .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", { "fn": async () => { + await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); }, "minSamples": 150, }) .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", { "fn": async () => { + await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); }, "minSamples": 150, @@ -85,3 +87,7 @@ const lastResourceRequest = { }) .run({ "async": true }); })(); + +const sleep = (ms) => { + return new Promise(resolve => setTimeout(resolve, ms)); +} From 9fdec9a69913f3451f271dfc00aeadf4913ce55f Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Tue, 8 Aug 2023 19:42:23 -0400 Subject: [PATCH 13/21] Removed fake regression --- regression-tests/msal-node/client-credential/index.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/regression-tests/msal-node/client-credential/index.js b/regression-tests/msal-node/client-credential/index.js index 3a3aeee1bd..b5b7bc9aa4 100644 --- a/regression-tests/msal-node/client-credential/index.js +++ b/regression-tests/msal-node/client-credential/index.js @@ -69,14 +69,12 @@ const lastResourceRequest = { suite .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsFirstItemInTheCache", { "fn": async () => { - await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(firstResourceRequest); }, "minSamples": 150, }) .add("ConfidentialClientApplication#acquireTokenByClientCredential-fromCache-resourceIsLastItemInTheCache", { "fn": async () => { - await sleep(10); await confidentialClientApplication.acquireTokenByClientCredential(lastResourceRequest); }, "minSamples": 150, @@ -87,7 +85,3 @@ const lastResourceRequest = { }) .run({ "async": true }); })(); - -const sleep = (ms) => { - return new Promise(resolve => setTimeout(resolve, ms)); -} From b8dab61e1ef96c268d8373a846b868c1aa2c62d4 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Tue, 8 Aug 2023 19:55:15 -0400 Subject: [PATCH 14/21] Finalized workflow file --- .github/workflows/gh-pages.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index c453dfa4a2..a763992c41 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,19 +1,8 @@ # Do not run this workflow on pull request since this workflow has permission to modify contents. -# on: -# push: -# branches: -# - dev on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - paths: - - "regression-tests/msal-node/client-credential/*" - - "lib/msal-node/**/*" - - "lib/msal-common/**/*" - - "!**.md" - - ".github/workflows/client-credential.yml" - merge_group: - types: [checks_requested] + push: + branches: + - dev permissions: # deployments permission to deploy GitHub pages website From 32d78457d53af89f24096814dcf9e0d902f4ec94 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Tue, 8 Aug 2023 20:41:47 -0400 Subject: [PATCH 15/21] Implemented GitHub Feedback --- .github/workflows/client-credential.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential.yml index 66ae6c20f8..8dc1db8587 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential.yml @@ -1,5 +1,8 @@ name: msal-node client-credential Regression Test on: + # Allows manual triggering of workflow + workflow_dispatch: + pull_request: types: [opened, reopened, synchronize, ready_for_review] paths: @@ -8,6 +11,7 @@ on: - "lib/msal-common/**/*" - "!**.md" - ".github/workflows/client-credential.yml" + merge_group: types: [checks_requested] @@ -39,7 +43,7 @@ jobs: external-data-json-path: ./cache/client-credential-benchmark-data.json github-token: ${{ secrets.GITHUB_TOKEN }} # Show alert with commit comment on detecting possible performance regression - alert-threshold: '10%' + alert-threshold: '110%' comment-on-alert: true fail-on-alert: false alert-comment-cc-users: '@bgavrilMS @robbie-microsoft' From 4d2f7481ab39cf3ecfdf71d882ad853529b977cc Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Wed, 9 Aug 2023 17:20:00 -0400 Subject: [PATCH 16/21] Testing push to gh-pages branch --- .github/workflows/gh-pages.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index a763992c41..c453dfa4a2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,8 +1,19 @@ # Do not run this workflow on pull request since this workflow has permission to modify contents. +# on: +# push: +# branches: +# - dev on: - push: - branches: - - dev + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + paths: + - "regression-tests/msal-node/client-credential/*" + - "lib/msal-node/**/*" + - "lib/msal-common/**/*" + - "!**.md" + - ".github/workflows/client-credential.yml" + merge_group: + types: [checks_requested] permissions: # deployments permission to deploy GitHub pages website From 6f771671165dce69c071ac2a7dbc7838791ab2fb Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Wed, 9 Aug 2023 17:37:41 -0400 Subject: [PATCH 17/21] Removing testing that determined typedocs and performance data can both exist on the gh-pages branch --- .github/workflows/gh-pages.yml | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index c453dfa4a2..a763992c41 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,19 +1,8 @@ # Do not run this workflow on pull request since this workflow has permission to modify contents. -# on: -# push: -# branches: -# - dev on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - paths: - - "regression-tests/msal-node/client-credential/*" - - "lib/msal-node/**/*" - - "lib/msal-common/**/*" - - "!**.md" - - ".github/workflows/client-credential.yml" - merge_group: - types: [checks_requested] + push: + branches: + - dev permissions: # deployments permission to deploy GitHub pages website From 216609107928110c4f80888359daed00bf32e188 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Tue, 29 Aug 2023 17:06:50 -0400 Subject: [PATCH 18/21] Added all confidential client devs to codeowners for confidential client regression tests --- CODEOWNERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CODEOWNERS b/CODEOWNERS index ab95356f46..d52e8c7ac1 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -16,6 +16,9 @@ /samples/msal-node-samples/ @sameerag @tnorling @hectormmg @peterzenz @bgavrilMS @robbie-microsoft /extensions/msal-node-extensions/ @sameerag @tnorling @hectormmg @peterzenz +# MSAL Node Confidential Client Regression Tests +/regression-tests/msal-node/ @bgavrilMS @robbie-microsoft @trwalke @pmaytak @gladjohn @neha-bhargava @rayluo @Avery-Dunn + # MSAL React /lib/msal-react/ @tnorling @jo-arroyo @peterzenz /samples/msal-react-samples/ @tnorling @jo-arroyo @peterzenz From 9875ec23c7773b96688999aac5bf020634dad59a Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Wed, 30 Aug 2023 15:19:02 -0400 Subject: [PATCH 19/21] Renamed files. Removed code from .yml for testing purposes. --- ...edential.yml => client-credential-benchmark.yml} | 3 --- ...=> msal-node-confidential-client-benchmarks.yml} | 13 ++++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) rename .github/workflows/{client-credential.yml => client-credential-benchmark.yml} (97%) rename .github/workflows/{gh-pages.yml => msal-node-confidential-client-benchmarks.yml} (79%) diff --git a/.github/workflows/client-credential.yml b/.github/workflows/client-credential-benchmark.yml similarity index 97% rename from .github/workflows/client-credential.yml rename to .github/workflows/client-credential-benchmark.yml index 8dc1db8587..d2e30e4043 100644 --- a/.github/workflows/client-credential.yml +++ b/.github/workflows/client-credential-benchmark.yml @@ -15,9 +15,6 @@ on: merge_group: types: [checks_requested] -permissions: - contents: write - jobs: benchmark: name: Run msal-node client-credential Regression Test diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/msal-node-confidential-client-benchmarks.yml similarity index 79% rename from .github/workflows/gh-pages.yml rename to .github/workflows/msal-node-confidential-client-benchmarks.yml index a763992c41..76a2bc216b 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/msal-node-confidential-client-benchmarks.yml @@ -1,8 +1,15 @@ # Do not run this workflow on pull request since this workflow has permission to modify contents. on: - push: - branches: - - dev + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + paths: + - "regression-tests/msal-node/client-credential/*" + - "lib/msal-node/**/*" + - "lib/msal-common/**/*" + - "!**.md" + - ".github/workflows/client-credential.yml" + merge_group: + types: [checks_requested] permissions: # deployments permission to deploy GitHub pages website From 44e4fa912d5fd392e633446be6ad09723982b111 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Wed, 30 Aug 2023 15:34:41 -0400 Subject: [PATCH 20/21] Removed code from .yml that was for testing purposes --- .../msal-node-confidential-client-benchmarks.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/msal-node-confidential-client-benchmarks.yml b/.github/workflows/msal-node-confidential-client-benchmarks.yml index 76a2bc216b..a763992c41 100644 --- a/.github/workflows/msal-node-confidential-client-benchmarks.yml +++ b/.github/workflows/msal-node-confidential-client-benchmarks.yml @@ -1,15 +1,8 @@ # Do not run this workflow on pull request since this workflow has permission to modify contents. on: - pull_request: - types: [opened, reopened, synchronize, ready_for_review] - paths: - - "regression-tests/msal-node/client-credential/*" - - "lib/msal-node/**/*" - - "lib/msal-common/**/*" - - "!**.md" - - ".github/workflows/client-credential.yml" - merge_group: - types: [checks_requested] + push: + branches: + - dev permissions: # deployments permission to deploy GitHub pages website From 4ace75b4cbe4226b49bebf1edc0c8aab2546d936 Mon Sep 17 00:00:00 2001 From: Robbie Ginsburg Date: Wed, 30 Aug 2023 17:13:00 -0400 Subject: [PATCH 21/21] Implemented gitHub Feedback --- .../msal-node/client-credential/.gitignore | 3 +- .../client-credential/package-lock.json | 281 ------------------ .../msal-node/client-credential/package.json | 2 +- 3 files changed, 3 insertions(+), 283 deletions(-) delete mode 100644 regression-tests/msal-node/client-credential/package-lock.json diff --git a/regression-tests/msal-node/client-credential/.gitignore b/regression-tests/msal-node/client-credential/.gitignore index 40b878db5b..ccb2c800f0 100644 --- a/regression-tests/msal-node/client-credential/.gitignore +++ b/regression-tests/msal-node/client-credential/.gitignore @@ -1 +1,2 @@ -node_modules/ \ No newline at end of file +node_modules/ +package-lock.json \ No newline at end of file diff --git a/regression-tests/msal-node/client-credential/package-lock.json b/regression-tests/msal-node/client-credential/package-lock.json deleted file mode 100644 index d5e2d2af7e..0000000000 --- a/regression-tests/msal-node/client-credential/package-lock.json +++ /dev/null @@ -1,281 +0,0 @@ -{ - "name": "client-credential", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "client-credential", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "@azure/msal-node": "^1.18.0", - "benchmark": "^2.1.4" - } - }, - "node_modules/@azure/msal-common": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-13.2.0.tgz", - "integrity": "sha512-rnstQ7Zgn3fSTKNQO+/YNV34/QXJs0vni7IA0/3QB1EEyrJg14xyRmTqlw9ta+pdSuT5OJwUP8kI3D/rBwUIBw==", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@azure/msal-node": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-1.18.0.tgz", - "integrity": "sha512-N6GX1Twxw524e7gaJvj7hKtrPRmZl9qGY7U4pmUdx4XzoWYRFfYk4H1ZjVhQ7pwb5Ks88NNhbXVCagsuYPTEFg==", - "dependencies": { - "@azure/msal-common": "13.2.0", - "jsonwebtoken": "^9.0.0", - "uuid": "^8.3.0" - }, - "engines": { - "node": "10 || 12 || 14 || 16 || 18" - } - }, - "node_modules/benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==", - "dependencies": { - "lodash": "^4.17.4", - "platform": "^1.3.3" - } - }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jsonwebtoken": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", - "integrity": "sha512-K8wx7eJ5TPvEjuiVSkv167EVboBDv9PZdDoF7BgeQnBLVvZWW9clr2PsQHVJDTKaEIH5JBIwHujGcHp7GgI2eg==", - "dependencies": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - }, - "engines": { - "node": ">=12", - "npm": ">=6" - } - }, - "node_modules/jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - }, - "dependencies": { - "@azure/msal-common": { - "version": "13.2.0", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-13.2.0.tgz", - "integrity": "sha512-rnstQ7Zgn3fSTKNQO+/YNV34/QXJs0vni7IA0/3QB1EEyrJg14xyRmTqlw9ta+pdSuT5OJwUP8kI3D/rBwUIBw==" - }, - "@azure/msal-node": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-1.18.0.tgz", - "integrity": "sha512-N6GX1Twxw524e7gaJvj7hKtrPRmZl9qGY7U4pmUdx4XzoWYRFfYk4H1ZjVhQ7pwb5Ks88NNhbXVCagsuYPTEFg==", - "requires": { - "@azure/msal-common": "13.2.0", - "jsonwebtoken": "^9.0.0", - "uuid": "^8.3.0" - } - }, - "benchmark": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", - "integrity": "sha512-l9MlfN4M1K/H2fbhfMy3B7vJd6AGKJVQn2h6Sg/Yx+KckoUA7ewS5Vv6TjSq18ooE1kS9hhAlQRH3AkXIh/aOQ==", - "requires": { - "lodash": "^4.17.4", - "platform": "^1.3.3" - } - }, - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==" - }, - "ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "jsonwebtoken": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz", - "integrity": "sha512-K8wx7eJ5TPvEjuiVSkv167EVboBDv9PZdDoF7BgeQnBLVvZWW9clr2PsQHVJDTKaEIH5JBIwHujGcHp7GgI2eg==", - "requires": { - "jws": "^3.2.2", - "lodash": "^4.17.21", - "ms": "^2.1.1", - "semver": "^7.3.8" - } - }, - "jwa": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", - "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", - "requires": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "platform": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", - "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - } - } -} diff --git a/regression-tests/msal-node/client-credential/package.json b/regression-tests/msal-node/client-credential/package.json index f464545e7e..d02e4aef97 100644 --- a/regression-tests/msal-node/client-credential/package.json +++ b/regression-tests/msal-node/client-credential/package.json @@ -10,7 +10,7 @@ "author": "", "license": "MIT", "dependencies": { - "@azure/msal-node": "^1.18.0", + "@azure/msal-node": "^2.0.0", "benchmark": "^2.1.4" } } \ No newline at end of file