test

package
v0.3.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CounterCheckTimeout = 20 * time.Second

Functions

func DelegatesWithId

func DelegatesWithId(nodeID string) *moleculer.BrokerDelegates

func DelegatesWithIdAndConfig

func DelegatesWithIdAndConfig(nodeID string, config moleculer.Config) *moleculer.BrokerDelegates

func Logger

func Logger(name string, value string) *log.Entry

func OrderMapArray

func OrderMapArray(list []map[string]interface{}, field string) []map[string]interface{}

OrderMapArray given an array of map[string]... this func will order based on the field name.

Types

type CounterCheck

type CounterCheck struct {
	// contains filtered or unexported fields
}

func Counter

func Counter() CounterCheck

func (*CounterCheck) Check

func (counter *CounterCheck) Check(name string, value int) error

func (*CounterCheck) CheckPrefixed

func (counter *CounterCheck) CheckPrefixed(name string, value int) error

func (*CounterCheck) Clear

func (counter *CounterCheck) Clear()

func (*CounterCheck) Inc

func (counter *CounterCheck) Inc(nodeID string, name string)

type NodeMock

type NodeMock struct {
	UpdateResult          bool
	ID                    string
	IncreaseSequenceCalls int
	HeartBeatCalls        int
	ExportAsMapResult     map[string]interface{}
	IsAvailableResult     bool
	IsExpiredResult       bool
	PublishCalls          int

	// Additional fields for missing methods
	Host        string
	IpList      []string
	Port        int
	UdpAddress  string
	Sequence    int64
	CpuSequence int64
	Cpu         int64
	IsLocalFlag bool
	Hostname    string
}

func (*NodeMock) Available added in v0.1.1

func (node *NodeMock) Available()

func (*NodeMock) ExportAsMap

func (node *NodeMock) ExportAsMap() map[string]interface{}

func (*NodeMock) GetCpu added in v0.3.7

func (node *NodeMock) GetCpu() int64

func (*NodeMock) GetCpuSequence added in v0.3.7

func (node *NodeMock) GetCpuSequence() int64

func (*NodeMock) GetHost added in v0.3.7

func (node *NodeMock) GetHost() string

Missing methods from Node interface

func (*NodeMock) GetHostname added in v0.3.7

func (node *NodeMock) GetHostname() string

func (*NodeMock) GetID

func (node *NodeMock) GetID() string

func (*NodeMock) GetIpList added in v0.3.7

func (node *NodeMock) GetIpList() []string

func (*NodeMock) GetPort added in v0.3.7

func (node *NodeMock) GetPort() int

func (*NodeMock) GetSequence added in v0.3.7

func (node *NodeMock) GetSequence() int64

func (*NodeMock) GetUdpAddress added in v0.3.7

func (node *NodeMock) GetUdpAddress() string

func (*NodeMock) HeartBeat

func (node *NodeMock) HeartBeat(heartbeat map[string]interface{})

func (*NodeMock) IncreaseSequence

func (node *NodeMock) IncreaseSequence()

func (*NodeMock) IsAvailable

func (node *NodeMock) IsAvailable() bool

func (*NodeMock) IsExpired

func (node *NodeMock) IsExpired(timeout time.Duration) bool

func (*NodeMock) IsLocal added in v0.3.7

func (node *NodeMock) IsLocal() bool

func (*NodeMock) Publish

func (node *NodeMock) Publish(service map[string]interface{})

func (*NodeMock) Unavailable

func (node *NodeMock) Unavailable()

func (*NodeMock) Update

func (node *NodeMock) Update(id string, info map[string]interface{}) (bool, []map[string]interface{})

func (*NodeMock) UpdateInfo added in v0.3.7

func (node *NodeMock) UpdateInfo(info map[string]interface{}) []map[string]interface{}

func (*NodeMock) UpdateMetrics added in v0.3.7

func (node *NodeMock) UpdateMetrics()

type RegistryMock added in v0.3.7

type RegistryMock struct {
	LocalNodeResult moleculer.Node
	Nodes           map[string]moleculer.Node
}

RegistryMock implements moleculer.Registry interface for testing

func (*RegistryMock) AddOfflineNode added in v0.3.7

func (r *RegistryMock) AddOfflineNode(nodeID, hostname, ipAddress string, port int) moleculer.Node

func (*RegistryMock) DisconnectNode added in v0.3.7

func (r *RegistryMock) DisconnectNode(nodeID string)

func (*RegistryMock) ForEachNode added in v0.3.7

func (r *RegistryMock) ForEachNode(fn moleculer.ForEachNodeFunc)

func (*RegistryMock) GetLocalNode added in v0.3.7

func (r *RegistryMock) GetLocalNode() moleculer.Node

func (*RegistryMock) GetNodeByAddress added in v0.3.7

func (r *RegistryMock) GetNodeByAddress(host string) moleculer.Node

func (*RegistryMock) GetNodeByID added in v0.3.7

func (r *RegistryMock) GetNodeByID(nodeID string) moleculer.Node

func (*RegistryMock) RemoteNodeInfoReceived added in v0.3.7

func (r *RegistryMock) RemoteNodeInfoReceived(message moleculer.Payload)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL