0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2024-11-22 11:36:16 +00:00
libsql/libsql-replication/tests/bootstrap.rs
2024-09-20 17:34:12 -04:00

38 lines
971 B
Rust

use std::{path::PathBuf, process::Command};
#[test]
fn bootstrap() {
let iface_files = &[
"proto/metadata.proto",
"proto/replication_log.proto",
"proto/proxy.proto",
];
let dirs = &["proto"];
let out_dir = PathBuf::from(std::env!("CARGO_MANIFEST_DIR"))
.join("src")
.join("generated");
let mut config = prost_build::Config::new();
config.bytes([".wal_log"]);
tonic_build::configure()
.build_client(true)
.build_server(true)
.build_transport(false)
.out_dir(&out_dir)
.type_attribute(".proxy", "#[derive(serde::Serialize, serde::Deserialize)]")
.compile_with_config(config, 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");
}