Skip to content

Commit

Permalink
one very simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
sadasant authored Jun 21, 2021
1 parent a9cd5e0 commit cd809de
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
import { MockAuthHttpClient, MockAuthHttpClientOptions, assertRejects } from "../../authTestUtils";
import { OAuthErrorResponse } from "../../../src/client/errors";
import Sinon from "sinon";
import { imdsMsiRetryConfig } from "../../../src/credentials/managedIdentityCredential/imdsMsi";
import {
imdsMsi,
imdsMsiRetryConfig
} from "../../../src/credentials/managedIdentityCredential/imdsMsi";
import { mkdtempSync, rmdirSync, unlinkSync, writeFileSync } from "fs";
import { join } from "path";
import { tmpdir } from "os";
Expand Down Expand Up @@ -52,6 +55,7 @@ describe("ManagedIdentityCredential", function() {
process.env.MSI_SECRET = env.MSI_SECRET;
process.env.IDENTITY_SERVER_THUMBPRINT = env.IDENTITY_SERVER_THUMBPRINT;
process.env.IMDS_ENDPOINT = env.IMDS_ENDPOINT;
process.env.AZURE_POD_IDENTITY_TOKEN_URL = env.AZURE_POD_IDENTITY_TOKEN_URL;
sandbox.restore();
clock.restore();
});
Expand Down Expand Up @@ -248,6 +252,12 @@ describe("ManagedIdentityCredential", function() {
);
});

it("IMDS MSI skips verification if the AZURE_POD_IDENTITY_TOKEN_URL environment variable is available", async function() {
process.env.AZURE_POD_IDENTITY_TOKEN_URL = "token URL";

assert.ok(await imdsMsi.isAvailable());
});

// Unavailable exception throws while IMDS endpoint is unavailable. This test not valid.
// it("can extend timeout for IMDS endpoint", async function() {
// // Mock a timeout so that the endpoint ping fails
Expand Down

0 comments on commit cd809de

Please sign in to comment.