Skip to content

Commit c3c5cb8

Browse files
committed
test: stub credential provder integ tests
1 parent 8eb9ff9 commit c3c5cb8

14 files changed

+168
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { describe, test as it } from "vitest";
2+
3+
describe("placeholder for testing lib", () => {
4+
it("", () => {});
5+
});
6+
7+
export type CredentialTestParameters = {
8+
// has caller context client
9+
withCaller: boolean;
10+
// has region specified on the caller client
11+
codeRegion: boolean;
12+
// AWS_REGION is set
13+
envRegion: boolean;
14+
// profile regions are set
15+
profileRegion: boolean;
16+
// provider itself has a clientConfig.region
17+
providerRegion: boolean;
18+
// profile name
19+
profile: string | undefined;
20+
};
21+
22+
function serializeParams(params: CredentialTestParameters) {
23+
let buffer = "";
24+
for (const [key, value] of Object.entries(params)) {
25+
if (typeof value === "boolean") {
26+
if (value) {
27+
buffer += ` ${key},`;
28+
}
29+
} else {
30+
buffer += ` ${key} = ${value},`;
31+
}
32+
}
33+
return buffer;
34+
}
35+
36+
export function test() {
37+
for (const withCaller of [true, false]) {
38+
for (const codeRegion of [true, false]) {
39+
for (const envRegion of [true, false]) {
40+
for (const profileRegion of [true, false]) {
41+
for (const providerRegion of [true, false]) {
42+
for (const profile of ["default", "alt", undefined]) {
43+
if (!codeRegion && !profileRegion && !envRegion) {
44+
continue;
45+
}
46+
47+
const params = {
48+
withCaller,
49+
codeRegion,
50+
envRegion,
51+
profileRegion,
52+
providerRegion,
53+
profile,
54+
};
55+
56+
it(`${serializeParams(params)}`, async () => {
57+
// const region = await resolveStsRegion(params);
58+
//
59+
// if (providerRegion) {
60+
// expect(region).toBe("provider-region");
61+
// return;
62+
// }
63+
//
64+
// if (profileRegion) {
65+
// expect(region).toBe(`${profile ?? "default"}-profile-region`);
66+
// return;
67+
// }
68+
//
69+
// if (codeRegion && withCaller) {
70+
// expect(region).toBe("code-region");
71+
// return;
72+
// }
73+
//
74+
// if (envRegion) {
75+
// expect(region).toBe("env-region");
76+
// return;
77+
// }
78+
//
79+
// expect(region).toBe("us-east-1");
80+
});
81+
}
82+
}
83+
}
84+
}
85+
}
86+
}
87+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromCognitoIdentity } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromCognitoIdentity.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromCognitoIdentityPool } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromCognitoIdentityPool.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromContainerMetadata } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromContainerMetadata.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromEnv } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromEnv.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromHttp } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromHttp.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromIni } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromIni.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromInstanceMetadata } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromInstanceMetadata.name, () => {
5+
it("placeholder", () => {});
6+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromNodeProviderChain.name, () => {
5+
it("placeholder", () => {
6+
// Most tests related to this provider are in the credential provider node integration suite.
7+
// They can be moved here in the future, or separate tests can be written here.
8+
});
9+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { fromProcess } from "@aws-sdk/credential-providers";
2+
import { describe, test as it } from "vitest";
3+
4+
describe(fromProcess.name, () => {
5+
it("placeholder", () => {});
6+
});

0 commit comments

Comments
 (0)