Skip to content

Commit

Permalink
[test] fix flaky test writing temp files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jeremymeng committed Nov 30, 2023
1 parent be35095 commit 158bc2e
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,7 @@ describe("ManagedIdentityCredential", function () {
process.env.IMDS_ENDPOINT = "http://endpoint";
process.env.IDENTITY_ENDPOINT = "http://endpoint";

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

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

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

0 comments on commit 158bc2e

Please sign in to comment.