@@ -366,7 +366,8 @@ var _ = DevSpaceDescribe("sync", func() {
366366 Namespace : ns ,
367367 ConfigPath : "no-watch.yaml" ,
368368 },
369- NoWatch : true ,
369+ NoWatch : true ,
370+ DownloadOnInitialSync : true ,
370371 }
371372
372373 // start the command
@@ -376,8 +377,11 @@ var _ = DevSpaceDescribe("sync", func() {
376377 // wait until files were synced
377378 framework .ExpectRemoteFileContents ("node" , ns , "/no-watch/file1.txt" , "Hello World" )
378379
380+ // check if file was downloaded correctly
381+ framework .ExpectLocalFileContents (filepath .Join (tempDir , "initial-sync-done-before.txt" ), "Hello World" )
382+
379383 // check if file was downloaded through after hook
380- framework .ExpectLocalFileContents (filepath .Join (tempDir , "initial-sync-done.txt" ), "Hello World" )
384+ framework .ExpectLocalFileNotFound (filepath .Join (tempDir , "initial-sync-done-after .txt" ))
381385 })
382386
383387 ginkgo .It ("should sync to a pod container with --container and --container-path" , func () {
@@ -404,6 +408,9 @@ var _ = DevSpaceDescribe("sync", func() {
404408 framework .ExpectNoError (err )
405409
406410 // sync with --container and --container-path
411+ interrupt , stop := framework .InterruptChan ()
412+ defer stop ()
413+
407414 syncCmd := & cmd.SyncCmd {
408415 GlobalFlags : & flags.GlobalFlags {
409416 NoWarn : true ,
@@ -412,12 +419,18 @@ var _ = DevSpaceDescribe("sync", func() {
412419 },
413420 Container : "container2" ,
414421 ContainerPath : "/app2" ,
415- NoWatch : true ,
422+ Interrupt : interrupt ,
416423 }
417424
418425 // start the command
419- err = syncCmd .Run (f )
420- framework .ExpectNoError (err )
426+ waitGroup := sync.WaitGroup {}
427+ waitGroup .Add (1 )
428+ go func () {
429+ defer ginkgo .GinkgoRecover ()
430+ defer waitGroup .Done ()
431+ err = syncCmd .Run (f )
432+ framework .ExpectNoError (err )
433+ }()
421434
422435 // wait until files were synced
423436 framework .ExpectRemoteContainerFileContents ("e2e=sync-containers" , "container2" , ns , "/app2/file1.txt" , "Hello World" )
@@ -427,6 +440,12 @@ var _ = DevSpaceDescribe("sync", func() {
427440 err = ioutil .WriteFile (filepath .Join (tempDir , "watching.txt" ), []byte (payload ), 0666 )
428441 framework .ExpectNoError (err )
429442 framework .ExpectRemoteContainerFileContents ("e2e=sync-containers" , "container2" , ns , "/app2/watching.txt" , payload )
443+
444+ // stop command
445+ stop ()
446+
447+ // wait for the command to finish
448+ waitGroup .Wait ()
430449 })
431450
432451 ginkgo .It ("should sync to a pod container with excludeFile, downloadExcludeFile, and uploadExcludeFile configuration" , func () {
@@ -452,19 +471,28 @@ var _ = DevSpaceDescribe("sync", func() {
452471 err = deployCmd .Run (f )
453472 framework .ExpectNoError (err )
454473
474+ interrupt , stop := framework .InterruptChan ()
475+ defer stop ()
476+
455477 // sync command
456478 syncCmd := & cmd.SyncCmd {
457479 GlobalFlags : & flags.GlobalFlags {
458480 NoWarn : true ,
459481 Namespace : ns ,
460482 ConfigPath : "devspace.yaml" ,
461483 },
462- NoWatch : true ,
484+ Interrupt : interrupt ,
463485 }
464486
465487 // start the command
466- err = syncCmd .Run (f )
467- framework .ExpectNoError (err )
488+ waitGroup := sync.WaitGroup {}
489+ waitGroup .Add (1 )
490+ go func () {
491+ defer ginkgo .GinkgoRecover ()
492+ defer waitGroup .Done ()
493+ err = syncCmd .Run (f )
494+ framework .ExpectNoError (err )
495+ }()
468496
469497 // wait for initial sync to complete
470498 framework .ExpectLocalFileContents (filepath .Join (tempDir , "initial-sync-done.txt" ), "Hello World" )
@@ -488,5 +516,11 @@ var _ = DevSpaceDescribe("sync", func() {
488516 err = ioutil .WriteFile (filepath .Join (tempDir , "watching.txt" ), []byte (payload ), 0666 )
489517 framework .ExpectNoError (err )
490518 framework .ExpectRemoteFileContents ("node" , ns , "/app/watching.txt" , payload )
519+
520+ // stop command
521+ stop ()
522+
523+ // wait for the command to finish
524+ waitGroup .Wait ()
491525 })
492526})
0 commit comments