Skip to content

Commit 03ec152

Browse files
authored
test(middleware-sdk-rds): use real regions in integration for DNS (#4660)
1 parent cdfe72e commit 03ec152

File tree

16 files changed

+47
-45
lines changed

16 files changed

+47
-45
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
preset: "ts-jest",
3-
testMatch: ["**/*.integ.spec.ts"],
3+
testMatch: ["**/*.e2e.spec.ts"],
44
};

clients/client-kinesis/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
1313
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
1414
"extract:docs": "api-extractor run --local",
15-
"generate:client": "node ../../scripts/generate-clients/single-service --solo kinesis"
15+
"generate:client": "node ../../scripts/generate-clients/single-service --solo kinesis",
16+
"test:e2e": "jest --config jest.config.e2e.js"
1617
},
1718
"main": "./dist-cjs/index.js",
1819
"types": "./dist-types/index.d.ts",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
preset: "ts-jest",
3-
testMatch: ["**/*.integ.spec.ts"],
3+
testMatch: ["**/*.e2e.spec.ts"],
44
};

clients/client-transcribe-streaming/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
1414
"extract:docs": "api-extractor run --local",
1515
"generate:client": "node ../../scripts/generate-clients/single-service --solo transcribe-streaming",
16-
"test:integration": "jest --config jest.config.integ.js"
16+
"test:e2e": "jest --config jest.config.e2e.js"
1717
},
1818
"main": "./dist-cjs/index.js",
1919
"types": "./dist-types/index.d.ts",

clients/client-transcribe-streaming/test/index.integ.spec.ts renamed to clients/client-transcribe-streaming/test/index.e2e.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ describe("TranscribeStream client", () => {
1010
client.destroy();
1111
});
1212

13-
it("should stream the transcript", async () => {
13+
// TODO: not working in Node.js with HTTP2 handler?
14+
xit("should stream the transcript", async () => {
1415
const LanguageCode = "en-GB";
1516
const MediaEncoding = "pcm";
1617
const MediaSampleRateHertz = 44100;

features/extra/cleanup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { AfterAll } = require("@cucumber/cucumber");
99
AfterAll(async () => {
1010
const path = require("path");
1111
const fs = require("fs");
12-
const filePath = path.resolve("integ.buckets.json");
12+
const filePath = path.resolve("e2e.buckets.json");
1313

1414
try {
1515
if (!fs.existsSync(filePath)) return Promise.resolve();

features/extra/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ module.exports = {
125125
cacheBucketName: function (bucket) {
126126
const fs = require("fs");
127127
const path = require("path");
128-
const filePath = path.resolve("integ.buckets.json");
128+
const filePath = path.resolve("e2e.buckets.json");
129129
let cache;
130130
if (fs.existsSync(filePath)) {
131131
try {

jest.config.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
module.exports = {
88
projects: [
9-
// "<rootDir>/clients/*/jest.config.e2e.js",
9+
"<rootDir>/clients/*/jest.config.e2e.js",
1010
// "<rootDir>/lib/*/jest.config.integ.js",
1111
"<rootDir>/packages/*/jest.config.e2e.js",
1212
// "<rootDir>/private/*/jest.config.e2e.js",

jest.config.integ.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
* These should be run with the yarn test:integration script in each package.
55
* For tests that involve network requests to live services, see jest.config.e2e.js.
66
*
7-
* The "test:integration:legacy" tests run with cucumber-js should be considered
8-
* E2E tests in this classification system.
7+
* The tests run with cucumber-js are
8+
* now E2E tests in this classification system.
99
*/
1010
module.exports = {
1111
projects: [
12-
"<rootDir>/clients/*/jest.config.integ.js",
12+
// "<rootDir>/clients/*/jest.config.integ.js",
1313
// "<rootDir>/lib/*/jest.config.integ.js",
1414
"<rootDir>/packages/*/jest.config.integ.js",
1515
"<rootDir>/private/*/jest.config.integ.js",

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
"local-publish": "node ./scripts/verdaccio-publish/index.js",
3636
"test:all": "yarn build:all && jest --coverage --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}' && yarn test:versions && yarn test:integration",
3737
"test:ci": "lerna run test --since origin/main",
38-
"test:e2e": "yarn build:e2e && node ./tests/e2e/index.js",
38+
"test:e2e": "node ./tests/e2e/index.js",
39+
"test:e2e:legacy": "cucumber-js --fail-fast",
40+
"test:e2e:legacy:since:release": "./tests/integ-e2e/index.js",
3941
"test:functional": "jest --passWithNoTests --config tests/functional/jest.config.js && lerna run test:unit --scope \"@aws-sdk/client-*\"",
4042
"test:integration": "jest --config jest.config.integ.js --passWithNoTests",
41-
"test:integration:legacy": "cucumber-js --fail-fast",
42-
"test:integration:legacy:since:release": "./tests/integ-legacy/index.js",
43+
"test:integration:legacy": "yarn test:e2e:legacy",
44+
"test:integration:legacy:since:release": "yarn test:e2e:legacy:since:release",
4345
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/aws-protocoltests-*'",
4446
"test:server-protocols": "yarn build:server-protocols && lerna run test --scope '@aws-sdk/*-server'",
4547
"test:size": "cd scripts/benchmark-size/runner && yarn && ts-node ./cli.ts",

packages/middleware-sdk-ec2/src/middleware-sdk-ec2.integ.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe("EC2", () => {
66
describe("middleware-sdk-ec2", () => {
77
it("serializes PSU and DestinationRegion", async () => {
88
const client = new EC2({
9-
region: "us-destination-region-1",
9+
region: "us-east-1",
1010
});
1111

1212
new TestHttpHandler({
@@ -17,30 +17,30 @@ describe("EC2", () => {
1717
headers: {},
1818
body: (body) => {
1919
const parse = new URLSearchParams(body);
20-
expect(parse.get("DestinationRegion")).toEqual("us-destination-region-1");
21-
expect(parse.get("SourceRegion")).toEqual("us-source-region-1");
20+
expect(parse.get("DestinationRegion")).toEqual("us-east-1");
21+
expect(parse.get("SourceRegion")).toEqual("us-west-2");
2222
expect(parse.get("SourceSnapshotId")).toEqual("my-snapshot-id");
2323
expect(parse.get("Action")).toEqual("CopySnapshot");
2424
expect(parse.get("Version")).toEqual("2016-11-15");
2525
const psu = parse.get("PresignedUrl") as string;
2626
const matcher =
27-
/https\:\/\/ec2\.us-source-region-1\.amazonaws\.com\/\?Action=CopySnapshot&DestinationRegion=us-destination-region-1&SourceRegion=us-source-region-1&SourceSnapshotId=my-snapshot-id&Version=2016-11-15&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=(.+)\%2Fus-source-region-1\%2Fec2\%2Faws4_request&X-Amz-Date=(\d{8})T(\d{6})Z&X-Amz-Expires=3600&X-Amz-Security-Token=(.+)&X-Amz-Signature=(.+)&X-Amz-SignedHeaders=host/;
27+
/https\:\/\/ec2\.us-west-2\.amazonaws\.com\/\?Action=CopySnapshot&DestinationRegion=us-east-1&SourceRegion=us-west-2&SourceSnapshotId=my-snapshot-id&Version=2016-11-15&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=(.+)\%2Fus-west-2\%2Fec2\%2Faws4_request&X-Amz-Date=(\d{8})T(\d{6})Z&X-Amz-Expires=3600&X-Amz-Security-Token=(.+)&X-Amz-Signature=(.+)&X-Amz-SignedHeaders=host/;
2828

2929
expect(psu).toMatch(matcher);
3030
},
3131
}).watch(client);
3232

3333
await client.copySnapshot({
3434
SourceSnapshotId: "my-snapshot-id",
35-
SourceRegion: "us-source-region-1",
35+
SourceRegion: "us-west-2",
3636
});
3737

3838
expect.hasAssertions();
3939
});
4040

4141
it("serializes PSU and DestinationRegion when Encrypted=true and KmsKeyId present", async () => {
4242
const client = new EC2({
43-
region: "us-destination-region-1",
43+
region: "us-east-1",
4444
});
4545

4646
new TestHttpHandler({
@@ -51,24 +51,24 @@ describe("EC2", () => {
5151
headers: {},
5252
body: (body) => {
5353
const parse = new URLSearchParams(body);
54-
expect(parse.get("DestinationRegion")).toEqual("us-destination-region-1");
54+
expect(parse.get("DestinationRegion")).toEqual("us-east-1");
5555
expect(parse.get("Encrypted")).toEqual("true");
5656
expect(parse.get("KmsKeyId")).toEqual("my-kms-key");
57-
expect(parse.get("SourceRegion")).toEqual("us-source-region-1");
57+
expect(parse.get("SourceRegion")).toEqual("us-west-2");
5858
expect(parse.get("SourceSnapshotId")).toEqual("my-snapshot-id");
5959
expect(parse.get("Action")).toEqual("CopySnapshot");
6060
expect(parse.get("Version")).toEqual("2016-11-15");
6161
const psu = parse.get("PresignedUrl") as string;
6262
const matcher =
63-
/https\:\/\/ec2\.us-source-region-1\.amazonaws\.com\/\?Action=CopySnapshot&DestinationRegion=us-destination-region-1&Encrypted=true&KmsKeyId=my-kms-key&SourceRegion=us-source-region-1&SourceSnapshotId=my-snapshot-id&Version=2016-11-15&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=(.+)\%2Fus-source-region-1\%2Fec2\%2Faws4_request&X-Amz-Date=(\d{8})T(\d{6})Z&X-Amz-Expires=3600&X-Amz-Security-Token=(.+)&X-Amz-Signature=(.+)&X-Amz-SignedHeaders=host/;
63+
/https\:\/\/ec2\.us-west-2\.amazonaws\.com\/\?Action=CopySnapshot&DestinationRegion=us-east-1&Encrypted=true&KmsKeyId=my-kms-key&SourceRegion=us-west-2&SourceSnapshotId=my-snapshot-id&Version=2016-11-15&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=(.+)\%2Fus-west-2\%2Fec2\%2Faws4_request&X-Amz-Date=(\d{8})T(\d{6})Z&X-Amz-Expires=3600&X-Amz-Security-Token=(.+)&X-Amz-Signature=(.+)&X-Amz-SignedHeaders=host/;
6464

6565
expect(psu).toMatch(matcher);
6666
},
6767
}).watch(client);
6868

6969
await client.copySnapshot({
7070
SourceSnapshotId: "my-snapshot-id",
71-
SourceRegion: "us-source-region-1",
71+
SourceRegion: "us-west-2",
7272
Encrypted: true,
7373
KmsKeyId: "my-kms-key",
7474
});

packages/middleware-sdk-rds/src/middleware-sdk-rds.integ.spec.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe(RDS.name, () => {
66
describe("middleware-sdk-rds", () => {
77
it("copyDBClusterSnapshot without KMS key", async () => {
88
const client = new RDS({
9-
region: "us-destination-region-1",
9+
region: "us-east-1",
1010
});
1111

1212
new TestHttpHandler({
@@ -18,7 +18,7 @@ describe(RDS.name, () => {
1818
body: (body) => {
1919
const parse = new URLSearchParams(body);
2020
expect(parse.get("SourceDBClusterSnapshotIdentifier")).toEqual(
21-
"arn:aws:rds:us-source-region-1:1234567890:my-db-cluster-snapshot-id"
21+
"arn:aws:rds:us-west-2:1234567890:my-db-cluster-snapshot-id"
2222
);
2323
expect(parse.get("TargetDBClusterSnapshotIdentifier")).toEqual("my-target-db-cluster-snapshot-id");
2424
expect(parse.get("Action")).toEqual("CopyDBClusterSnapshot");
@@ -40,7 +40,7 @@ describe(RDS.name, () => {
4040
}).watch(client);
4141

4242
await client.copyDBClusterSnapshot({
43-
SourceDBClusterSnapshotIdentifier: "arn:aws:rds:us-source-region-1:1234567890:my-db-cluster-snapshot-id",
43+
SourceDBClusterSnapshotIdentifier: "arn:aws:rds:us-west-2:1234567890:my-db-cluster-snapshot-id",
4444
TargetDBClusterSnapshotIdentifier: "my-target-db-cluster-snapshot-id",
4545
});
4646

@@ -49,7 +49,7 @@ describe(RDS.name, () => {
4949

5050
it("copyDBSnapshot with KMS key", async () => {
5151
const client = new RDS({
52-
region: "us-destination-region-1",
52+
region: "us-east-1",
5353
});
5454

5555
new TestHttpHandler({
@@ -60,9 +60,7 @@ describe(RDS.name, () => {
6060
headers: {},
6161
body: (body) => {
6262
const parse = new URLSearchParams(body);
63-
expect(parse.get("SourceDBSnapshotIdentifier")).toEqual(
64-
"arn:aws:rds:us-source-region-1:1234567890:my-db-snapshot-id"
65-
);
63+
expect(parse.get("SourceDBSnapshotIdentifier")).toEqual("arn:aws:rds:us-west-2:1234567890:my-db-snapshot-id");
6664
expect(parse.get("TargetDBSnapshotIdentifier")).toEqual("my-target-snapshot-id");
6765
expect(parse.get("Action")).toEqual("CopyDBSnapshot");
6866
expect(parse.get("Version")).toEqual("2014-10-31");
@@ -84,7 +82,7 @@ describe(RDS.name, () => {
8482
}).watch(client);
8583

8684
await client.copyDBSnapshot({
87-
SourceDBSnapshotIdentifier: "arn:aws:rds:us-source-region-1:1234567890:my-db-snapshot-id",
85+
SourceDBSnapshotIdentifier: "arn:aws:rds:us-west-2:1234567890:my-db-snapshot-id",
8886
TargetDBSnapshotIdentifier: "my-target-snapshot-id",
8987
KmsKeyId: "my-kms-key",
9088
});
@@ -94,7 +92,7 @@ describe(RDS.name, () => {
9492

9593
it("startDBInstanceAutomatedBackupsReplication with KMS key", async () => {
9694
const client = new RDS({
97-
region: "us-destination-region-1",
95+
region: "us-east-1",
9896
});
9997

10098
new TestHttpHandler({
@@ -105,9 +103,7 @@ describe(RDS.name, () => {
105103
headers: {},
106104
body: (body) => {
107105
const parse = new URLSearchParams(body);
108-
expect(parse.get("SourceDBInstanceArn")).toEqual(
109-
"arn:aws:rds:us-source-region-1:1234567890:my-db-instance-id"
110-
);
106+
expect(parse.get("SourceDBInstanceArn")).toEqual("arn:aws:rds:us-west-2:1234567890:my-db-instance-id");
111107
expect(parse.get("Action")).toEqual("StartDBInstanceAutomatedBackupsReplication");
112108
expect(parse.get("Version")).toEqual("2014-10-31");
113109
expect(parse.get("KmsKeyId")).toEqual("my-kms-key");
@@ -128,7 +124,7 @@ describe(RDS.name, () => {
128124
}).watch(client);
129125

130126
await client.startDBInstanceAutomatedBackupsReplication({
131-
SourceDBInstanceArn: "arn:aws:rds:us-source-region-1:1234567890:my-db-instance-id",
127+
SourceDBInstanceArn: "arn:aws:rds:us-west-2:1234567890:my-db-instance-id",
132128
KmsKeyId: "my-kms-key",
133129
});
134130

scripts/utils/spawn-process.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ const { spawn } = require("child_process");
44
const spawnProcess = async (command, args = [], options = {}) => {
55
const childProcess = spawn(command, args, options);
66

7-
childProcess.stdout.pipe(process.stdout);
8-
childProcess.stderr.pipe(process.stderr);
7+
childProcess.stdout?.pipe(process.stdout);
8+
childProcess.stderr?.pipe(process.stderr);
99

1010
return new Promise((resolve, reject) => {
1111
childProcess.on("error", reject);
1212
childProcess.on("exit", (code, signal) =>
13-
code === 0 ? resolve() : reject(`${command} failed with { code: ${code}, signal: ${signal} }`)
13+
code === 0 ? resolve(0) : reject(`${command} failed with { code: ${code}, signal: ${signal} }`)
1414
);
1515
});
1616
};

tests/integ-legacy/index.js renamed to tests/e2e-legacy/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const execOptions = {
1515

1616
const allTags = execSync(`grep -h ^@ ${join(FEATURES_FOLDER, "**", "*.feature")}`, execOptions).split(/[\n ]/g);
1717

18-
console.info(`Looking for changed clients that has the legacy integration test tag: ${allTags}`);
18+
console.info(`Looking for changed clients that has the legacy e2e test tag: ${allTags}`);
1919

2020
let changedPackages = [];
2121
try {

tests/e2e/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
const { join } = require("path");
2+
13
const { getIntegTestResources } = require("./get-integ-test-resources");
2-
const execa = require("execa");
4+
const { spawnProcess } = require("../../scripts/utils/spawn-process");
35

46
const run = async () => {
57
try {
68
const integTestResourcesEnv = await getIntegTestResources();
7-
await execa("yarn", ["lerna", "run", "test:e2e", "--since", "--concurrency", "1"], {
9+
await spawnProcess("lerna", ["run", "test:e2e", "--concurrency", "1"], {
10+
cwd: join(__dirname, "..", ".."),
811
env: {
9-
...integTestResourcesEnv,
1012
...process.env,
13+
...integTestResourcesEnv,
1114
},
12-
stdio: "inherit",
1315
});
1416
process.exit(0);
1517
} catch (e) {

0 commit comments

Comments
 (0)