@@ -325,6 +325,53 @@ public function testBuildOutputDirectory(): void
325325 $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
326326 }
327327
328+ public function testBuildUncompressed (): void
329+ {
330+ $ output = '' ;
331+ Console::execute ('cd /app/tests/resources/functions/node && tar --exclude code.tar.gz -czf code.tar.gz . ' , '' , $ output );
332+
333+ $ runtimeId = \bin2hex (\random_bytes (4 ));
334+
335+ /** Build runtime */
336+ $ params = [
337+ 'runtimeId ' => 'test-build- ' . $ runtimeId ,
338+ 'source ' => '/storage/functions/node/code.tar.gz ' ,
339+ 'destination ' => '/storage/builds/test ' ,
340+ 'entrypoint ' => 'index.js ' ,
341+ 'image ' => 'openruntimes/node:v5-22 ' ,
342+ 'command ' => 'tar -zxf /tmp/code.tar.gz -C /mnt/code && bash helpers/build.sh "npm install" ' ,
343+ 'variables ' => [
344+ 'OPEN_RUNTIMES_BUILD_COMPRESSION ' => 'none '
345+ ]
346+ ];
347+
348+ $ response = $ this ->client ->call (Client::METHOD_POST , '/runtimes ' , [], $ params );
349+ $ this ->assertEquals (201 , $ response ['headers ' ]['status-code ' ]);
350+ $ this ->assertNotEmpty ($ response ['body ' ]['path ' ]);
351+
352+ $ buildPath = $ response ['body ' ]['path ' ];
353+
354+ /** Ensure build folder exists (container still running) */
355+ $ tmpFolderPath = '/tmp/executor-test-build- ' . $ runtimeId ;
356+ $ this ->assertTrue (\is_dir ($ tmpFolderPath ));
357+ $ this ->assertTrue (\file_exists ($ tmpFolderPath ));
358+
359+ $ response = $ this ->client ->call (Client::METHOD_POST , '/runtimes/test-exec- ' . $ runtimeId . '/executions ' , [], [
360+ 'source ' => $ buildPath ,
361+ 'entrypoint ' => 'index.js ' ,
362+ 'image ' => 'openruntimes/node:v5-22 ' ,
363+ 'runtimeEntrypoint ' => 'cp /tmp/code.tar /mnt/code/code.tar && nohup helpers/start.sh "bash helpers/server.sh" ' ,
364+ ]);
365+
366+ $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
367+ $ this ->assertEquals (200 , $ response ['body ' ]['statusCode ' ]);
368+ $ json = json_decode ($ response ['body ' ]['body ' ], true );
369+ $ this ->assertEquals ("Hello Open Runtimes 👋 " , $ json ['message ' ]);
370+
371+ $ response = $ this ->client ->call (Client::METHOD_DELETE , '/runtimes/test-exec- ' . $ runtimeId , [], []);
372+ $ this ->assertEquals (200 , $ response ['headers ' ]['status-code ' ]);
373+ }
374+
328375 public function testExecute (): void
329376 {
330377 /** Prepare function */
0 commit comments