2022-02-18 21:14:36 +08:00
|
|
|
# Codegen Integration Tests
|
|
|
|
|
|
|
|
This module defines integration tests of the code generation machinery.
|
|
|
|
`./build.gradle.kts` will generate a `smithy-build.json` file as part of the
|
2022-12-15 05:26:55 +08:00
|
|
|
build. The `rust-client-codegen` Smithy build plugin then invokes our codegen
|
2022-02-18 21:14:36 +08:00
|
|
|
machinery and generates Rust crates, one for each of the integration test
|
|
|
|
services defined under `model/`.
|
2020-10-28 23:08:23 +08:00
|
|
|
|
|
|
|
## Usage
|
2022-02-18 21:14:36 +08:00
|
|
|
|
|
|
|
These commands are all meant to be run from the repository root.
|
|
|
|
|
|
|
|
To run all protocol tests of all the integration test services:
|
|
|
|
|
|
|
|
```sh
|
2022-09-08 00:31:46 +08:00
|
|
|
./gradlew codegen-client-test:build
|
2022-02-18 21:14:36 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
To run only a _subset_ of the integration test services (refer to
|
|
|
|
`./build.gradle.kts` for a full list):
|
|
|
|
|
|
|
|
```sh
|
2022-09-08 00:31:46 +08:00
|
|
|
./gradlew codegen-client-test:build -P modules='simple,rest_json'
|
2022-02-18 21:14:36 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
The Gradle task will run `cargo check`, `cargo test`, `cargo docs` and `cargo
|
|
|
|
clippy` by default on all the generated Rust crates. You can also specify a
|
|
|
|
subset of these commands. For instance, if you're working on documentation and
|
|
|
|
want to check that the crates also compile, you can run:
|
|
|
|
|
|
|
|
```sh
|
2022-09-08 00:31:46 +08:00
|
|
|
./gradlew codegen-client-test:build -P cargoCommands='check,docs'
|
2020-10-28 23:08:23 +08:00
|
|
|
```
|
2022-02-18 21:14:36 +08:00
|
|
|
|
|
|
|
For fast development iteration cycles on protocol tests, we recommend you write
|
|
|
|
a codegen _unit_ test with a minimal service definition and only run that unit
|
|
|
|
test. Alternatively, you can write a minimal integration test service
|
|
|
|
definition in `model/simple.smithy` and run:
|
|
|
|
|
|
|
|
```sh
|
2022-09-08 00:31:46 +08:00
|
|
|
./gradlew codegen-client-test:build -P cargoCommands='test' -P modules='simple'
|
2020-10-28 23:08:23 +08:00
|
|
|
```
|