Skip to content

Commit 16f81f6

Browse files
authored
feat: protocol test codegen project + service clients (#1058)
* Add project for protocol test codegen This commit adds a separate Gradle project that depends on the published version of the smithy-aws-protocol-tests. This new project contains 1 projection for each protocol, generating the full AWS SDK for JS V3 client and test suite for each contained service. * Add generated protocol tests This commit adds the protocol tests generated by the protocol-test-codegen project to the repository. It enables their building and running through the use of new package level commands, build:protocols and test:protocols.
1 parent b5f038b commit 16f81f6

File tree

198 files changed

+48098
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+48098
-11
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jspm_packages
1919
*.tgz
2020
.yarn-integrity
2121

22+
.vscode/launch.json
23+
2224
lerna-debug.log
2325
package-lock.json
2426

@@ -30,3 +32,7 @@ codegen/sdk-codegen/smithy-build.json
3032
.gradle
3133
*/out/
3234
*/*/out/
35+
36+
protocol_tests/*/coverage
37+
protocol_tests/*/dist
38+
protocol_tests/*/types

buildspec.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ phases:
66
nodejs: 10
77
build:
88
commands:
9+
# Fake credentials for protocol tests to get past signing.
10+
- export AWS_ACCESS_KEY_ID=foo
11+
- export AWS_SECRET_ACCESS_KEY=bar
912
- echo Building...
1013
- yarn --frozen-lockfile
14+
# Run the actual tests.
1115
- echo Executing unit tests
1216
- yarn test:all
1317
- echo Executing functional test
1418
- yarn test:functional
1519
post_build:
1620
commands:
21+
# Handle code coverage.
1722
- ./node_modules/.bin/codecov -f coverage/*.json -t 26989a8c-a2e9-4e6f-844a-35a741240b60
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
import software.amazon.smithy.gradle.tasks.SmithyBuild
17+
18+
plugins {
19+
id("software.amazon.smithy") version "0.4.3"
20+
}
21+
22+
dependencies {
23+
implementation("software.amazon.smithy:smithy-aws-protocol-tests:0.9.8")
24+
compile(project(":smithy-aws-typescript-codegen"))
25+
}
26+
27+
// This project doesn't produce a JAR.
28+
tasks["jar"].enabled = false
29+
30+
// Run the SmithyBuild task manually since this project needs the built JAR
31+
// from smithy-aws-typescript-codegen.
32+
tasks["smithyBuildJar"].enabled = false
33+
34+
tasks.create<SmithyBuild>("buildSdk") {
35+
addRuntimeClasspath = true
36+
}
37+
38+
// Run the `buildSdk` automatically.
39+
tasks["build"].finalizedBy(tasks["buildSdk"])
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"version": "1.0",
3+
"projections": {
4+
"aws-ec2": {
5+
"transforms": [
6+
{"name": "includeServices", "args": ["aws.protocols.tests.ec2#AwsEc2"]}
7+
],
8+
"plugins": {
9+
"typescript-codegen": {
10+
"package": "@aws-sdk/protocol-tests-aws-ec2",
11+
"packageVersion": "1.0.0-alpha.1",
12+
"packageJson": {
13+
"author": {
14+
"name": "AWS SDK for JavaScript Team",
15+
"url": "https://aws.amazon.com/javascript/"
16+
},
17+
"license": "Apache-2.0"
18+
},
19+
"protocol": "aws.ec2",
20+
"private": true
21+
}
22+
}
23+
},
24+
"aws-json": {
25+
"transforms": [
26+
{"name": "includeServices", "args": ["aws.protocols.tests.json#JsonProtocol"]}
27+
],
28+
"plugins": {
29+
"typescript-codegen": {
30+
"package": "@aws-sdk/protocol-tests-aws-json",
31+
"packageVersion": "1.0.0-alpha.1",
32+
"packageJson": {
33+
"author": {
34+
"name": "AWS SDK for JavaScript Team",
35+
"url": "https://aws.amazon.com/javascript/"
36+
},
37+
"license": "Apache-2.0"
38+
},
39+
"protocol": "aws.json-1.1",
40+
"private": true
41+
}
42+
}
43+
},
44+
"aws-query": {
45+
"transforms": [
46+
{"name": "includeServices", "args": ["aws.protocols.tests.query#AwsQuery"]}
47+
],
48+
"plugins": {
49+
"typescript-codegen": {
50+
"package": "@aws-sdk/protocol-tests-aws-query",
51+
"packageVersion": "1.0.0-alpha.1",
52+
"packageJson": {
53+
"author": {
54+
"name": "AWS SDK for JavaScript Team",
55+
"url": "https://aws.amazon.com/javascript/"
56+
},
57+
"license": "Apache-2.0"
58+
},
59+
"protocol": "aws.query",
60+
"private": true
61+
}
62+
}
63+
},
64+
"aws-restjson": {
65+
"transforms": [
66+
{"name": "includeServices", "args": ["aws.protocols.tests.restjson#RestJson"]}
67+
],
68+
"plugins": {
69+
"typescript-codegen": {
70+
"package": "@aws-sdk/protocol-tests-aws-restjson",
71+
"packageVersion": "1.0.0-alpha.1",
72+
"packageJson": {
73+
"author": {
74+
"name": "AWS SDK for JavaScript Team",
75+
"url": "https://aws.amazon.com/javascript/"
76+
},
77+
"license": "Apache-2.0"
78+
},
79+
"protocol": "aws.rest-json-1.1",
80+
"private": true
81+
}
82+
}
83+
},
84+
"aws-restxml": {
85+
"transforms": [
86+
{"name": "includeServices", "args": ["aws.protocols.tests.restxml#RestXml"]}
87+
],
88+
"plugins": {
89+
"typescript-codegen": {
90+
"package": "@aws-sdk/protocol-tests-aws-restxml",
91+
"packageVersion": "1.0.0-alpha.1",
92+
"packageJson": {
93+
"author": {
94+
"name": "AWS SDK for JavaScript Team",
95+
"url": "https://aws.amazon.com/javascript/"
96+
},
97+
"license": "Apache-2.0"
98+
},
99+
"protocol": "aws.rest-xml",
100+
"private": true
101+
}
102+
}
103+
}
104+
}
105+
}

codegen/settings.gradle.kts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,4 @@
1616
rootProject.name = "codegen"
1717
include(":smithy-aws-typescript-codegen")
1818
include(":sdk-codegen")
19-
20-
// TODO: remove once smithy-gradle-plugin:0.4.0 is published.
21-
pluginManagement {
22-
repositories {
23-
mavenLocal()
24-
gradlePluginPortal()
25-
}
26-
}
19+
include(":protocol-test-codegen")

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const base = require("./jest.config.base.js");
22

33
module.exports = {
44
...base,
5-
projects: ["<rootDir>/packages/*/jest.config.js"],
5+
projects: ["<rootDir>/protocol_tests/*/jest.config.js", "<rootDir>/packages/*/jest.config.js"],
66
testPathIgnorePatterns: ["/node_modules/", "<rootDir>/clients/client-.*"],
77
coveragePathIgnorePatterns: [
88
"/node_modules/",

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
"clear-build-cache": "rimraf ./packages/*/build/* ./clients/*/*/build/*",
1212
"clear-build-info": "rimraf ./packages/*/*.tsbuildinfo ./clients/*/*/*.tsbuildinfo",
1313
"build:crypto-dependencies": "lerna run --scope '@aws-sdk/types' --scope '@aws-sdk/util-utf8-browser' --scope '@aws-sdk/util-locate-window' --scope '@aws-sdk/hash-node' --include-dependencies pretest",
14+
"build:protocols": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/protocol-tests-*' --include-dependencies pretest",
1415
"build:smithy-client": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/client-rds-data' --include-dependencies pretest",
1516
"build:all": "yarn build:crypto-dependencies && lerna run pretest --include-dependencies --include-dependents",
1617
"pretest:all": "yarn build:all",
1718
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope @aws-sdk/stream-collector-browser --scope @aws-sdk/hash-blob-browser",
1819
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
19-
"test:integration": "cucumber-js"
20+
"test:integration": "cucumber-js",
21+
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/protocol-tests-*'"
2022
},
2123
"repository": {
2224
"type": "git",
@@ -53,7 +55,8 @@
5355
"workspaces": {
5456
"packages": [
5557
"packages/*",
56-
"clients/*"
58+
"clients/*",
59+
"protocol_tests/*"
5760
],
5861
"nohoist": [
5962
"**/karma*",

0 commit comments

Comments
 (0)