jrpctest

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 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 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 jsonrpc.Handler, client jsonrpc.Conn)

type ClientMaker

type ClientMaker func() jsonrpc.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() (jsonrpc.Handler, ClientMaker, func())

type TestAction

type TestAction struct {
	Direction TestDirection
	Data      json.RawMessage
}

type TestContext

type TestContext func(t *testing.T, server jsonrpc.Handler, client jsonrpc.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