From a878de225e5d437eb22fc79c4280dad766aa2191 Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Tue, 21 May 2024 18:47:10 +0000 Subject: [PATCH 1/4] wip: tests are restored, and skipped integration-tests as needed --- common/config/rush/pnpm-lock.yaml | 2 +- sdk/identity/identity/package.json | 2 +- sdk/identity/test-resources-pre.ps1 | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 13fff5086906..000d05757548 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -21980,7 +21980,7 @@ packages: dev: false file:projects/notification-hubs.tgz: - resolution: {integrity: sha512-wX7n8gHZvyrjovFWVcXBHIvD+rOE1Rh0PX8kImlW7YdHNlwiT/4GkgS/l7pc6Stt/BKqKPhQYoNGsUg2mmkIzA==, tarball: file:projects/notification-hubs.tgz} + resolution: {integrity: sha512-VNk6zld7/oXfKhhFjUhDzBuspNUuYcbRRgewl8i/i/8UPWGgjvlqo9PLlm4/HvOKfdCFpSeYM/iAkxZosIC1Dg==, tarball: file:projects/notification-hubs.tgz} name: '@rush-temp/notification-hubs' version: 0.0.0 dependencies: diff --git a/sdk/identity/identity/package.json b/sdk/identity/identity/package.json index 2d4cda87d6c8..4db1de7fe13c 100644 --- a/sdk/identity/identity/package.json +++ b/sdk/identity/identity/package.json @@ -66,7 +66,7 @@ "test:node": "npm run clean && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && npm run build:test && npm run unit-test && npm run integration-test", "unit-test:browser": "dev-tool run test:browser", - "unit-test:node": "echo skipped", + "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 300000 --exclude 'test/**/browser/**/*.spec.ts' --exclude 'test/integration/**/*.spec.ts' 'test/**/**/*.spec.ts'", "unit-test:node:no-timeouts": "dev-tool run test:node-ts-input -- --timeout Infinite --exclude 'test/**/browser/**/*.spec.ts' 'test/**/**/*.spec.ts'", "unit-test": "npm run unit-test:node && npm run unit-test:browser" }, diff --git a/sdk/identity/test-resources-pre.ps1 b/sdk/identity/test-resources-pre.ps1 index eff212bdacf1..2ff787c1911f 100644 --- a/sdk/identity/test-resources-pre.ps1 +++ b/sdk/identity/test-resources-pre.ps1 @@ -16,6 +16,14 @@ param ( ) +Import-Module -Name $PSScriptRoot/../../eng/common/scripts/X509Certificate2 -Verbose + +Remove-Item $PSScriptRoot/sshKey* -Force +ssh-keygen -t rsa -b 4096 -f $PSScriptRoot/sshKey -N '' -C '' +$sshKey = Get-Content $PSScriptRoot/sshKey.pub + +$templateFileParameters['sshPubKey'] = $sshKey + if (!$CI) { # TODO: Remove this once auto-cloud config downloads are supported locally Write-Host "Skipping cert setup in local testing mode" @@ -45,13 +53,6 @@ Write-Host "##vso[task.setvariable variable=IDENTITY_SP_CERT_PEM;]$pemPath" $env:IDENTITY_SP_CERT_PFX = $pfxPath $env:IDENTITY_SP_CERT_PEM = $pemPath -Import-Module -Name $PSScriptRoot/../../eng/common/scripts/X509Certificate2 -Verbose - -Remove-Item $PSScriptRoot/sshKey* -Force -ssh-keygen -t rsa -b 4096 -f $PSScriptRoot/sshKey -N '' -C '' -$sshKey = Get-Content $PSScriptRoot/sshKey.pub - -$templateFileParameters['sshPubKey'] = $sshKey if ($CI) { # Install this specific version of the Azure CLI to avoid https://github.com/Azure/azure-cli/issues/28358. From 21485171bc93d52ff47e2a7f4a61fc56b9808836 Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Tue, 21 May 2024 19:17:46 +0000 Subject: [PATCH 2/4] one test down --- sdk/identity/identity/test/public/node/tokenProvider.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/identity/identity/test/public/node/tokenProvider.spec.ts b/sdk/identity/identity/test/public/node/tokenProvider.spec.ts index 4d94e591033a..b47bbdf27827 100644 --- a/sdk/identity/identity/test/public/node/tokenProvider.spec.ts +++ b/sdk/identity/identity/test/public/node/tokenProvider.spec.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { EnvironmentCredential, getBearerTokenProvider } from "../../../src"; +import { DefaultAzureCredential, getBearerTokenProvider } from "../../../src"; import { MsalTestCleanup, msalNodeTestSetup } from "../../node/msalNodeTestSetup"; import { Recorder, delay, isPlaybackMode } from "@azure-tools/test-recorder"; import { Context } from "mocha"; @@ -23,7 +23,7 @@ describe("getBearerTokenProvider", function () { const scope = "https://vault.azure.net/.default"; it("returns a callback that returns string tokens", async function () { - const credential = new EnvironmentCredential(recorder.configureClientOptions({})); + const credential = new DefaultAzureCredential(recorder.configureClientOptions({})); const getAccessToken = getBearerTokenProvider(credential, scope); From 02f1c05b65245c2d306ad72ea206db2c1eb96907 Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Tue, 21 May 2024 19:34:29 +0000 Subject: [PATCH 3/4] fix one test --- sdk/identity/identity/test/node/msalNodeTestSetup.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/identity/identity/test/node/msalNodeTestSetup.ts b/sdk/identity/identity/test/node/msalNodeTestSetup.ts index 1284ba60cad7..5040f0a15b09 100644 --- a/sdk/identity/identity/test/node/msalNodeTestSetup.ts +++ b/sdk/identity/identity/test/node/msalNodeTestSetup.ts @@ -121,12 +121,12 @@ export async function msalNodeTestSetup( { regex: true, target: `x-client-OS=[a-zA-Z0-9]+`, - value: `x-client-OS=x-client-OS`, + value: `x-client-OS=Sanitized`, }, { regex: true, target: `x-client-CPU=[a-zA-Z0-9]+`, - value: `x-client-CPU=x-client-CPU`, + value: `x-client-CPU=Sanitized`, }, { regex: true, From d3551c34d45b961181c45f7e1e299090f36a7edf Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Tue, 21 May 2024 19:41:22 +0000 Subject: [PATCH 4/4] update recordings and sanitizers --- sdk/identity/identity/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/identity/identity/assets.json b/sdk/identity/identity/assets.json index 2a0b009b9582..cdec30fa6034 100644 --- a/sdk/identity/identity/assets.json +++ b/sdk/identity/identity/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/identity/identity", - "Tag": "js/identity/identity_a7eb8b7286" + "Tag": "js/identity/identity_41bcaec991" }