MM-18881 - Attempting to configure uninstalled plugins gets st… (#12687)
* MM-18881 - Attempting to configure uninstalled plugins gets stuck at Loading... without timeout. * Added a test * Closing websocketclient
Этот коммит содержится в:
@@ -305,11 +305,34 @@ func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
require.Equal(t, "testplugin", manifest.Id)
|
||||
|
||||
// Successful remove
|
||||
webSocketClient, err := th.CreateWebSocketSystemAdminClient()
|
||||
require.Nil(t, err)
|
||||
webSocketClient.Listen()
|
||||
defer webSocketClient.Close()
|
||||
done := make(chan bool)
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case resp := <-webSocketClient.EventChannel:
|
||||
if resp.Event == model.WEBSOCKET_EVENT_PLUGIN_STATUSES_CHANGED && len(resp.Data["plugin_statuses"].([]interface{})) == 0 {
|
||||
done <- true
|
||||
return
|
||||
}
|
||||
case <-time.After(5 * time.Second):
|
||||
done <- false
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
testCluster.ClearMessages()
|
||||
ok, resp := th.SystemAdminClient.RemovePlugin(manifest.Id)
|
||||
CheckNoError(t, resp)
|
||||
require.True(t, ok)
|
||||
|
||||
result := <-done
|
||||
require.True(t, result, "plugin_statuses_changed websocket event was not received")
|
||||
|
||||
messages = testCluster.GetMessages()
|
||||
|
||||
expectedRemoveMessage := &model.ClusterMessage{
|
||||
|
||||
@@ -251,6 +251,10 @@ func (a *App) removePlugin(id string) *model.AppError {
|
||||
},
|
||||
)
|
||||
|
||||
if err := a.notifyPluginStatusesChanged(); err != nil {
|
||||
mlog.Error("Failed to notify plugin status changed", mlog.Err(err))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user