@@ -47,7 +47,7 @@ describe("VM integration", () => {
4747 software : [ common ] ,
4848 sandbox : {
4949 mountPath : "/sandbox" ,
50- idleTimeoutMs : 25 ,
50+ idleTimeoutMs : 500 ,
5151 provider : {
5252 start : async ( ) => {
5353 providerStarts += 1 ;
@@ -119,9 +119,7 @@ describe("VM integration", () => {
119119 new TextEncoder ( ) . encode ( "first" ) ,
120120 ) ;
121121 expect (
122- new TextDecoder ( ) . decode (
123- await vm . readFile ( "/sandbox/generation.txt" ) ,
124- ) ,
122+ new TextDecoder ( ) . decode ( await vm . readFile ( "/sandbox/generation.txt" ) ) ,
125123 ) . toBe ( "first" ) ;
126124 expect ( providerStarts ) . toBe ( 1 ) ;
127125
@@ -130,15 +128,32 @@ describe("VM integration", () => {
130128 { path : "/generation.txt" } ,
131129 new TextEncoder ( ) . encode ( "second" ) ,
132130 ) ;
133- for ( let attempt = 0 ; attempt < 50 && providerDisposals === 0 ; attempt ++ ) {
131+ for (
132+ let attempt = 0 ;
133+ attempt < 100 && providerDisposals === 0 ;
134+ attempt ++
135+ ) {
134136 await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
135137 }
136138 expect ( providerDisposals ) . toBe ( 1 ) ;
137- expect (
138- new TextDecoder ( ) . decode (
139- await vm . readFile ( "/sandbox/generation.txt" ) ,
139+ const [ secondContent , bindingResult ] = await Promise . all ( [
140+ vm . readFile ( "/sandbox/generation.txt" ) ,
141+ vm . process . execFile (
142+ "agentos-sandbox" ,
143+ [ "run-command" , "--command" , "echo" , "--args" , "second-generation" ] ,
144+ { output : { capture : "all" } } ,
140145 ) ,
141- ) . toBe ( "second" ) ;
146+ ] ) ;
147+ expect ( new TextDecoder ( ) . decode ( secondContent ) ) . toBe ( "second" ) ;
148+ expect ( bindingResult . exitCode ) . toBe ( 0 ) ;
149+ expect ( JSON . parse ( bindingResult . stdout ) ) . toEqual (
150+ expect . objectContaining ( {
151+ ok : true ,
152+ result : expect . objectContaining ( {
153+ stdout : expect . stringContaining ( "second-generation" ) ,
154+ } ) ,
155+ } ) ,
156+ ) ;
142157 expect ( providerStarts ) . toBe ( 2 ) ;
143158 } finally {
144159 await replacement . stop ( ) ;
0 commit comments