@@ -203,12 +203,18 @@ func TestNormalSync(t *testing.T) {
203203 return
204204 }
205205
206+ syncClient .readyChan = make (chan bool )
207+
206208 go syncClient .startUpstream ()
207209 go syncClient .startDownstream ()
208210
211+ <- syncClient .readyChan
212+
209213 filesToCheck , foldersToCheck := createTestFilesAndFolders (local , remote , syncClient )
210214
211- checkFilesAndFolders (t , filesToCheck , foldersToCheck , local , remote , 20 * time .Second )
215+ checkFilesAndFolders (t , filesToCheck , foldersToCheck , local , remote , 10 * time .Second )
216+
217+ return
212218}
213219
214220func TestRunningSync (t * testing.T ) {
@@ -345,51 +351,51 @@ func setExcludePaths(syncClient *SyncConfig) {
345351func createTestFilesAndFolders (local string , remote string , syncClient * SyncConfig ) ([]checkedFileOrFolder , []checkedFileOrFolder ) {
346352
347353 //Write local files
348- ioutil .WriteFile (path .Join (local , "testFile1 " ), []byte (fileContents ), 0666 )
349- ioutil .WriteFile (path .Join (local , "testFile2 " ), []byte (fileContents ), 0666 )
354+ ioutil .WriteFile (path .Join (local , "testFileLocal1 " ), []byte (fileContents ), 0666 )
355+ ioutil .WriteFile (path .Join (local , "testFileLocal2 " ), []byte (fileContents ), 0666 )
350356 ioutil .WriteFile (path .Join (local , "ignoreFileLocal" ), []byte (fileContents ), 0666 )
351357 ioutil .WriteFile (path .Join (local , "noDownloadFileLocal" ), []byte (fileContents ), 0666 )
352358 ioutil .WriteFile (path .Join (local , "noUploadFileLocal" ), []byte (fileContents ), 0666 )
353359
354360 os .Mkdir (path .Join (local , "testFolder" ), 0755 )
355- os .Mkdir (path .Join (local , "testFolder2 " ), 0755 )
361+ os .Mkdir (path .Join (local , "testFolderLocal " ), 0755 )
356362 os .Mkdir (path .Join (local , "ignoreFolderLocal" ), 0755 )
357363 os .Mkdir (path .Join (local , "noDownloadFolderLocal" ), 0755 )
358364 os .Mkdir (path .Join (local , "noUploadFolderLocal" ), 0755 )
359365
360- ioutil .WriteFile (path .Join (local , "testFolder" , "testFile1 " ), []byte (fileContents ), 0666 )
361- ioutil .WriteFile (path .Join (local , "testFolder" , "testFile2 " ), []byte (fileContents ), 0666 )
366+ ioutil .WriteFile (path .Join (local , "testFolder" , "testFileLocal1 " ), []byte (fileContents ), 0666 )
367+ ioutil .WriteFile (path .Join (local , "testFolder" , "testFileLocal2 " ), []byte (fileContents ), 0666 )
362368 ioutil .WriteFile (path .Join (local , "testFolder" , "ignoreFileLocal" ), []byte (fileContents ), 0666 )
363369 ioutil .WriteFile (path .Join (local , "testFolder" , "noDownloadFileLocal" ), []byte (fileContents ), 0666 )
364370 ioutil .WriteFile (path .Join (local , "testFolder" , "noUploadFileLocal" ), []byte (fileContents ), 0666 )
365371
366372 // Write remote files
367- ioutil .WriteFile (path .Join (remote , "testFile3 " ), []byte (fileContents ), 0666 )
368- ioutil .WriteFile (path .Join (remote , "testFile4 " ), []byte (fileContents ), 0666 )
373+ ioutil .WriteFile (path .Join (remote , "testFileRemote1 " ), []byte (fileContents ), 0666 )
374+ ioutil .WriteFile (path .Join (remote , "testFileRemote2 " ), []byte (fileContents ), 0666 )
369375 ioutil .WriteFile (path .Join (remote , "ignoreFileRemote" ), []byte (fileContents ), 0666 )
370376 ioutil .WriteFile (path .Join (remote , "noDownloadFileRemote" ), []byte (fileContents ), 0666 )
371377 ioutil .WriteFile (path .Join (remote , "noUploadFileRemote" ), []byte (fileContents ), 0666 )
372378
373379 os .Mkdir (path .Join (remote , "testFolder" ), 0755 )
374- os .Mkdir (path .Join (remote , "testFolder3 " ), 0755 )
380+ os .Mkdir (path .Join (remote , "testFolderRemote " ), 0755 )
375381 os .Mkdir (path .Join (remote , "ignoreFolderRemote" ), 0755 )
376382 os .Mkdir (path .Join (remote , "noDownloadFolderRemote" ), 0755 )
377383 os .Mkdir (path .Join (remote , "noUploadFolderRemote" ), 0755 )
378384
379- ioutil .WriteFile (path .Join (remote , "testFolder" , "testFile3 " ), []byte (fileContents ), 0666 )
380- ioutil .WriteFile (path .Join (remote , "testFolder" , "testFile4 " ), []byte (fileContents ), 0666 )
381- ioutil .WriteFile (path .Join (remote , "ignoreFileRemote" ), []byte (fileContents ), 0666 )
382- ioutil .WriteFile (path .Join (remote , "noDownloadFileRemote" ), []byte (fileContents ), 0666 )
383- ioutil .WriteFile (path .Join (remote , "noUploadFileRemote" ), []byte (fileContents ), 0666 )
385+ ioutil .WriteFile (path .Join (remote , "testFolder" , "testFileRemote1 " ), []byte (fileContents ), 0666 )
386+ ioutil .WriteFile (path .Join (remote , "testFolder" , "testFileRemote2 " ), []byte (fileContents ), 0666 )
387+ ioutil .WriteFile (path .Join (remote , "testFolder" , " ignoreFileRemote" ), []byte (fileContents ), 0666 )
388+ ioutil .WriteFile (path .Join (remote , "testFolder" , " noDownloadFileRemote" ), []byte (fileContents ), 0666 )
389+ ioutil .WriteFile (path .Join (remote , "testFolder" , " noUploadFileRemote" ), []byte (fileContents ), 0666 )
384390
385391 filesToCheck := []checkedFileOrFolder {
386392 checkedFileOrFolder {
387- path : "testFile1 " ,
393+ path : "testFileLocal1 " ,
388394 shouldExistInLocal : true ,
389395 shouldExistInRemote : true ,
390396 },
391397 checkedFileOrFolder {
392- path : "testFile2 " ,
398+ path : "testFileLocal2 " ,
393399 shouldExistInLocal : true ,
394400 shouldExistInRemote : true ,
395401 },
@@ -409,12 +415,12 @@ func createTestFilesAndFolders(local string, remote string, syncClient *SyncConf
409415 shouldExistInRemote : false ,
410416 },
411417 checkedFileOrFolder {
412- path : "testFolder/testFile1 " ,
418+ path : "testFolder/testFileLocal1 " ,
413419 shouldExistInLocal : true ,
414420 shouldExistInRemote : true ,
415421 },
416422 checkedFileOrFolder {
417- path : "testFolder/testFile2 " ,
423+ path : "testFolder/testFileLocal2 " ,
418424 shouldExistInLocal : true ,
419425 shouldExistInRemote : true ,
420426 },
@@ -435,12 +441,12 @@ func createTestFilesAndFolders(local string, remote string, syncClient *SyncConf
435441 },
436442
437443 checkedFileOrFolder {
438- path : "testFile3 " ,
444+ path : "testFileRemote1 " ,
439445 shouldExistInLocal : true ,
440446 shouldExistInRemote : true ,
441447 },
442448 checkedFileOrFolder {
443- path : "testFile4 " ,
449+ path : "testFileRemote2 " ,
444450 shouldExistInLocal : true ,
445451 shouldExistInRemote : true ,
446452 },
@@ -460,12 +466,12 @@ func createTestFilesAndFolders(local string, remote string, syncClient *SyncConf
460466 shouldExistInRemote : true ,
461467 },
462468 checkedFileOrFolder {
463- path : "testFolder/testFile3 " ,
469+ path : "testFolder/testFileRemote1 " ,
464470 shouldExistInLocal : true ,
465471 shouldExistInRemote : true ,
466472 },
467473 checkedFileOrFolder {
468- path : "testFolder/testFile4 " ,
474+ path : "testFolder/testFileRemote2 " ,
469475 shouldExistInLocal : true ,
470476 shouldExistInRemote : true ,
471477 },
@@ -493,7 +499,7 @@ func createTestFilesAndFolders(local string, remote string, syncClient *SyncConf
493499 shouldExistInRemote : true ,
494500 },
495501 checkedFileOrFolder {
496- path : "testFolder2 " ,
502+ path : "testFolderLocal " ,
497503 shouldExistInLocal : true ,
498504 shouldExistInRemote : true ,
499505 },
@@ -514,24 +520,24 @@ func createTestFilesAndFolders(local string, remote string, syncClient *SyncConf
514520 },
515521
516522 checkedFileOrFolder {
517- path : "testFolder3 " ,
523+ path : "testFolderRemote " ,
518524 shouldExistInLocal : true ,
519525 shouldExistInRemote : true ,
520526 },
521527 checkedFileOrFolder {
522528 path : "ignoreFolderRemote" ,
523- shouldExistInLocal : true ,
524- shouldExistInRemote : false ,
529+ shouldExistInLocal : false ,
530+ shouldExistInRemote : true ,
525531 },
526532 checkedFileOrFolder {
527533 path : "noDownloadFolderRemote" ,
528- shouldExistInLocal : true ,
534+ shouldExistInLocal : false ,
529535 shouldExistInRemote : true ,
530536 },
531537 checkedFileOrFolder {
532538 path : "noUploadFolderRemote" ,
533539 shouldExistInLocal : true ,
534- shouldExistInRemote : false ,
540+ shouldExistInRemote : true ,
535541 },
536542 }
537543
0 commit comments