]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
sync: tests: properly scope err variable
authorSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 10:12:22 +0000 (12:12 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 13:15:43 +0000 (15:15 +0200)
cmd/safcm-remote/sync/files_test.go

index 11d386d59f09edaa7e768d442e711ac2951ea71b..3cf7e04358386909a237150536e50d7acf03416d 100644 (file)
@@ -834,7 +834,7 @@ func TestSyncFiles(t *testing.T) {
 
                        // Create separate test directory for each test case
                        path := filepath.Join(cwd, "testdata", "files-"+tc.name)
-                       err = os.Mkdir(path, 0700)
+                       err := os.Mkdir(path, 0700)
                        if err != nil {
                                t.Fatal(err)
                        }
@@ -852,7 +852,7 @@ func TestSyncFiles(t *testing.T) {
                        })
                        s.setDefaults()
 
-                       err := s.syncFiles()
+                       err = s.syncFiles()
                        testutil.AssertErrorEqual(t, "err", err, tc.expErr)
                        dbg := res.Wait()
                        // Remove random file names from result
@@ -2374,7 +2374,7 @@ file
                t.Run(tc.name, func(t *testing.T) {
                        // Create separate test directory for each test case
                        path := filepath.Join(cwd, "testdata", "file-"+tc.name)
-                       err = os.Mkdir(path, 0700)
+                       err := os.Mkdir(path, 0700)
                        if err != nil {
                                t.Fatal(err)
                        }
@@ -2396,7 +2396,7 @@ file
                        rand.Seed(0)
 
                        var changed bool
-                       err := s.syncFile(tc.file, &changed)
+                       err = s.syncFile(tc.file, &changed)
                        testutil.AssertErrorEqual(t, "err", err, tc.expErr)
                        dbg := res.Wait()
                        // Remove random file names from result