@@ -27,9 +27,10 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
2727 let containerClient : DockerClient ;
2828 let defaultRunner : ICommandRunnerFactory ;
2929 let defaultRunnerFactory : ( options : ShellStreamCommandRunnerOptions ) => ICommandRunnerFactory ;
30- let composeFilePath : string ;
3130 let composeDir : string ;
32- let composeProfileFilePath : string ;
31+ let composeFilePath : string ;
32+ let composeWithLogsFilePath : string ;
33+ let composeWithProfilesFilePath : string ;
3334
3435 this . timeout ( 10000 ) ; // Set a longer timeout for integration tests
3536
@@ -45,20 +46,23 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
4546
4647 defaultRunner = defaultRunnerFactory ( { strict : true , } ) ;
4748
48- // Set up paths for test docker-compose file
49+ // Set up paths for test docker-compose files
4950 composeDir = path . resolve ( __dirname , 'buildContext' ) ;
5051 composeFilePath = path . resolve ( composeDir , 'docker-compose.yml' ) ;
51- composeProfileFilePath = path . resolve ( composeDir , 'docker-compose.profiles.yml' ) ;
52+ composeWithLogsFilePath = path . resolve ( composeDir , 'docker-compose.logs.yml' ) ;
53+ composeWithProfilesFilePath = path . resolve ( composeDir , 'docker-compose.profiles.yml' ) ;
5254
53- // Create the test docker-compose.yml file
55+ // Create the test docker-compose.yml files
5456 await fs . mkdir ( composeDir , { recursive : true } ) ;
5557 await fs . writeFile ( composeFilePath , TestComposeFileContent ) ;
56- await fs . writeFile ( composeProfileFilePath , TestComposeFileContentWithProfiles ) ;
58+ await fs . writeFile ( composeWithLogsFilePath , TestComposeWithLogsFileContent ) ;
59+ await fs . writeFile ( composeWithProfilesFilePath , TestComposeWithProfilesFileContent ) ;
5760
5861 if ( runInWsl ) {
5962 composeDir = wslifyPath ( composeDir ) ;
6063 composeFilePath = wslifyPath ( composeFilePath ) ;
61- composeProfileFilePath = wslifyPath ( composeProfileFilePath ) ;
64+ composeWithLogsFilePath = wslifyPath ( composeWithLogsFilePath ) ;
65+ composeWithProfilesFilePath = wslifyPath ( composeWithProfilesFilePath ) ;
6266 }
6367 } ) ;
6468
@@ -68,7 +72,8 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
6872 await defaultRunner . getCommandRunner ( ) (
6973 client . down ( {
7074 files : [ composeFilePath ] ,
71- removeVolumes : true
75+ removeVolumes : true ,
76+ timeoutSeconds : 1 ,
7277 } )
7378 ) ;
7479 } catch ( error ) {
@@ -130,6 +135,7 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
130135 client . down ( {
131136 files : [ composeFilePath ] ,
132137 removeVolumes : true ,
138+ timeoutSeconds : 1 ,
133139 } )
134140 ) ;
135141
@@ -155,6 +161,7 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
155161 await defaultRunner . getCommandRunner ( ) (
156162 client . stop ( {
157163 files : [ composeFilePath ] ,
164+ timeoutSeconds : 1 ,
158165 } )
159166 ) ;
160167 } ) ;
@@ -200,6 +207,7 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
200207 await defaultRunner . getCommandRunner ( ) (
201208 client . stop ( {
202209 files : [ composeFilePath ] ,
210+ timeoutSeconds : 1 ,
203211 } )
204212 ) ;
205213
@@ -236,6 +244,7 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
236244 await defaultRunner . getCommandRunner ( ) (
237245 client . restart ( {
238246 files : [ composeFilePath ] ,
247+ timeoutSeconds : 1 ,
239248 } )
240249 ) ;
241250
@@ -261,17 +270,27 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
261270 // Ensure services are up before logs test
262271 await defaultRunner . getCommandRunner ( ) (
263272 client . up ( {
264- files : [ composeFilePath ] ,
273+ files : [ composeWithLogsFilePath ] ,
265274 detached : true ,
266275 } )
267276 ) ;
268277 } ) ;
269278
279+ after ( 'Logs' , async function ( ) {
280+ // Ensure services are down after logs test
281+ await defaultRunner . getCommandRunner ( ) (
282+ client . down ( {
283+ files : [ composeWithLogsFilePath ] ,
284+ timeoutSeconds : 1 ,
285+ } )
286+ ) ;
287+ } ) ;
288+
270289 it ( 'LogsCommand' , async function ( ) {
271290 // Get logs without following
272291 const logsStream = defaultRunner . getStreamingCommandRunner ( ) (
273292 client . logs ( {
274- files : [ composeFilePath ] ,
293+ files : [ composeWithLogsFilePath ] ,
275294 follow : false ,
276295 tail : 10 ,
277296 } )
@@ -322,7 +341,7 @@ describe('(integration) ContainerOrchestratorClientE2E', function () {
322341 // The test docker-compose.yml doesn't define profiles, but the command should still work
323342 const profiles = await defaultRunner . getCommandRunner ( ) (
324343 client . config ( {
325- files : [ composeFilePath , composeProfileFilePath ] ,
344+ files : [ composeFilePath , composeWithProfilesFilePath ] ,
326345 configType : 'profiles' ,
327346 } )
328347 ) ;
@@ -354,16 +373,24 @@ services:
354373 image: alpine:latest
355374 volumes:
356375 - test-volume:/test-volume
376+ tty: true # Will keep the container running
357377
358378 backend:
359379 image: alpine:latest
360- entrypoint: ["echo ", "Log entry for testing"]
380+ entrypoint: ["tail ", "-f", "/dev/null"] # Another way to keep the container running
361381
362382volumes:
363383 test-volume:
364384` ;
365385
366- const TestComposeFileContentWithProfiles = `
386+ const TestComposeWithLogsFileContent = `
387+ services:
388+ serviceWithLogs:
389+ image: alpine:latest
390+ entrypoint: ["echo", "Log entry for testing"]
391+ ` ;
392+
393+ const TestComposeWithProfilesFileContent = `
367394services:
368395 frontend:
369396 profiles:
0 commit comments