tests

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 33 Imported by: 1

Documentation

Overview

Contains resources or utils for test units

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHost added in v0.9.0

func CreateHost(t *testing.T, opts ...config.Option) (host.Host, int, *ecdsa.PrivateKey)

func CreateWakuMessage

func CreateWakuMessage(contentTopic string, timestamp *int64, optionalPayload ...string) *pb.WakuMessage

CreateWakuMessage creates a WakuMessage protobuffer with default values and a custom contenttopic and timestamp

func ExtractIP added in v0.9.0

func ExtractIP(addr multiaddr.Multiaddr) (*net.TCPAddr, error)

func FindFreePort

func FindFreePort(t *testing.T, host string, maxAttempts int) (int, error)

FindFreePort returns an available port number

func FindFreeUDPPort added in v0.4.0

func FindFreeUDPPort(t *testing.T, host string, maxAttempts int) (int, error)

FindFreePort returns an available port number

func GenerateRandomASCIIString added in v0.9.0

func GenerateRandomASCIIString(minLength int, maxLength int) (string, error)

func GenerateRandomBase64String added in v0.9.0

func GenerateRandomBase64String(length int) (string, error)

func GenerateRandomJSONString added in v0.9.0

func GenerateRandomJSONString() (string, error)

func GenerateRandomSQLInsert added in v0.9.0

func GenerateRandomSQLInsert() (string, error)

func GenerateRandomURLEncodedString added in v0.9.0

func GenerateRandomURLEncodedString(length int) (string, error)

func GenerateRandomUTF8String added in v0.9.0

func GenerateRandomUTF8String(minLength int, maxLength int, withUncommon bool) (string, error)

func GetHostAddress

func GetHostAddress(ha host.Host) multiaddr.Multiaddr

GetHostAddress returns the first listen address used by a host

func MakeHost

func MakeHost(ctx context.Context, port int, randomness io.Reader) (host.Host, error)

MakeHost creates a Libp2p host with a random key on a specific port

func NewLocalnode added in v0.9.0

func NewLocalnode(priv *ecdsa.PrivateKey, ipAddr *net.TCPAddr, udpPort int, wakuFlags wenr.WakuEnrBitfield, advertiseAddr *net.IP, log *zap.Logger) (*enode.LocalNode, error)

func RandomBytes added in v0.9.0

func RandomBytes(n int) ([]byte, error)

func RandomHex

func RandomHex(n int) (string, error)

RandomHex returns a random hex string of n bytes

func RandomInt added in v0.9.0

func RandomInt(min, max int) (int, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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