diff --git a/backend/app/migrator/backup_test.go b/backend/app/migrator/backup_test.go index 781e95f4..b7d95d08 100644 --- a/backend/app/migrator/backup_test.go +++ b/backend/app/migrator/backup_test.go @@ -16,7 +16,8 @@ func TestBackup_RemoveOldBackupFiles(t *testing.T) { loc := "/tmp/remark-backups.test" defer os.RemoveAll(loc) - os.MkdirAll(loc, 0700) + assert.NoError(t, os.MkdirAll(loc, 0700)) + for i := 1; i <= 10; i++ { fname := fmt.Sprintf("%s/backup-site1-201712%02d.gz", loc, i) err := ioutil.WriteFile(fname, []byte("blah"), 0600) @@ -40,7 +41,7 @@ func TestBackup_RemoveOldBackupFiles(t *testing.T) { func TestBackup_MakeBackup(t *testing.T) { loc := "/tmp/remark-backups.test" defer os.RemoveAll(loc) - os.MkdirAll(loc, 0700) + assert.NoError(t, os.MkdirAll(loc, 0700)) bk := AutoBackup{BackupLocation: loc, SiteID: "site1", KeepMax: 3, Exporter: &mockExporter{}} fname, err := bk.makeBackup() @@ -56,7 +57,7 @@ func TestBackup_MakeBackup(t *testing.T) { func TestBackup_Do(t *testing.T) { loc := "/tmp/remark-backups.test" defer os.RemoveAll(loc) - os.MkdirAll(loc, 0700) + assert.NoError(t, os.MkdirAll(loc, 0700)) ctx, cancel := context.WithCancel(context.Background()) go func() { diff --git a/backend/app/rest/api/admin_test.go b/backend/app/rest/api/admin_test.go index d4848ab8..d3021b2d 100644 --- a/backend/app/rest/api/admin_test.go +++ b/backend/app/rest/api/admin_test.go @@ -113,11 +113,13 @@ func TestAdmin_Title(t *testing.T) { srv.DataService.TitleExtractor = service.NewTitleExtractor(http.Client{Timeout: time.Second}) tss := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.String() == "/post1" { - w.Write([]byte("post1 blah 123 2222")) + _, err := w.Write([]byte("post1 blah 123 2222")) + assert.NoError(t, err) return } if r.URL.String() == "/post2" { - w.Write([]byte("post2 blah 123 2222")) + _, err := w.Write([]byte("post2 blah 123 2222")) + assert.NoError(t, err) return } w.WriteHeader(404) diff --git a/backend/app/rest/proxy/image_test.go b/backend/app/rest/proxy/image_test.go index dc8eae0c..13d3a1b8 100644 --- a/backend/app/rest/proxy/image_test.go +++ b/backend/app/rest/proxy/image_test.go @@ -132,7 +132,8 @@ func imgHTTPServer(t *testing.T) *httptest.Server { t.Log("http img request", r.URL) w.Header().Add("Content-Length", "123") w.Header().Add("Content-Type", "image/png") - w.Write([]byte(fmt.Sprintf("%123s", "X"))) + _, err := w.Write([]byte(fmt.Sprintf("%123s", "X"))) + assert.NoError(t, err) return } if r.URL.Path == "/image/img-slow.png" { diff --git a/backend/app/store/service/service_test.go b/backend/app/store/service/service_test.go index 0918c210..4012be13 100644 --- a/backend/app/store/service/service_test.go +++ b/backend/app/store/service/service_test.go @@ -261,7 +261,7 @@ func TestService_VoteAggressive(t *testing.T) { wg.Add(1) go func() { defer wg.Done() - b.Vote(store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, res[0].ID, "user1", true) + _, _ = b.Vote(store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, res[0].ID, "user1", true) }() } wg.Wait() @@ -280,7 +280,7 @@ func TestService_VoteAggressive(t *testing.T) { go func() { defer wg.Done() val := rand.Intn(2) > 0 - b.Vote(store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, res[0].ID, "user1", val) + _, _ = b.Vote(store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, res[0].ID, "user1", val) }() } wg.Wait()