Skip to content

Commit

Permalink
[identity] Re-enable tests (#29778)
Browse files Browse the repository at this point in the history
Re-enabled tests in playback mode, including better filtering in live
mode to skip the MI tests
  • Loading branch information
maorleger authored May 21, 2024
1 parent 7966d1e commit 8215067
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/identity/identity/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion sdk/identity/identity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions sdk/identity/identity/test/node/msalNodeTestSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions sdk/identity/identity/test/public/node/tokenProvider.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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);

Expand Down
15 changes: 8 additions & 7 deletions sdk/identity/test-resources-pre.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8215067

Please sign in to comment.