jrpctest

package
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Unlicense Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionSend = TestDirection("send")
	DirectionRecv = TestDirection("recv")
)

Variables

View Source
var OriginalTestData = &TestData{}

Functions

func BenchExecutor

func BenchExecutor(sm ServerMaker) func(t *testing.B, c BenchContext)

func NewRouter

func NewRouter() *jmux2.Mux

func NewRouterWithMaxSize

func NewRouterWithMaxSize(size int) *jmux2.Mux

func NewServer

func NewServer() *server.Server

func RunBasicTestSuite

func RunBasicTestSuite(t *testing.T, args BasicTestSuiteArgs)

func TestExecutor

func TestExecutor(sm ServerMaker) func(t *testing.T, c TestContext)

Types

type BasicTestSuiteArgs

type BasicTestSuiteArgs struct {
	ServerMaker ServerMaker
}

type BenchContext

type BenchContext func(t *testing.B, server *server.Server, client codec.Conn)

type ClientMaker

type ClientMaker func() codec.Conn

type EchoArgs

type EchoArgs struct {
	S string
}

type EchoResult

type EchoResult struct {
	String string
	Int    int
	Args   *EchoArgs
}

type FlakeyListener

type FlakeyListener struct {
	net.Listener
	// contains filtered or unexported fields
}

flakeyListener kills accepted connections after a random timeout.

func (*FlakeyListener) Accept

func (l *FlakeyListener) Accept() (net.Conn, error)

type LargeRespService

type LargeRespService struct {
	Length int
}

largeRespService generates arbitrary-size JSON responses.

func (LargeRespService) LargeResp

func (x LargeRespService) LargeResp() string

type ServerMaker

type ServerMaker func() (*server.Server, ClientMaker, func())

type TestAction

type TestAction struct {
	Direction TestDirection
	Data      json.RawMessage
}

type TestContext

type TestContext func(t *testing.T, server *server.Server, client codec.Conn)

type TestData

type TestData struct {
	Files []*TestFile
}

func (*TestData) AddTestData

func (td *TestData) AddTestData(name string, rd io.Reader) *TestData

type TestDirection

type TestDirection string

type TestFile

type TestFile struct {
	Name   string
	Action []*TestAction
}

Jump to

Keyboard shortcuts

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