Skip to content

Commit 158bc2e

Browse files
committed
[test] fix flaky test writing temp files
These test create temporary folders using test case titles. It started to fail recently likely due to newer NodeJS version 21.3.0. There are some changes around `fs.writeFileSync`. nodejs/node#49884 Same tests were passing on 21.2.0. This PR changes the test to use simpler names.
1 parent be35095 commit 158bc2e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

sdk/identity/identity/test/internal/node/managedIdentityCredential.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,7 @@ describe("ManagedIdentityCredential", function () {
769769
process.env.IMDS_ENDPOINT = "http://endpoint";
770770
process.env.IDENTITY_ENDPOINT = "http://endpoint";
771771

772-
// eslint-disable-next-line @typescript-eslint/no-invalid-this
773-
const testTitle = this.test?.title || `test-Date.time()`;
772+
const testTitle = "azure-arc";
774773
const tempDir = mkdtempSync(join(tmpdir(), testTitle));
775774
const tempFile = join(tempDir, testTitle);
776775
const key = "challenge key";
@@ -838,8 +837,7 @@ describe("ManagedIdentityCredential", function () {
838837
process.env.IMDS_ENDPOINT = "http://endpoint";
839838
process.env.IDENTITY_ENDPOINT = "http://endpoint";
840839

841-
// eslint-disable-next-line @typescript-eslint/no-invalid-this
842-
const testTitle = this.test?.title || `test-Date.time()`;
840+
const testTitle = "azure-arc-with-resource-id";
843841
const tempDir = mkdtempSync(join(tmpdir(), testTitle));
844842
const tempFile = join(tempDir, testTitle);
845843
const key = "challenge key";
@@ -910,8 +908,7 @@ describe("ManagedIdentityCredential", function () {
910908
process.env.IMDS_ENDPOINT = "http://endpoint";
911909
process.env.IDENTITY_ENDPOINT = "http://endpoint";
912910

913-
// eslint-disable-next-line @typescript-eslint/no-invalid-this
914-
const testTitle = this.test?.title || `test-Date.time()`;
911+
const testTitle = "azure-arc-with-client-id";
915912
const tempDir = mkdtempSync(join(tmpdir(), testTitle));
916913
const tempFile = join(tempDir, testTitle);
917914
const key = "challenge key";

0 commit comments

Comments
 (0)