[MM-49989] Pass a context.Context to Client4 methods (#22922)

* Migrate all method in model/client4.go to accept a context.Context

* Fix th.*Client

* Fix remaining issues

* Empty commit to triger CI

* Fix test

* Add cancellation test

* Test that returned error is context.Canceled

* Fix bad merge

* Update mmctl code

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Ben Schumacher
2023-06-06 23:29:29 +02:00
коммит произвёл GitHub
родитель 7116e9267a
Коммит 6c82605df0
140 изменённых файлов: 7516 добавлений и 7333 удалений

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

@@ -4,6 +4,7 @@
package commands
import (
"context"
"errors"
"fmt"
@@ -108,9 +109,9 @@ func (s *MmctlE2ETestSuite) TestDeleteTeamsCmdF() {
// Set EnableAPITeamDeletion
enableConfig := true
config, _, _ := c.GetConfig()
config, _, _ := c.GetConfig(context.TODO())
config.ServiceSettings.EnableAPITeamDeletion = &enableConfig
_, _, _ = c.UpdateConfig(config)
_, _, _ = c.UpdateConfig(context.TODO(), config)
// Deletion should succeed for both local and SystemAdmin client now
err = deleteTeamsCmdF(c, cmd, args)
@@ -121,9 +122,9 @@ func (s *MmctlE2ETestSuite) TestDeleteTeamsCmdF() {
// Reset config
enableConfig = false
config, _, _ = c.GetConfig()
config, _, _ = c.GetConfig(context.TODO())
config.ServiceSettings.EnableAPITeamDeletion = &enableConfig
_, _, _ = c.UpdateConfig(config)
_, _, _ = c.UpdateConfig(context.TODO(), config)
})
s.Run("Permission denied error for system admin when deleting a valid team", func() {