mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Fixed errcheck issues in server/channels/app/file_bench_test.go (#29003)
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
748f8227e3
commit
2e2782e4bf
2 changed files with 23 additions and 15 deletions
|
|
@ -92,7 +92,6 @@ issues:
|
|||
channels/app/brand.go|\
|
||||
channels/app/config_test.go|\
|
||||
channels/app/file.go|\
|
||||
channels/app/file_bench_test.go|\
|
||||
channels/app/file_test.go|\
|
||||
channels/app/helper_test.go|\
|
||||
channels/app/import_functions.go|\
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var randomJPEG []byte
|
||||
|
|
@ -82,13 +83,13 @@ func BenchmarkUploadFile(b *testing.B) {
|
|||
{
|
||||
title: "raw-ish DoUploadFile",
|
||||
f: func(b *testing.B, n int, data []byte, ext string) {
|
||||
info1, err := th.App.DoUploadFile(th.Context, time.Now(), teamID, channelID,
|
||||
info1, appErr := th.App.DoUploadFile(th.Context, time.Now(), teamID, channelID,
|
||||
userID, fmt.Sprintf("BenchmarkDoUploadFile-%d%s", n, ext), data, true)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info1.Id)
|
||||
th.App.RemoveFile(info1.Path)
|
||||
require.Nil(b, appErr)
|
||||
err := th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info1.Id)
|
||||
require.NoError(b, err)
|
||||
appErr = th.App.RemoveFile(info1.Path)
|
||||
require.Nil(b, appErr)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -105,8 +106,10 @@ func BenchmarkUploadFile(b *testing.B) {
|
|||
if aerr != nil {
|
||||
b.Fatal(aerr)
|
||||
}
|
||||
th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
th.App.RemoveFile(info.Path)
|
||||
err := th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
require.NoError(b, err)
|
||||
appErr := th.App.RemoveFile(info.Path)
|
||||
require.Nil(b, appErr)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -123,8 +126,10 @@ func BenchmarkUploadFile(b *testing.B) {
|
|||
if aerr != nil {
|
||||
b.Fatal(aerr)
|
||||
}
|
||||
th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
th.App.RemoveFile(info.Path)
|
||||
err := th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
require.NoError(b, err)
|
||||
appErr := th.App.RemoveFile(info.Path)
|
||||
require.Nil(b, appErr)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -140,8 +145,10 @@ func BenchmarkUploadFile(b *testing.B) {
|
|||
if aerr != nil {
|
||||
b.Fatal(aerr)
|
||||
}
|
||||
th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
th.App.RemoveFile(info.Path)
|
||||
err := th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
require.NoError(b, err)
|
||||
appErr := th.App.RemoveFile(info.Path)
|
||||
require.Nil(b, appErr)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -157,8 +164,10 @@ func BenchmarkUploadFile(b *testing.B) {
|
|||
if aerr != nil {
|
||||
b.Fatal(aerr)
|
||||
}
|
||||
th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
th.App.RemoveFile(info.Path)
|
||||
err := th.App.Srv().Store().FileInfo().PermanentDelete(th.Context, info.Id)
|
||||
require.NoError(b, err)
|
||||
appErr := th.App.RemoveFile(info.Path)
|
||||
require.Nil(b, appErr)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue