Skip to content

Commit 2c5bff8

Browse files
authored
Merge pull request #152 from covexo/sync-test-issues
Fix small test issues
2 parents a0d1ce7 + c0331e4 commit 2c5bff8

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

pkg/devspace/sync/sync_config_test.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func createTestSyncClient(testLocalPath, testRemotePath string) *SyncConfig {
3737
}
3838
}
3939

40-
func removeFolderAndWait(from, to, postfix string, t *testing.T) error {
40+
func removeFolderAndWait(from, to, postfix string) error {
4141
foldernameFrom := path.Join(from, "testFolder"+postfix)
4242
foldernameTo := path.Join(to, "testFolder"+postfix)
4343

@@ -54,7 +54,7 @@ func removeFolderAndWait(from, to, postfix string, t *testing.T) error {
5454
return fmt.Errorf("Removing folder %s wasn't correctly synced to %s", foldernameFrom, foldernameTo)
5555
}
5656

57-
func removeFileAndWait(from, to, postfix string, t *testing.T) error {
57+
func removeFileAndWait(from, to, postfix string) error {
5858
filenameFrom := path.Join(from, "testFile"+postfix)
5959
filenameTo := path.Join(to, "testFile"+postfix)
6060

@@ -71,7 +71,7 @@ func removeFileAndWait(from, to, postfix string, t *testing.T) error {
7171
return fmt.Errorf("Removing file %s wasn't correctly synced to %s", filenameFrom, filenameTo)
7272
}
7373

74-
func createFolderAndWait(from, to, postfix string, t *testing.T) error {
74+
func createFolderAndWait(from, to, postfix string) error {
7575
foldernameFrom := path.Join(from, "testFolder"+postfix)
7676
foldernameTo := path.Join(to, "testFolder"+postfix)
7777

@@ -92,7 +92,7 @@ func createFolderAndWait(from, to, postfix string, t *testing.T) error {
9292
return fmt.Errorf("Created folder %s wasn't correctly synced to %s", foldernameFrom, foldernameTo)
9393
}
9494

95-
func createFileAndWait(from, to, postfix string, t *testing.T) error {
95+
func createFileAndWait(from, to, postfix string) error {
9696
filenameFrom := path.Join(from, "testFile"+postfix)
9797
filenameTo := path.Join(to, "testFile"+postfix)
9898
fileContents := "testFile" + postfix
@@ -225,6 +225,7 @@ func TestInitialSync(t *testing.T) {
225225
}
226226
if string(data) != fileContents {
227227
t.Errorf("Wrong file contentsin file %s, got %s, expected %s", localFile, string(data), fileContents)
228+
return
228229
}
229230

230231
data, err = ioutil.ReadFile(remoteFile)
@@ -234,6 +235,7 @@ func TestInitialSync(t *testing.T) {
234235
}
235236
if string(data) != fileContents {
236237
t.Errorf("Wrong file contentsin file %s, got %s, expected %s", remoteFile, string(data), fileContents)
238+
return
237239
}
238240
}
239241

@@ -281,7 +283,7 @@ func TestRunningSync(t *testing.T) {
281283
defer os.RemoveAll(remote)
282284
defer os.RemoveAll(local)
283285

284-
syncClient := createTestSyncClient(remote, local)
286+
syncClient := createTestSyncClient(local, remote)
285287
defer syncClient.Stop()
286288

287289
syncClient.errorChan = make(chan error)
@@ -307,54 +309,54 @@ func TestRunningSync(t *testing.T) {
307309
return
308310
}
309311

310-
// Start sync and do inital sync
312+
// Start sync and do initial sync
311313
syncClient.mainLoop()
312314

313315
// Create
314-
err = createFileAndWait(local, remote, "1", t)
316+
err = createFileAndWait(local, remote, "1")
315317
if err != nil {
316318
t.Error(err)
317319
return
318320
}
319321

320-
err = createFileAndWait(remote, local, "2", t)
322+
err = createFileAndWait(remote, local, "2")
321323
if err != nil {
322324
t.Error(err)
323325
return
324326
}
325327

326-
err = createFolderAndWait(local, remote, "1", t)
328+
err = createFolderAndWait(local, remote, "1")
327329
if err != nil {
328330
t.Error(err)
329331
return
330332
}
331333

332-
err = createFolderAndWait(remote, local, "2", t)
334+
err = createFolderAndWait(remote, local, "2")
333335
if err != nil {
334336
t.Error(err)
335337
return
336338
}
337339

338340
// Remove
339-
err = removeFileAndWait(local, remote, "1", t)
341+
err = removeFileAndWait(local, remote, "1")
340342
if err != nil {
341343
t.Error(err)
342344
return
343345
}
344346

345-
err = removeFileAndWait(remote, local, "2", t)
347+
err = removeFileAndWait(remote, local, "2")
346348
if err != nil {
347349
t.Error(err)
348350
return
349351
}
350352

351-
err = removeFolderAndWait(local, remote, "1", t)
353+
err = removeFolderAndWait(local, remote, "1")
352354
if err != nil {
353355
t.Error(err)
354356
return
355357
}
356358

357-
err = removeFolderAndWait(remote, local, "2", t)
359+
err = removeFolderAndWait(remote, local, "2")
358360
if err != nil {
359361
t.Error(err)
360362
return

0 commit comments

Comments
 (0)