MM-61450 fix errcheck issue in server/channel/app/permissions_test.go (#31132)
Этот коммит содержится в:
@@ -111,7 +111,6 @@ linters:
|
|||||||
channels/app/bot_test.go|\
|
channels/app/bot_test.go|\
|
||||||
channels/app/file_test.go|\
|
channels/app/file_test.go|\
|
||||||
channels/app/helper_test.go|\
|
channels/app/helper_test.go|\
|
||||||
channels/app/permissions_test.go|\
|
|
||||||
channels/app/platform/helper_test.go|\
|
channels/app/platform/helper_test.go|\
|
||||||
channels/store/localcachelayer/channel_layer.go|\
|
channels/store/localcachelayer/channel_layer.go|\
|
||||||
channels/store/localcachelayer/channel_layer_test.go|\
|
channels/store/localcachelayer/channel_layer_test.go|\
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ func TestExportPermissions(t *testing.T) {
|
|||||||
|
|
||||||
var scheme *model.Scheme
|
var scheme *model.Scheme
|
||||||
var roles []*model.Role
|
var roles []*model.Role
|
||||||
withMigrationMarkedComplete(th, func() {
|
withMigrationMarkedComplete(t, th, func() {
|
||||||
scheme, roles = th.CreateScheme()
|
scheme, roles = th.CreateScheme()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -102,7 +102,8 @@ func TestMigration(t *testing.T) {
|
|||||||
assert.Contains(t, role.Permissions, model.PermissionDeleteOthersEmojis.Id)
|
assert.Contains(t, role.Permissions, model.PermissionDeleteOthersEmojis.Id)
|
||||||
assert.Contains(t, role.Permissions, model.PermissionUseGroupMentions.Id)
|
assert.Contains(t, role.Permissions, model.PermissionUseGroupMentions.Id)
|
||||||
|
|
||||||
th.App.ResetPermissionsSystem()
|
appErr := th.App.ResetPermissionsSystem()
|
||||||
|
require.Nil(t, appErr)
|
||||||
|
|
||||||
role, err = th.App.GetRoleByName(context.Background(), model.SystemAdminRoleId)
|
role, err = th.App.GetRoleByName(context.Background(), model.SystemAdminRoleId)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
@@ -112,13 +113,16 @@ func TestMigration(t *testing.T) {
|
|||||||
assert.Contains(t, role.Permissions, model.PermissionUseGroupMentions.Id)
|
assert.Contains(t, role.Permissions, model.PermissionUseGroupMentions.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withMigrationMarkedComplete(th *TestHelper, f func()) {
|
func withMigrationMarkedComplete(t *testing.T, th *TestHelper, f func()) {
|
||||||
// Mark the migration as done.
|
// Mark the migration as done.
|
||||||
th.App.Srv().Store().System().PermanentDeleteByName(model.MigrationKeyAdvancedPermissionsPhase2)
|
_, err := th.App.Srv().Store().System().PermanentDeleteByName(model.MigrationKeyAdvancedPermissionsPhase2)
|
||||||
th.App.Srv().Store().System().Save(&model.System{Name: model.MigrationKeyAdvancedPermissionsPhase2, Value: "true"})
|
require.NoError(t, err)
|
||||||
|
err = th.App.Srv().Store().System().Save(&model.System{Name: model.MigrationKeyAdvancedPermissionsPhase2, Value: "true"})
|
||||||
|
require.NoError(t, err)
|
||||||
// Un-mark the migration at the end of the test.
|
// Un-mark the migration at the end of the test.
|
||||||
defer func() {
|
defer func() {
|
||||||
th.App.Srv().Store().System().PermanentDeleteByName(model.MigrationKeyAdvancedPermissionsPhase2)
|
_, err := th.App.Srv().Store().System().PermanentDeleteByName(model.MigrationKeyAdvancedPermissionsPhase2)
|
||||||
|
require.NoError(t, err)
|
||||||
}()
|
}()
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user