Skip to content

Commit

Permalink
chore: Reorganize examples and interop crates (#180)
Browse files Browse the repository at this point in the history
* chore: Reorganize examples and interop crates

* fix interop tests
  • Loading branch information
LucioFranco authored Dec 12, 2019
1 parent f096a23 commit d9a481b
Show file tree
Hide file tree
Showing 69 changed files with 25 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions tonic-examples/Cargo.toml → examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions tonic-interop/src/bin/server.rs → interop/src/bin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions tonic-interop/test.sh → interop/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
Expand Down

0 comments on commit d9a481b

Please sign in to comment.