chore: Reorganize examples and interop crates (#180)
* chore: Reorganize examples and interop crates * fix interop tests
This commit is contained in:
@@ -93,8 +93,8 @@ jobs:
|
||||
run: rustup component add rustfmt
|
||||
- uses: actions/checkout@master
|
||||
- name: Run interop tests
|
||||
run: ./tonic-interop/test.sh
|
||||
run: ./interop/test.sh
|
||||
shell: bash
|
||||
- name: Run interop tests with Rustls
|
||||
run: ./tonic-interop/test.sh --use_tls tls_rustls
|
||||
run: ./interop/test.sh --use_tls tls_rustls
|
||||
shell: bash
|
||||
|
||||
+5
-2
@@ -2,9 +2,12 @@
|
||||
members = [
|
||||
"tonic",
|
||||
"tonic-build",
|
||||
"tonic-examples",
|
||||
"tonic-interop",
|
||||
|
||||
# Non-published crates
|
||||
"examples",
|
||||
"interop",
|
||||
|
||||
# Tests
|
||||
"tests/included_service",
|
||||
"tests/same_name",
|
||||
"tests/wellknown",
|
||||
|
||||
@@ -32,7 +32,7 @@ contains the tools to build clients and servers from [`protobuf`] definitions.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Examples can be found in [`tonic-examples`] and for more complex scenarios [`tonic-interop`]
|
||||
Examples can be found in [`examples`] and for more complex scenarios [`interop`]
|
||||
may be a good resource as it shows examples of many of the gRPC features.
|
||||
|
||||
### Rust Version
|
||||
@@ -67,9 +67,9 @@ question. If that doesn't work, try opening an [issue] with the question.
|
||||
- [`tonic`](https://github.com/hyperium/tonic/tree/master/tonic): Generic gRPC and HTTP/2 client/server
|
||||
implementation.
|
||||
- [`tonic-build`](https://github.com/hyperium/tonic/tree/master/tonic-build): [`prost`] based service codegen.
|
||||
- [`tonic-examples`](https://github.com/hyperium/tonic/tree/master/tonic-examples): Example gRPC implementations showing off
|
||||
- [`examples`](https://github.com/hyperium/tonic/tree/master/examples): Example gRPC implementations showing off
|
||||
tls, load balancing and bi-directional streaming.
|
||||
- [`tonic-interop`](https://github.com/hyperium/tonic/tree/master/tonic-interop): Interop tests implementation.
|
||||
- [`interop`](https://github.com/hyperium/tonic/tree/master/interop): Interop tests implementation.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -97,11 +97,11 @@ terms or conditions.
|
||||
[`prost`]: https://github.com/danburkert/prost
|
||||
[`protobuf`]: https://developers.google.com/protocol-buffers
|
||||
[`rustls`]: https://github.com/ctz/rustls
|
||||
[`tonic-examples`]: https://github.com/hyperium/tonic/tree/master/tonic-examples
|
||||
[`tonic-interop`]: https://github.com/hyperium/tonic/tree/master/tonic-interop
|
||||
[Examples]: https://github.com/hyperium/tonic/tree/master/tonic-examples
|
||||
[`tonic-examples`]: https://github.com/hyperium/tonic/tree/master/examples
|
||||
[`tonic-interop`]: https://github.com/hyperium/tonic/tree/master/interop
|
||||
[Examples]: https://github.com/hyperium/tonic/tree/master/examples
|
||||
[Website]: https://github.com/hyperium/tonic
|
||||
[Docs]: https://docs.rs/tonic
|
||||
[Chat]: https://discord.gg/6yGkFeN
|
||||
[routeguide-tutorial]: https://github.com/hyperium/tonic/blob/master/tonic-examples/routeguide-tutorial.md
|
||||
[helloworld-tutorial]: https://github.com/hyperium/tonic/blob/master/tonic-examples/helloworld-tutorial.md
|
||||
[routeguide-tutorial]: https://github.com/hyperium/tonic/blob/master/examples/routeguide-tutorial.md
|
||||
[helloworld-tutorial]: https://github.com/hyperium/tonic/blob/master/examples/helloworld-tutorial.md
|
||||
|
||||
@@ -15,8 +15,8 @@ name = "helloworld-client"
|
||||
path = "src/helloworld/client.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "helloworld-client-blocking"
|
||||
path = "src/helloworld/client-blocking.rs"
|
||||
name = "blocking-client"
|
||||
path = "src/blocking/client.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "routeguide-server"
|
||||
@@ -32,7 +32,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.concurrency_limit(30);
|
||||
|
||||
if matches.use_tls {
|
||||
let pem = tokio::fs::read("tonic-interop/data/ca.pem").await?;
|
||||
let pem = tokio::fs::read("interop/data/ca.pem").await?;
|
||||
let ca = Certificate::from_pem(pem);
|
||||
endpoint = endpoint.tls_config(
|
||||
ClientTlsConfig::with_rustls()
|
||||
@@ -49,8 +49,8 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
});
|
||||
|
||||
if matches.use_tls {
|
||||
let cert = tokio::fs::read("tonic-interop/data/server1.pem").await?;
|
||||
let key = tokio::fs::read("tonic-interop/data/server1.key").await?;
|
||||
let cert = tokio::fs::read("interop/data/server1.pem").await?;
|
||||
let key = tokio::fs::read("interop/data/server1.key").await?;
|
||||
let identity = Identity::from_pem(cert, key);
|
||||
|
||||
builder = builder.tls_config(ServerTlsConfig::with_rustls().identity(identity));
|
||||
@@ -16,13 +16,13 @@ esac
|
||||
|
||||
ARG="${1:-""}"
|
||||
|
||||
(cd tonic-interop && cargo build --bins)
|
||||
(cd interop && cargo build --bins)
|
||||
|
||||
SERVER="tonic-interop/bin/server_${OS}_amd64${EXT}"
|
||||
SERVER="interop/bin/server_${OS}_amd64${EXT}"
|
||||
|
||||
# TLS_CA="tonic-interop/data/ca.pem"
|
||||
TLS_CRT="tonic-interop/data/server1.pem"
|
||||
TLS_KEY="tonic-interop/data/server1.key"
|
||||
# TLS_CA="interop/data/ca.pem"
|
||||
TLS_CRT="interop/data/server1.pem"
|
||||
TLS_KEY="interop/data/server1.key"
|
||||
|
||||
# run the test server
|
||||
./"${SERVER}" ${ARG} --tls_cert_file $TLS_CRT --tls_key_file $TLS_KEY &
|
||||
Reference in New Issue
Block a user