Files
tonic/tonic-types/tests/bootstrap.rs
T
tottotoandGitHub c772a786a9 chore: Refactor bootstrap test (#1216)
* chore: Remove unnecessary conversions to string in bootstrap tests

* chore: Simplify assertion in bootstrap tests
2023-01-04 14:19:28 -05:00

28 lines
701 B
Rust

use std::{path::PathBuf, process::Command};
#[test]
fn bootstrap() {
let iface_files = &["proto/status.proto", "proto/error_details.proto"];
let dirs = &["proto"];
let out_dir = PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.join("src")
.join("generated");
tonic_build::configure()
.out_dir(&out_dir)
.file_descriptor_set_path(out_dir.join("types.bin"))
.compile(iface_files, dirs)
.unwrap();
let status = Command::new("git")
.arg("diff")
.arg("--exit-code")
.arg("--")
.arg(&out_dir)
.status()
.unwrap();
assert!(status.success(), "You should commit the protobuf files");
}