Skip to content

Commit

Permalink
feat(credential-provider-imds): adjust static stability expiration to…
Browse files Browse the repository at this point in the history
… 5-10 mins (#3575)
  • Loading branch information
AllanZhengYP committed Apr 28, 2022
1 parent d9f1522 commit 0a12a1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ describe("getExtendedInstanceMetadataCredentials()", () => {
nowMock.mockRestore();
});

it("should extend the expiration random time(~15 mins) from now", () => {
it("should extend the expiration random time(5~10 mins) from now", () => {
const anyDate: Date = "any date" as unknown as Date;
(Math.random as jest.Mock).mockReturnValue(0.5);
expect(getExtendedInstanceMetadataCredentials({ ...staticSecret, expiration: anyDate }, logger)).toEqual({
...staticSecret,
originalExpiration: anyDate,
expiration: new Date("2022-02-22T00:17:30Z"),
expiration: new Date("2022-02-22T00:07:30Z"),
});
expect(Math.random).toBeCalledTimes(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Logger } from "@aws-sdk/types";

import { InstanceMetadataCredentials } from "../types";

const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 15 * 60;
const STATIC_STABILITY_REFRESH_INTERVAL_SECONDS = 5 * 60;
const STATIC_STABILITY_REFRESH_INTERVAL_JITTER_WINDOW_SECONDS = 5 * 60;
const STATIC_STABILITY_DOC_URL = "https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html";

Expand Down

0 comments on commit 0a12a1e

Please sign in to comment.