chore: Add test to check FILE_DESCRIPTOR_SET is valid (#1217)
This commit is contained in:
@@ -28,3 +28,4 @@ tonic = { version = "0.8", path = "../tonic", default-features = false, features
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]}
|
tokio = {version = "1.0", features = ["rt-multi-thread", "macros"]}
|
||||||
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] }
|
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] }
|
||||||
|
prost-types = "0.11"
|
||||||
|
|||||||
@@ -31,6 +31,17 @@ pub mod proto {
|
|||||||
|
|
||||||
pub const GRPC_HEALTH_V1_FILE_DESCRIPTOR_SET: &[u8] =
|
pub const GRPC_HEALTH_V1_FILE_DESCRIPTOR_SET: &[u8] =
|
||||||
include_bytes!("generated/grpc_health_v1.bin");
|
include_bytes!("generated/grpc_health_v1.bin");
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::GRPC_HEALTH_V1_FILE_DESCRIPTOR_SET;
|
||||||
|
use prost::Message as _;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn file_descriptor_set_is_valid() {
|
||||||
|
prost_types::FileDescriptorSet::decode(GRPC_HEALTH_V1_FILE_DESCRIPTOR_SET).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
|||||||
@@ -22,6 +22,17 @@ pub mod proto {
|
|||||||
include!("generated/grpc.reflection.v1alpha.rs");
|
include!("generated/grpc.reflection.v1alpha.rs");
|
||||||
|
|
||||||
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/reflection_v1alpha1.bin");
|
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/reflection_v1alpha1.bin");
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::FILE_DESCRIPTOR_SET;
|
||||||
|
use prost::Message as _;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn file_descriptor_set_is_valid() {
|
||||||
|
prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of the server component of gRPC Server Reflection.
|
/// Implementation of the server component of gRPC Server Reflection.
|
||||||
|
|||||||
@@ -27,6 +27,17 @@ pub mod pb {
|
|||||||
|
|
||||||
/// Byte encoded FILE_DESCRIPTOR_SET.
|
/// Byte encoded FILE_DESCRIPTOR_SET.
|
||||||
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/types.bin");
|
pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/types.bin");
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::FILE_DESCRIPTOR_SET;
|
||||||
|
use prost::Message as _;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn file_descriptor_set_is_valid() {
|
||||||
|
prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use pb::Status;
|
pub use pb::Status;
|
||||||
|
|||||||
Reference in New Issue
Block a user