@@ -16,6 +16,10 @@ tonic::include_proto!("encoderfile.metadata");
1616
1717use encoderfile:: generated:: token_classification;
1818
19+ #[ cfg( target_os = "windows" ) ]
20+ const BINARY_NAME : & str = "test.encoderfile.exe" ;
21+
22+ #[ cfg( not( target_os = "windows" ) ) ]
1923const BINARY_NAME : & str = "test.encoderfile" ;
2024
2125fn config ( model_name : & String , model_path : & Path , output_path : & Path ) -> String {
@@ -104,6 +108,11 @@ async fn test_build_encoderfile() -> Result<()> {
104108 . status ( )
105109 . expect ( "Failed to build encoderfile-runtime" ) ;
106110
111+ #[ cfg( target_os = "windows" ) ]
112+ let base_binary_path = fs:: canonicalize ( "../target/debug/encoderfile-runtime.exe" )
113+ . expect ( "Failed to canonicalize base binary path" ) ;
114+
115+ #[ cfg( not( target_os = "windows" ) ) ]
107116 let base_binary_path = fs:: canonicalize ( "../target/debug/encoderfile-runtime" )
108117 . expect ( "Failed to canonicalize base binary path" ) ;
109118
@@ -159,13 +168,18 @@ async fn test_build_encoderfile() -> Result<()> {
159168 grpc_port,
160169 ) ?;
161170
171+ println ! ( "encoderfile spawned, waiting for it to become ready..." ) ;
172+
162173 wait_for_http (
163174 format ! ( "http://localhost:{http_port}/health" ) . as_str ( ) ,
164175 Duration :: from_secs ( 10 ) ,
165176 )
166177 . await ?;
178+ println ! ( "encoderfile is ready, sending inference requests..." ) ;
167179 send_http_inference ( & sample_text, http_port. to_string ( ) ) . await ?;
180+ println ! ( "http inference request successful" ) ;
168181 send_grpc_inference ( & sample_text, grpc_port. to_string ( ) ) . await ?;
182+ println ! ( "grpc inference request successful" ) ;
169183
170184 child. kill ( ) ?;
171185 child. wait ( ) . ok ( ) ;
@@ -212,7 +226,7 @@ async fn send_http_inference(sample_text: &str, http_port: String) -> Result<()>
212226}
213227
214228async fn send_grpc_inference ( sample_text : & str , grpc_port : String ) -> Result < ( ) > {
215- let mut client = token_classification:: token_classification_inference_client:: TokenClassificationInferenceClient :: connect ( format ! ( "http://[::]:{grpc_port}/predict" ) ) . await ?;
229+ let mut client = token_classification:: token_classification_inference_client:: TokenClassificationInferenceClient :: connect ( format ! ( "http://[::1 ]:{grpc_port}/predict" ) ) . await ?;
216230 let req = token_classification:: TokenClassificationRequest {
217231 inputs : vec ! [ sample_text. to_owned( ) ] ,
218232 metadata : std:: collections:: HashMap :: new ( ) ,
@@ -236,7 +250,7 @@ fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> anyhow::Result<
236250 let src = src. as_ref ( ) ;
237251 let dst = dst. as_ref ( ) ;
238252
239- fs:: create_dir_all ( dst) . context ( format ! ( "Failed to create directory {:?}" , & dst) ) ?;
253+ fs:: create_dir_all ( dst) . context ( format ! ( "Failed to create directory {:?}" , dst) ) ?;
240254
241255 for entry in fs:: read_dir ( src) ? {
242256 let entry = entry?;
0 commit comments