@@ -37,8 +37,66 @@ var _ = DevSpaceDescribe("sync", func() {
3737 })
3838
3939 ginkgo .It ("devspace sync should work with and without config" , func () {
40- // TODO:
41- // test devspace sync command with devspace.yaml and without devspace.yaml
40+ tempDir , err := framework .CopyToTempDir ("tests/sync/testdata/no-config" )
41+ framework .ExpectNoError (err )
42+ defer framework .CleanupTempDir (initialDir , tempDir )
43+
44+ ns , err := kubeClient .CreateNamespace ("sync" )
45+ framework .ExpectNoError (err )
46+ defer func () {
47+ err := kubeClient .DeleteNamespace (ns )
48+ framework .ExpectNoError (err )
49+ }()
50+
51+ // deploy app to sync
52+ deployCmd := & cmd.DeployCmd {
53+ GlobalFlags : & flags.GlobalFlags {
54+ NoWarn : true ,
55+ Namespace : ns ,
56+ ConfigPath : "sync.yaml" ,
57+ },
58+ }
59+ err = deployCmd .Run (f )
60+ framework .ExpectNoError (err )
61+
62+ // interrupt chan for the sync command
63+ interrupt , stop := framework .InterruptChan ()
64+ defer stop ()
65+
66+ // sync with watch
67+ syncCmd := & cmd.SyncCmd {
68+ GlobalFlags : & flags.GlobalFlags {
69+ NoWarn : true ,
70+ Namespace : ns ,
71+ },
72+ ImageSelector : "node:13.14-alpine" ,
73+ ContainerPath : "/app" ,
74+ UploadOnly : true ,
75+ Polling : true ,
76+ Exclude : []string {"file2.txt" },
77+ Interrupt : interrupt ,
78+ }
79+
80+ // start the command
81+ waitGroup := sync.WaitGroup {}
82+ waitGroup .Add (1 )
83+ go func () {
84+ defer ginkgo .GinkgoRecover ()
85+ defer waitGroup .Done ()
86+
87+ err := syncCmd .Run (f )
88+ framework .ExpectNoError (err )
89+ }()
90+
91+ // wait until files were synced
92+ framework .ExpectRemoteFileContents ("node:13.14-alpine" , ns , "/app/file1.txt" , "Hello World" )
93+ framework .ExpectRemoteFileNotFound ("node:13.14-alpine" , ns , "/app/file2.txt" )
94+
95+ // stop sync
96+ stop ()
97+
98+ // wait for the command to finish
99+ waitGroup .Wait ()
42100 })
43101
44102 ginkgo .It ("should execute a command after sync" , func () {
0 commit comments