Documentation
¶
Index ¶
- func CreateClient(t *testing.T, ctx context.Context, logger logger.Logger, port int) (*client.Client, error)
- func GenerateTestDataKB(sizeKB int, randomData bool) ([]byte, error)
- func GenerateTestDataMB(sizeMB int, randomData bool) ([]byte, error)
- func ShutdownTestNodes(t *testing.T, nodes []*TestNode) error
- type TestNode
- func (t *TestNode) Account() share.Account
- func (t *TestNode) Config() config.Config
- func (t *TestNode) Ctx() context.Context
- func (t *TestNode) DBM() *db.Manager
- func (t *TestNode) Dir() string
- func (t *TestNode) FDB() *fdb.FDB
- func (t *TestNode) IsNode() bool
- func (t *TestNode) IsRole(role types.Role) bool
- func (t *TestNode) IsSequencer() bool
- func (t *TestNode) IsValidator() bool
- func (t *TestNode) Logger() logger.Logger
- func (t *TestNode) Node() *node.Node
- func (t *TestNode) PeerID() peer.ID
- func (t *TestNode) RPC() *rpc.RPC
- func (t *TestNode) RequiresDKG() bool
- func (t *TestNode) Role() types.Role
- func (t *TestNode) SendAndReceiveMessage(targetNode *TestNode, transportType types.TransportType, ...) ([]byte, error)
- func (t *TestNode) SendMessage(targetNode *TestNode, transportType types.TransportType, ...) error
- func (t *TestNode) State() *state.StateManager
- func (t *TestNode) WaitForPeersConnected(expectedPeerCount int, timeout time.Duration) error
- type TestNodes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateClient ¶
func GenerateTestDataKB ¶
GenerateTestDataKB creates a byte slice of the exact size requested in KB. By default, it uses a repeating pattern for efficiency. Use randomData=true for cryptographically secure random data when testing hashing/encoding.
func GenerateTestDataMB ¶
GenerateTestDataMB creates a byte slice of the exact size requested in MB. A wrapper around GenerateTestDataKB for convenience.
Types ¶
type TestNode ¶
type TestNode struct {
// contains filtered or unexported fields
}
TestNode represents a test node with its configuration and instance.
func (*TestNode) IsSequencer ¶
func (*TestNode) IsValidator ¶
func (*TestNode) RequiresDKG ¶
func (*TestNode) SendAndReceiveMessage ¶
func (t *TestNode) SendAndReceiveMessage(targetNode *TestNode, transportType types.TransportType, handlerType types.HandlerType, data []byte, timeout time.Duration) ([]byte, error)
SendAndReceiveMessage sends a message to another node and waits for a response. This implementation uses the client package's ResponseHandler for asynchronous but reliable large payload handling.
func (*TestNode) SendMessage ¶
func (t *TestNode) SendMessage(targetNode *TestNode, transportType types.TransportType, handlerType types.HandlerType, data []byte) error
SendMessage sends a message to the target node and returns an error if the send fails.
func (*TestNode) State ¶
func (t *TestNode) State() *state.StateManager
type TestNodes ¶
type TestNodes []*TestNode
func InitializeTestNodes ¶
func InitializeTestNodes( t *testing.T, ctx context.Context, logLevel zapcore.Level, signerType types.SignerType, nodeRoles []types.Role, basePort int, transportTypes ...types.TransportType, ) (TestNodes, error)
InitializeTestNodes initializes 'count' number of nodes for testing. Each node is assigned a unique port starting from 'basePort'. DIDs are created with persistence disabled (non-persistent keys).