@@ -9,6 +9,7 @@ use tokio::runtime::Builder;
99use tracing:: { error, info} ;
1010
1111use pilatus:: { GenericConfig , HostedService , SystemTerminator } ;
12+ use serde_json:: Value as JsonValue ;
1213
1314use crate :: metadata_future:: MetadataFuture ;
1415
@@ -21,7 +22,7 @@ pub struct Runtime {
2122/// Convenience wrapper for integration tests.
2223/// Keeps the temporary directory alive for as long as the runtime is used.
2324pub struct TempRuntime {
24- config_json : Option < Vec < u8 > > ,
25+ config_json : Option < JsonValue > ,
2526 steps : Vec < TempRuntimeStep > ,
2627}
2728
@@ -40,8 +41,8 @@ impl TempRuntime {
4041 }
4142
4243 /// Sets the `config.json` contents to be written during [`TempRuntime::configure`].
43- pub fn config_json ( mut self , config_json : impl AsRef < [ u8 ] > ) -> Self {
44- self . config_json = Some ( config_json. as_ref ( ) . to_vec ( ) ) ;
44+ pub fn config ( mut self , config_json : JsonValue ) -> Self {
45+ self . config_json = Some ( config_json) ;
4546 self
4647 }
4748
@@ -66,6 +67,8 @@ impl TempRuntime {
6667 pub fn configure ( self ) -> Result < TempConfiguredRuntime , std:: io:: Error > {
6768 let dir = tempfile:: tempdir ( ) ?;
6869 if let Some ( cfg) = self . config_json {
70+ let cfg = serde_json:: to_vec ( & cfg)
71+ . map_err ( |e| std:: io:: Error :: new ( std:: io:: ErrorKind :: InvalidData , e) ) ?;
6972 std:: fs:: write ( dir. path ( ) . join ( "config.json" ) , cfg) ?;
7073 }
7174
0 commit comments