MM-20913 add client API Client.GetServerBusy to fetch server busy state and timeout. (#13986)
* MM-20913 add client API to fetch server busy state and timeout * deprecate current API that only returns timeout * required for mmctl MM-20913 * restore deleted unit test for GetServerBusyExpires Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -571,6 +571,25 @@ func TestClearServerBusy(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetServerBusy(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.Srv().Busy.Set(time.Second * 30)
|
||||
|
||||
t.Run("as system user", func(t *testing.T) {
|
||||
_, resp := th.Client.GetServerBusy()
|
||||
CheckForbiddenStatus(t, resp)
|
||||
})
|
||||
|
||||
t.Run("as system admin", func(t *testing.T) {
|
||||
sbs, resp := th.SystemAdminClient.GetServerBusy()
|
||||
expires := time.Unix(sbs.Expires, 0)
|
||||
CheckNoError(t, resp)
|
||||
require.Greater(t, expires.Unix(), time.Now().Unix())
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetServerBusyExpires(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Ссылка в новой задаче
Block a user