[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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7116e9267a
Коммит
6c82605df0
@@ -4,6 +4,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
@@ -23,7 +24,7 @@ func (s *MmctlUnitTestSuite) TestExportCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateJob(mockJob).
|
||||
CreateJob(context.Background(), mockJob).
|
||||
Return(mockJob, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -43,7 +44,7 @@ func (s *MmctlUnitTestSuite) TestExportCreateCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
CreateJob(mockJob).
|
||||
CreateJob(context.Background(), mockJob).
|
||||
Return(mockJob, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -65,7 +66,7 @@ func (s *MmctlUnitTestSuite) TestExportDeleteCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
DeleteExport(exportName).
|
||||
DeleteExport(context.Background(), exportName).
|
||||
Return(&model.Response{StatusCode: http.StatusOK}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -83,7 +84,7 @@ func (s *MmctlUnitTestSuite) TestExportListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListExports().
|
||||
ListExports(context.Background()).
|
||||
Return(mockExports, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
@@ -104,7 +105,7 @@ func (s *MmctlUnitTestSuite) TestExportListCmdF() {
|
||||
|
||||
s.client.
|
||||
EXPECT().
|
||||
ListExports().
|
||||
ListExports(context.Background()).
|
||||
Return(mockExports, &model.Response{}, nil).
|
||||
Times(1)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user