test

package
v3.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package test contains support code for various mangos tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTLSConfig

func GetTLSConfig(server bool) (*tls.Config, error)

GetTLSConfig is like NewTLSConfig, but it caches to avoid regenerating key material pointlessly.

func MustBeFalse

func MustBeFalse(t *testing.T, b bool)

MustBeFalse verifies that the condition is true.

func MustBeNil

func MustBeNil(t *testing.T, v interface{})

MustBeNil verifies that the provided value is nil

func MustBeTrue

func MustBeTrue(t *testing.T, b bool)

MustBeTrue verifies that the condition is true.

func MustFail

func MustFail(t *testing.T, e error)

MustFail verifies that the error is not nil. If it is nil, the test is a fatal failure.

func MustNotBeNil

func MustNotBeNil(t *testing.T, v interface{})

MustNotBeNil verifies that the provided value is not nil

func MustSucceed

func MustSucceed(t *testing.T, e error)

MustSucceed verifies that that the supplied error is nil. If it is not nil, we call t.Fatalf() to fail the test immediately.

func NewTLSConfig

func NewTLSConfig(server bool) (*tls.Config, error)

NewTLSConfig creates a suitable TLS configuration, using either a server or client. A self-signed CA Cert is included.

Types

type TranTest

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

TranTest provides a common test structure for transports, so that they can implement a battery of standard tests.

func NewTranTest

func NewTranTest(tran mangos.Transport, addr string) *TranTest

NewTranTest creates a TranTest.

func (*TranTest) TestAll

func (tt *TranTest) TestAll(t *testing.T)

TestAll runs a full battery of standard tests on the transport.

func (*TranTest) TestConnRefused

func (tt *TranTest) TestConnRefused(t *testing.T)

TestConnRefused tests that attempts to dial to an address without a listener properly fail with EConnRefused.

func (*TranTest) TestDialerBadScheme

func (tt *TranTest) TestDialerBadScheme(t *testing.T)

TestDialerBadScheme tests to makes sure that giving a bogus scheme to create a dialer fails properly.

func (*TranTest) TestDialerGetOptionInvalid

func (tt *TranTest) TestDialerGetOptionInvalid(t *testing.T)

TestDialerGetOptionInvalid tests attempting to get an invalid option on a Dialer.

func (*TranTest) TestDialerSetOptionInvalid

func (tt *TranTest) TestDialerSetOptionInvalid(t *testing.T)

TestDialerSetOptionInvalid tests trying to set an invalid option on a Dialer.

func (*TranTest) TestDuplicateListen

func (tt *TranTest) TestDuplicateListen(t *testing.T)

TestDuplicateListen checks to make sure that an attempt to listen on a second socket, when another listener is already present, properly fails with ErrAddrInUse.

func (*TranTest) TestListenAndAccept

func (tt *TranTest) TestListenAndAccept(t *testing.T)

TestListenAndAccept tests that we can both listen and accept connections for the given transport.

func (*TranTest) TestListenerBadScheme

func (tt *TranTest) TestListenerBadScheme(t *testing.T)

TestListenerBadScheme tests to makes sure that giving a bogus scheme to create a listener fails properly.

func (*TranTest) TestListenerGetOptionInvalid

func (tt *TranTest) TestListenerGetOptionInvalid(t *testing.T)

TestListenerGetOptionInvalid tests trying to get an invalid option on a listener.

func (*TranTest) TestListenerSetOptionInvalid

func (tt *TranTest) TestListenerSetOptionInvalid(t *testing.T)

TestListenerSetOptionInvalid tests passing invalid options to a listener.

func (*TranTest) TestScheme

func (tt *TranTest) TestScheme(t *testing.T)

TestScheme tests the Scheme() entry point on the transport.

func (*TranTest) TestSendRecv

func (tt *TranTest) TestSendRecv(t *testing.T)

TestSendRecv test that the transport can send and receive. It uses the REQ/REP protocol for messages.

Jump to

Keyboard shortcuts

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