@@ -551,6 +551,73 @@ var _ = DevSpaceDescribe("sync", func() {
551551 waitGroup .Wait ()
552552 })
553553
554+ ginkgo .It ("should sync to a pod container with uploadExcludePaths configuration" , func () {
555+ tempDir , err := framework .CopyToTempDir ("tests/sync/testdata/sync-exclude-dir" )
556+ framework .ExpectNoError (err )
557+ defer framework .CleanupTempDir (initialDir , tempDir )
558+
559+ ns , err := kubeClient .CreateNamespace ("sync" )
560+ framework .ExpectNoError (err )
561+ defer func () {
562+ err := kubeClient .DeleteNamespace (ns )
563+ framework .ExpectNoError (err )
564+ }()
565+
566+ // deploy app to sync
567+ deployCmd := & cmd.RunPipelineCmd {
568+ GlobalFlags : & flags.GlobalFlags {
569+ NoWarn : true ,
570+ Namespace : ns ,
571+ ConfigPath : "devspace.yaml" ,
572+ },
573+ Pipeline : "deploy" ,
574+ }
575+ err = deployCmd .RunDefault (f )
576+ framework .ExpectNoError (err )
577+
578+ cancelCtx , stop := context .WithCancel (context .Background ())
579+ defer stop ()
580+
581+ // sync command
582+ syncCmd := & cmd.SyncCmd {
583+ GlobalFlags : & flags.GlobalFlags {
584+ NoWarn : true ,
585+ Namespace : ns ,
586+ ConfigPath : "devspace.yaml" ,
587+ },
588+ Wait : true ,
589+ Ctx : cancelCtx ,
590+ }
591+
592+ // start the command
593+ waitGroup := sync.WaitGroup {}
594+ waitGroup .Add (1 )
595+ go func () {
596+ defer ginkgo .GinkgoRecover ()
597+ defer waitGroup .Done ()
598+ err = syncCmd .Run (f )
599+ framework .ExpectNoError (err )
600+ }()
601+
602+ // check that uploadExcludePaths folder was not synced
603+ framework .ExpectRemoteFileNotFound ("alpine" , ns , "/app/node_modules" )
604+
605+ // check that included file was synced
606+ framework .ExpectRemoteFileContents ("alpine" , ns , "/app/syncme/file.txt" , "I will be synced" )
607+
608+ // write a file and check that it got synced
609+ payload := randutil .GenerateRandomString (10000 )
610+ err = ioutil .WriteFile (filepath .Join (tempDir , "watching.txt" ), []byte (payload ), 0666 )
611+ framework .ExpectNoError (err )
612+ framework .ExpectRemoteFileContents ("alpine" , ns , "/app/watching.txt" , payload )
613+
614+ // stop command
615+ stop ()
616+
617+ // wait for the command to finish
618+ waitGroup .Wait ()
619+ })
620+
554621 ginkgo .It ("should sync to a pod container with excludeFile, downloadExcludeFile, and uploadExcludeFile configuration" , func () {
555622 tempDir , err := framework .CopyToTempDir ("tests/sync/testdata/sync-exclude-file" )
556623 framework .ExpectNoError (err )
0 commit comments