Documentation
¶
Index ¶
- Constants
- Variables
- func FactoryTest(ctx Context, t *testing.T, factory service.Factory, spec FactorySpec)
- type FactorySpec
- type InstanceSpec
- type InstanceTester
- func (inst *InstanceTester) Handle(ctx Context, t *testing.T, p packet.Buf) packet.Buf
- func (inst *InstanceTester) Receive(ctx Context, t *testing.T) packet.Buf
- func (inst *InstanceTester) Shutdown(ctx Context, t *testing.T)
- func (inst *InstanceTester) Suspend(ctx Context, t *testing.T) []byte
- func (inst *InstanceTester) ValidateSentPacket(t *testing.T, thunk packet.Thunk) packet.Buf
Constants ¶
View Source
const Code = packet.Code(123)
Variables ¶
View Source
var MaxSendSize int
MaxSendSize overrides the maximum size of packets sent by service. Normally it is randomized and logged when creating an instance tester (but remember that Go caches test results). This variable can be set when debugging a test failure which might be caused by a particular value.
Don't override this permanently; all service implementations must work with arbitrarily large MaxSendSize setting.
Functions ¶
func FactoryTest ¶
func FactoryTest(ctx Context, t *testing.T, factory service.Factory, spec FactorySpec)
Types ¶
type FactorySpec ¶
type InstanceSpec ¶
type InstanceSpec struct {
Snapshot []byte
}
type InstanceTester ¶
type InstanceTester struct {
Instance service.Instance
Sent chan packet.Thunk // From service to program.
// contains filtered or unexported fields
}
func NewInstanceTester ¶
func NewInstanceTester(ctx Context, t *testing.T, factory service.Factory, spec InstanceSpec) *InstanceTester
func (*InstanceTester) Receive ¶
func (inst *InstanceTester) Receive(ctx Context, t *testing.T) packet.Buf
Receive an item from the Sent channel.
func (*InstanceTester) Shutdown ¶
func (inst *InstanceTester) Shutdown(ctx Context, t *testing.T)
Shutdown without suspension.
func (*InstanceTester) Suspend ¶
func (inst *InstanceTester) Suspend(ctx Context, t *testing.T) []byte
Suspend calls Shutdown, expecting a snapshot.
func (*InstanceTester) ValidateSentPacket ¶
ValidateSentPacket thunk that was received from the Sent channel.
Click to show internal directories.
Click to hide internal directories.