[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 удалений

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

@@ -5,6 +5,7 @@ package commands
import (
"bytes"
"context"
"fmt"
"io"
"os"
@@ -31,7 +32,7 @@ func (s *MmctlUnitTestSuite) TestLogsCmd() {
s.client.
EXPECT().
GetLogs(0, 1).
GetLogs(context.Background(), 0, 1).
Return(mockSingleLogLine, &model.Response{}, nil).
Times(1)
@@ -48,7 +49,7 @@ func (s *MmctlUnitTestSuite) TestLogsCmd() {
s.client.
EXPECT().
GetLogs(0, 0).
GetLogs(context.Background(), 0, 0).
Return(mockSingleLogLine, &model.Response{}, nil).
Times(1)
@@ -67,7 +68,7 @@ func (s *MmctlUnitTestSuite) TestLogsCmd() {
s.client.
EXPECT().
GetLogs(0, 1).
GetLogs(context.Background(), 0, 1).
Return(mockSingleLogLine, &model.Response{}, nil).
Times(1)