mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* MM-16272 - Synchronize plugins across cluster (#11611) * MM-16272 - Synchronize plugins across cluster * Adding a test * MM-16272 - Fixed tests * MM-16272 - PR feedback * MM-16270 - Plugin Sync (#11615) * Initial implementation for plugin synch with file store. WIP * Removed ListAll implementation. Used ListDirectory and change localstore to be consistent and return all items (files and folders) from directory * Refactored plugin filestore operations out of main install/remove plugin * Fixing error handling details * Changes to use structured logging * More logging fixes * Wording and comments improvements * Error handling and control flow improvements * Changed managed flag check to use os.stat * Added file store plugin dir and filename consts * Replaced FileRead to use a the FileReader in PluginSync * Minor styling and PR feedback changes * Minor error handling improvements * Added unit test for SyncPlugins. Changed SyncPlugins to use plugins environment to list available plugins * PR Feedback improvements * Minor err handling fix * Removing FileStorePath from PluginEventData (#11644) * Fix plugin path (#11654) * tweak path, logging Fix an issue not finding the plugins folder in S3. Tweak logging messages to add additional clarity. * Removing FileExists check when Syncing plugins. Updated localstore to not return an error when directory does not exist * PR Feedback * Install prepackaged plugins locally only (#11656) * s/uninstall/remove * Updated ClusterMessage comment * Updated PluginSync to test against s3 + local storage
67 lines
1.9 KiB
Go
67 lines
1.9 KiB
Go
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package testlib
|
|
|
|
import (
|
|
"github.com/mattermost/mattermost-server/einterfaces"
|
|
"github.com/mattermost/mattermost-server/model"
|
|
)
|
|
|
|
type FakeClusterInterface struct {
|
|
clusterMessageHandler einterfaces.ClusterMessageHandler
|
|
messages []*model.ClusterMessage
|
|
}
|
|
|
|
func (c *FakeClusterInterface) StartInterNodeCommunication() {}
|
|
|
|
func (c *FakeClusterInterface) StopInterNodeCommunication() {}
|
|
|
|
func (c *FakeClusterInterface) RegisterClusterMessageHandler(event string, crm einterfaces.ClusterMessageHandler) {
|
|
c.clusterMessageHandler = crm
|
|
}
|
|
|
|
func (c *FakeClusterInterface) GetClusterId() string { return "" }
|
|
|
|
func (c *FakeClusterInterface) IsLeader() bool { return false }
|
|
|
|
func (c *FakeClusterInterface) GetMyClusterInfo() *model.ClusterInfo { return nil }
|
|
|
|
func (c *FakeClusterInterface) GetClusterInfos() []*model.ClusterInfo { return nil }
|
|
|
|
func (c *FakeClusterInterface) SendClusterMessage(message *model.ClusterMessage) {
|
|
c.messages = append(c.messages, message)
|
|
}
|
|
|
|
func (c *FakeClusterInterface) NotifyMsg(buf []byte) {}
|
|
|
|
func (c *FakeClusterInterface) GetClusterStats() ([]*model.ClusterStats, *model.AppError) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (c *FakeClusterInterface) GetLogs(page, perPage int) ([]string, *model.AppError) {
|
|
return []string{}, nil
|
|
}
|
|
|
|
func (c *FakeClusterInterface) ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError {
|
|
return nil
|
|
}
|
|
|
|
func (c *FakeClusterInterface) SendClearRoleCacheMessage() {
|
|
c.clusterMessageHandler(&model.ClusterMessage{
|
|
Event: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_ROLES,
|
|
})
|
|
}
|
|
|
|
func (c *FakeClusterInterface) GetPluginStatuses() (model.PluginStatuses, *model.AppError) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (c *FakeClusterInterface) GetMessages() []*model.ClusterMessage {
|
|
return c.messages
|
|
}
|
|
|
|
func (c *FakeClusterInterface) ClearMessages() {
|
|
c.messages = nil
|
|
}
|