Skip to content

Commit 16f1b9a

Browse files
authored
test: enable missing feature for test build (#2820)
Add missing feature flags to fix `cargo test` when run inside individual crate directories. CI previously missed this issue because running `cargo nextest` from the workspace root automatically unifies workspace features. Additionally, because the `grpc-gcp` example depends on `protoc-gen-rust-grpc` (unlike `tonic` examples), this PR removes `grpc-gcp` from the default features so `cargo test` works out of the box. Note that `examples` crate has no tests.
1 parent 5cf749d commit 16f1b9a

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

examples/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,10 @@ grpc-gcp = [ "dep:protobuf", "dep:grpc-protobuf", "dep:grpc", "dep:grpc-google",
291291
"dep:rustls", "dep:protobuf-well-known-types" ]
292292
grpc-routeguide = ["dep:grpc", "dep:grpc-protobuf", "dep:protobuf", "dep:rand"]
293293
grpc-helloworld = ["dep:grpc", "dep:grpc-protobuf", "dep:protobuf"]
294-
full = ["gcp", "routeguide", "reflection", "autoreload", "health", "grpc-web",
294+
default = ["gcp", "routeguide", "reflection", "autoreload", "health", "grpc-web",
295295
"tracing", "uds", "streaming", "mock", "json-codec", "compression", "tls",
296296
"tls-rustls", "tls-client-auth", "types", "cancellation", "h2c",
297-
"grpc-routeguide", "grpc-helloworld", "grpc-gcp"]
298-
default = ["full"]
297+
"grpc-routeguide", "grpc-helloworld"]
299298
# Workaround for cargo-udeps bug.
300299
# TODO: Remove once the fix is released: https://github.com/est31/cargo-udeps/pull/338
301300
h2 = []

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Once your credentials are set up, you will need your GCP Project ID, which can
100100
be found on the main dashboard of the Google Cloud Console. With both of these
101101
ready, you can run the example like so:
102102
```bash
103-
$ cargo run --bin grpc-gcp-client -- <project-id>
103+
$ cargo run --bin grpc-gcp-client --features grpc-gcp -- <project-id>
104104
```
105105

106106
[Application Default Credentials]: https://docs.cloud.google.com/docs/authentication/application-default-credentials

tonic-reflection/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tonic-prost = { version = "0.14.6", path = "../tonic-prost", default-features =
3434

3535
[dev-dependencies]
3636
tokio-stream = {version = "0.1", default-features = false, features = ["net"]}
37-
tonic = { version = "0.14.6", path = "../tonic", default-features = false, features = ["transport"] }
37+
tonic = { version = "0.14.6", path = "../tonic", default-features = false, features = ["transport", "router"] }
3838

3939
[lints]
4040
workspace = true

0 commit comments

Comments
 (0)