test

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package test contains a collection of test helpers.

Index

Constants

This section is empty.

Variables

View Source
var TestLogger = logging.Logger("test")

TestLogger can be used in tests to generate events.

Functions

func GenerateMultiaddr

func GenerateMultiaddr(t *testing.T) multiaddr.Multiaddr

GenerateMultiaddr generates a valid multiaddr.

func GenerateMultiaddrs

func GenerateMultiaddrs(t *testing.T) []multiaddr.Multiaddr

GenerateMultiaddrs generates semantically valid multiaddrs.

func GenerateNetAddr added in v0.2.0

func GenerateNetAddr(t *testing.T) multiaddr.Multiaddr

GenerateNetAddr generates a valid multiaddr without the ipfs peerID part.

func GeneratePeerID

func GeneratePeerID(t *testing.T) peer.ID

GeneratePeerID generates a valid peerID.

func GeneratePeerMultiaddr

func GeneratePeerMultiaddr(t *testing.T, peerID peer.ID) multiaddr.Multiaddr

GeneratePeerMultiaddr generates a semantically valid multiaddr for the given peer.

func GeneratePeerMultiaddrs

func GeneratePeerMultiaddrs(t *testing.T, peerID peer.ID) []multiaddr.Multiaddr

GeneratePeerMultiaddrs generates semantically valid multiaddrs for the given peer.

func GeneratePrivateKey

func GeneratePrivateKey(t *testing.T) crypto.PrivKey

GeneratePrivateKey generates a valid private key.

func GetPeerIDFromKey

func GetPeerIDFromKey(t *testing.T, sk crypto.PrivKey) peer.ID

GetPeerIDFromKey returns the peer ID associated to a key.

func NewEvent

func NewEvent() *logging.EventInProgress

NewEvent creates a new empty event.

func NewSpan

func NewSpan() *monitoring.Span

NewSpan creates a new empty span.

func WaitUntil

func WaitUntil(t *testing.T, duration time.Duration, interval time.Duration, cond func() error, message string)

WaitUntil waits for duration for the condition function not to return an error to return or fails after the delay has elapsed.

func WaitUntilConnected

func WaitUntilConnected(t *testing.T, host ihost.Host, peerID peer.ID)

WaitUntilConnected waits until the given host is connected to the given peer.

func WaitUntilDisconnected

func WaitUntilDisconnected(t *testing.T, host ihost.Host, peerID peer.ID)

WaitUntilDisconnected waits until the given host is disconnected from the given peer.

func WaitUntilStreamClosed

func WaitUntilStreamClosed(t *testing.T, stream inet.Stream)

WaitUntilStreamClosed waits until a stream is closed by the other party.

Types

type Stream

type Stream struct {
	inet.Stream
	// contains filtered or unexported fields
}

Stream wraps an existing stream to provide additional testing information.

func WrapStream

func WrapStream(stream inet.Stream) *Stream

WrapStream wraps an existing stream to provide additional testing information.

func (*Stream) Close

func (s *Stream) Close() error

Close closes the stream and notifies a channel.

func (*Stream) CloseChan

func (s *Stream) CloseChan() <-chan struct{}

CloseChan returns the channel used to notify of close events.

func (*Stream) Reset

func (s *Stream) Reset() error

Reset resets the stream and notifies a channel.

func (*Stream) ResetChan

func (s *Stream) ResetChan() <-chan struct{}

ResetChan returns the channel used to notify of reset events.

Directories

Path Synopsis
Package benchmark defines integration benchmarks for Stratumn Node.
Package benchmark defines integration benchmarks for Stratumn Node.
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
Package session defines types for doing system tests.
Package session defines types for doing system tests.
Package system defines system tests for Stratumn Node.
Package system defines system tests for Stratumn Node.

Jump to

Keyboard shortcuts

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