Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): Move integration test for tonic-web to tests directory #1927

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ members = [
"tests/stream_conflict",
"tests/root-crate-path",
"tests/compression",
"tonic-web/tests/integration",
"tests/web",
"tests/service_named_result",
"tests/use_arc_self",
"tests/default_stubs",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Juan Alvarez <[email protected]>"]
edition = "2021"
name = "integration"
name = "test_web"
publish = false
version = "0.1.0"
license = "MIT"
Expand All @@ -16,10 +16,10 @@ hyper-util = "0.1"
prost = "0.13"
tokio = { version = "1", features = ["macros", "rt", "net"] }
tokio-stream = { version = "0.1", features = ["net"] }
tonic = { path = "../../../tonic" }
tonic = { path = "../../tonic" }

[dev-dependencies]
tonic-web = { path = "../../../tonic-web" }
tonic-web = { path = "../../tonic-web" }

[build-dependencies]
tonic-build = { path = "../../../tonic-build" }
tonic-build = { path = "../../tonic-build" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use tokio_stream::{self as stream, StreamExt};
use tonic::transport::{Channel, Error, Server};
use tonic::{Response, Streaming};

use integration::pb::{test_client::TestClient, test_server::TestServer, Input};
use integration::Svc;
use test_web::pb::{test_client::TestClient, test_server::TestServer, Input};
use test_web::Svc;
use tonic_web::GrpcWebLayer;

#[tokio::test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use tokio_stream::wrappers::TcpListenerStream;
use tonic::body::BoxBody;
use tonic::transport::Server;

use integration::pb::{test_server::TestServer, Input, Output};
use integration::Svc;
use test_web::pb::{test_server::TestServer, Input, Output};
use test_web::Svc;
use tonic::Status;
use tonic_web::GrpcWebLayer;

Expand Down Expand Up @@ -117,7 +117,7 @@ fn build_request(base_uri: String, content_type: &str, accept: &str) -> Request<

let bytes = match content_type {
"grpc-web" => encode_body(),
"grpc-web-text" => integration::util::base64::STANDARD
"grpc-web-text" => test_web::util::base64::STANDARD
.encode(encode_body())
.into(),
_ => panic!("invalid content type {}", content_type),
Expand All @@ -139,7 +139,7 @@ async fn decode_body(body: Incoming, content_type: &str) -> (Output, Bytes) {
let mut body = body.collect().await.unwrap().to_bytes();

if content_type == "application/grpc-web-text+proto" {
body = integration::util::base64::STANDARD
body = test_web::util::base64::STANDARD
.decode(body)
.unwrap()
.into()
Expand Down