Files
zeekay 8feb24ea1f One name for this fork, and it is ours
The server module named github.com/hanzoai/team/server/v8 — a path that
resolves to the retired workspace's repository, not this one — while
server/public still published github.com/mattermost/mattermost/server/public.
Both are github.com/hanzoteam/server/... now, which is where this code
actually lives.

That second half is what made the binary unbootable. Upstream's public path
stayed claimed by upstream, mattermost-plugin-ai imported it, and the build
linked public/model twice; public/plugin's gob.Register then ran twice under
one name and panicked at init, before main. Reverting the rename traded the
brand for a working binary. Rebranding the plugin alongside it needs no such
trade: the agents fork is github.com/hanzoteam/agents/v2 against our public
module, so no module named mattermost/mattermost is in the graph at all.

Measured: `go list -deps ./cmd/mattermost` names exactly one public/model, and
it is ours.
2026-08-28 23:35:36 -07:00

121 lines
3.5 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package testlib
import (
"sync"
"github.com/hanzoteam/server/server/public/model"
"github.com/hanzoteam/server/server/public/shared/request"
"github.com/hanzoteam/server/server/v8/einterfaces"
)
type FakeClusterInterface struct {
clusterMessageHandler einterfaces.ClusterMessageHandler
mut sync.RWMutex
messages []*model.ClusterMessage
}
func (c *FakeClusterInterface) StartInterNodeCommunication() {}
func (c *FakeClusterInterface) StopInterNodeCommunication() {}
func (c *FakeClusterInterface) RegisterClusterMessageHandler(event model.ClusterEvent, crm einterfaces.ClusterMessageHandler) {
c.clusterMessageHandler = crm
}
func (c *FakeClusterInterface) HealthScore() int {
return 0
}
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, error) { return nil, nil }
func (c *FakeClusterInterface) SendClusterMessage(message *model.ClusterMessage) {
c.mut.Lock()
defer c.mut.Unlock()
c.messages = append(c.messages, message)
}
func (c *FakeClusterInterface) SendClusterMessageToNode(nodeID string, message *model.ClusterMessage) error {
c.mut.Lock()
defer c.mut.Unlock()
c.messages = append(c.messages, message)
return nil
}
func (c *FakeClusterInterface) NotifyMsg(buf []byte) {}
func (c *FakeClusterInterface) GetClusterStats(rctx request.CTX) ([]*model.ClusterStats, *model.AppError) {
return nil, nil
}
func (c *FakeClusterInterface) GetLogs(rctx request.CTX, page, perPage int) ([]string, *model.AppError) {
return []string{}, nil
}
func (c *FakeClusterInterface) QueryLogs(rctx request.CTX, page, perPage int) (map[string][]string, *model.AppError) {
return make(map[string][]string), nil
}
func (c *FakeClusterInterface) GenerateSupportPacket(rctx request.CTX, options *model.SupportPacketOptions) (map[string][]model.FileData, error) {
return nil, nil
}
func (c *FakeClusterInterface) ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError {
return nil
}
func (c *FakeClusterInterface) SendClearRoleCacheMessage() {
if c.clusterMessageHandler != nil {
c.clusterMessageHandler(&model.ClusterMessage{
Event: model.ClusterEventInvalidateCacheForRoles,
})
}
}
func (c *FakeClusterInterface) GetPluginStatuses() (model.PluginStatuses, *model.AppError) {
return nil, nil
}
func (c *FakeClusterInterface) GetMessages() []*model.ClusterMessage {
c.mut.RLock()
defer c.mut.RUnlock()
return c.messages
}
func (c *FakeClusterInterface) SelectMessages(filterCond func(message *model.ClusterMessage) bool) []*model.ClusterMessage {
c.mut.RLock()
defer c.mut.RUnlock()
filteredMessages := []*model.ClusterMessage{}
for _, msg := range c.messages {
if filterCond(msg) {
filteredMessages = append(filteredMessages, msg)
}
}
return filteredMessages
}
func (c *FakeClusterInterface) ClearMessages() {
c.mut.Lock()
defer c.mut.Unlock()
c.messages = nil
}
func (c *FakeClusterInterface) WebConnCountForUser(userID string) (int, *model.AppError) {
return 0, nil
}
func (c *FakeClusterInterface) GetWSQueues(userID, connectionID string, seqNum int64) (map[string]*model.WSQueues, error) {
return nil, nil
}
func (c *FakeClusterInterface) Shutdown() {}