[MM-61099] Fix errcheck issues in server/channels/app/brand.go (#30679)

* [MM-28779] Fix errcheck issues in server/channels/app/brand.go

Remove brand.go from the errcheck exclusion list in .golangci.yml and fixed the error by properly handling the return value from a.MoveFile().

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* [MM-28779] Add test to verify brand image backup functionality

Add a new test that verifies backup of the original brand image happens when a new one is uploaded. This helps to ensure the fix for errcheck issues is working as expected.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* use seperate temporary filestore for each test

* Use FileSettings.Directory instead of finding the dir programatically

* Fix another test

* Fix defer

* Update server/channels/api4/job_test.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix bad bot commit

* Cleanup logs message

* cleanup file path

* Fix error variable names

* WIP:cleanup panic ussage

* Revert "WIP:cleanup panic ussage"

This reverts commit c3284e4427a41c818acc161926cd2535dee9a6b9.

* cleanup error checks

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Ben Schumacher
2025-05-21 16:35:00 +02:00
коммит произвёл GitHub
родитель 1cb244e876
Коммит 6de3379994
10 изменённых файлов: 171 добавлений и 79 удалений

Просмотреть файл

@@ -14,7 +14,7 @@ import (
func TestNotifyAdmin(t *testing.T) {
t.Run("error when notifying with empty data", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), nil)
@@ -24,7 +24,7 @@ func TestNotifyAdmin(t *testing.T) {
})
t.Run("error when plan is unknown when notifying on upgrade", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), &model.NotifyAdminToUpgradeRequest{
@@ -38,7 +38,7 @@ func TestNotifyAdmin(t *testing.T) {
})
t.Run("error when plan is unknown when notifying to trial", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), &model.NotifyAdminToUpgradeRequest{
@@ -53,7 +53,7 @@ func TestNotifyAdmin(t *testing.T) {
})
t.Run("error when feature is unknown when notifying on upgrade", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), &model.NotifyAdminToUpgradeRequest{
@@ -67,7 +67,7 @@ func TestNotifyAdmin(t *testing.T) {
})
t.Run("error when feature is unknown when notifying to trial", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), &model.NotifyAdminToUpgradeRequest{
@@ -82,7 +82,7 @@ func TestNotifyAdmin(t *testing.T) {
})
t.Run("error when user tries to notify again on same feature within the cool off period", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), &model.NotifyAdminToUpgradeRequest{
@@ -104,7 +104,7 @@ func TestNotifyAdmin(t *testing.T) {
})
t.Run("successfully save upgrade notification", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), &model.NotifyAdminToUpgradeRequest{
@@ -119,7 +119,7 @@ func TestNotifyAdmin(t *testing.T) {
func TestTriggerNotifyAdmin(t *testing.T) {
t.Run("error when EnableAPITriggerAdminNotifications is not true", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPITriggerAdminNotifications = false })
@@ -132,7 +132,7 @@ func TestTriggerNotifyAdmin(t *testing.T) {
})
t.Run("error when non admins try to trigger notifications", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
th := Setup(t).InitBasic()
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableAPITriggerAdminNotifications = true })