From b058c481e0395a924eff0b8d7107ab04b12ee7bf Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Thu, 14 Nov 2024 09:10:32 -0800 Subject: [PATCH 1/3] [identity] Various test fixes --- sdk/identity/identity/package.json | 2 +- .../integration/node/azureKubernetesTest.spec.ts | 2 +- .../public/node/multiTenantAuthentication.spec.ts | 4 ++-- .../identity/vitest.managed-identity.config.ts | 14 ++++++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 sdk/identity/identity/vitest.managed-identity.config.ts diff --git a/sdk/identity/identity/package.json b/sdk/identity/identity/package.json index 1e65c63921bd..2ea548c66903 100644 --- a/sdk/identity/identity/package.json +++ b/sdk/identity/identity/package.json @@ -29,7 +29,7 @@ "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "integration-test:browser": "echo skipped", - "integration-test:managed-identity": "dev-tool run test:vitest -- --test-timeout 180000 'test/integration/**/*.spec.ts'", + "integration-test:managed-identity": "dev-tool run test:vitest -- --test-timeout 180000 --config ./vitest.managed-identity.config.ts", "integration-test:node": "dev-tool run test:vitest -- --test-timeout 180000 'test/public/node/*.spec.ts' 'test/internal/node/*.spec.ts'", "lint": "eslint package.json api-extractor.json src test", "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", diff --git a/sdk/identity/identity/test/integration/node/azureKubernetesTest.spec.ts b/sdk/identity/identity/test/integration/node/azureKubernetesTest.spec.ts index 2f4a241b0f86..51b0c634ec6f 100644 --- a/sdk/identity/identity/test/integration/node/azureKubernetesTest.spec.ts +++ b/sdk/identity/identity/test/integration/node/azureKubernetesTest.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { execSync } from "child_process"; import { isLiveMode } from "@azure-tools/test-recorder"; -import { describe, it, assert, expect, vi, beforeEach, afterEach, beforeAll } from "vitest"; +import { describe, it, assert, beforeEach } from "vitest"; describe("Azure Kubernetes Integration test", function () { let podOutput: string; diff --git a/sdk/identity/identity/test/public/node/multiTenantAuthentication.spec.ts b/sdk/identity/identity/test/public/node/multiTenantAuthentication.spec.ts index 091a13d37be1..c3e542ee85a0 100644 --- a/sdk/identity/identity/test/public/node/multiTenantAuthentication.spec.ts +++ b/sdk/identity/identity/test/public/node/multiTenantAuthentication.spec.ts @@ -8,7 +8,7 @@ import { env } from "@azure-tools/test-recorder"; import { createHttpHeaders, createPipelineRequest } from "@azure/core-rest-pipeline"; import { ClientSecretCredential } from "../../../src/credentials/clientSecretCredential.js"; import { IdentityClient } from "../../../src/client/identityClient.js"; -import { describe, it, assert, expect, vi, beforeEach, afterEach } from "vitest"; +import { describe, it, assert, beforeEach, afterEach } from "vitest"; describe("MultiTenantAuthentication", function () { let cleanup: MsalTestCleanup; @@ -24,7 +24,7 @@ describe("MultiTenantAuthentication", function () { await cleanup(); }); - it("supports calling graph with client secret", async function () { + it("supports calling graph with client secret", async function (ctx) { const [tenantId, clientId, clientSecret] = [ env.AZURE_IDENTITY_MULTI_TENANT_TENANT_ID, env.AZURE_IDENTITY_MULTI_TENANT_CLIENT_ID, diff --git a/sdk/identity/identity/vitest.managed-identity.config.ts b/sdk/identity/identity/vitest.managed-identity.config.ts new file mode 100644 index 000000000000..ab40c26ebe73 --- /dev/null +++ b/sdk/identity/identity/vitest.managed-identity.config.ts @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + include: ["test/integration/**/*.spec.ts"], + }, + }), +); From a33a3188424d2b4c1699f281f0417053e216693a Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Thu, 14 Nov 2024 09:25:05 -0800 Subject: [PATCH 2/3] port over deployment fixes --- sdk/identity/identity/tests.yml | 1 + sdk/identity/test-resources-pre.ps1 | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/identity/identity/tests.yml b/sdk/identity/identity/tests.yml index 6b7e43ec8299..4eb016b19189 100644 --- a/sdk/identity/identity/tests.yml +++ b/sdk/identity/identity/tests.yml @@ -3,6 +3,7 @@ trigger: none extends: template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml parameters: + Location: westus2 PreSteps: - task: AzureCLI@2 displayName: Set OIDC variables diff --git a/sdk/identity/test-resources-pre.ps1 b/sdk/identity/test-resources-pre.ps1 index ae2518b4caa0..6b3c8cb29e90 100644 --- a/sdk/identity/test-resources-pre.ps1 +++ b/sdk/identity/test-resources-pre.ps1 @@ -60,8 +60,6 @@ $env:IDENTITY_SP_CERT_PEM = $pemPath if ($CI) { - # Install this specific version of the Azure CLI to avoid https://github.com/Azure/azure-cli/issues/28358. - pip install azure-cli=="2.56.0" # The owner is a service principal $templateFileParameters['principalUserType'] = 'ServicePrincipal' Write-Host "Sleeping for a bit to ensure service principal is ready." From 43ee5f1aefe9f98e36f5ef7c6525277f030c4ede Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Thu, 14 Nov 2024 09:50:59 -0800 Subject: [PATCH 3/3] Revert "port over deployment fixes" This reverts commit a33a3188424d2b4c1699f281f0417053e216693a. --- sdk/identity/identity/tests.yml | 1 - sdk/identity/test-resources-pre.ps1 | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/identity/identity/tests.yml b/sdk/identity/identity/tests.yml index 4eb016b19189..6b7e43ec8299 100644 --- a/sdk/identity/identity/tests.yml +++ b/sdk/identity/identity/tests.yml @@ -3,7 +3,6 @@ trigger: none extends: template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml parameters: - Location: westus2 PreSteps: - task: AzureCLI@2 displayName: Set OIDC variables diff --git a/sdk/identity/test-resources-pre.ps1 b/sdk/identity/test-resources-pre.ps1 index 6b3c8cb29e90..ae2518b4caa0 100644 --- a/sdk/identity/test-resources-pre.ps1 +++ b/sdk/identity/test-resources-pre.ps1 @@ -60,6 +60,8 @@ $env:IDENTITY_SP_CERT_PEM = $pemPath if ($CI) { + # Install this specific version of the Azure CLI to avoid https://github.com/Azure/azure-cli/issues/28358. + pip install azure-cli=="2.56.0" # The owner is a service principal $templateFileParameters['principalUserType'] = 'ServicePrincipal' Write-Host "Sleeping for a bit to ensure service principal is ready."