Documentation
¶
Overview ¶
Package testsystem implements a bigmachine system that's useful for testing. Unlike other system implementations, testsystem.System does not spawn new processes: instead, machines are launched inside of the same process.
Index ¶
- type System
- func (s *System) B() *bigmachine.B
- func (*System) Event(_ string, _ ...interface{})
- func (s *System) Exit(int)
- func (s *System) Exited() bool
- func (s *System) HTTPClient() *http.Client
- func (s *System) Index(i int) *bigmachine.Machine
- func (s *System) Init(b *bigmachine.B) error
- func (s *System) KeepaliveConfig() (period, timeout, rpcTimeout time.Duration)
- func (s *System) Kill(m *bigmachine.Machine) bool
- func (s *System) ListenAndServe(addr string, handler http.Handler) error
- func (s *System) Main() error
- func (s *System) Maxprocs() int
- func (s *System) N() int
- func (s *System) Name() string
- func (s *System) Read(ctx context.Context, m *bigmachine.Machine, filename string) (io.Reader, error)
- func (s *System) Shutdown()
- func (s *System) Start(_ context.Context, count int) ([]*bigmachine.Machine, error)
- func (s *System) Tail(ctx context.Context, m *bigmachine.Machine) (io.Reader, error)
- func (s *System) Wait(n int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type System ¶
type System struct { // Machineprocs is the number of procs per machine. Machineprocs int // The following can optionally be specified to customize the behavior // of Bigmachine's keepalive mechanism. KeepalivePeriod, KeepaliveTimeout, KeepaliveRpcTimeout time.Duration // contains filtered or unexported fields }
System implements a bigmachine System for testing. Systems should be instantiated with New().
func (*System) B ¶
func (s *System) B() *bigmachine.B
B returns the bigmachine session associated with this system.
func (*System) Event ¶ added in v0.5.6
Event is a no-op for the test system, as we do not care about event logs in tests.
func (*System) HTTPClient ¶
HTTPClient returns an http.Client that can converse with servers created by this test system.
func (*System) Index ¶
func (s *System) Index(i int) *bigmachine.Machine
Index returns the i'th bigmachine in the system. Index panics if the index is out of range.
func (*System) KeepaliveConfig ¶
func (*System) Kill ¶
func (s *System) Kill(m *bigmachine.Machine) bool
Kill kills the machine m that is under management of this system, returning true if successful. If m is nil, a random machine is chosen.
func (*System) ListenAndServe ¶
ListenAndServe panics. It should not be called, provided a correct bigmachine implementation.
func (*System) Main ¶
Main panics. It should not be called, provided a correct bigmachine implementation.
func (*System) Shutdown ¶
func (s *System) Shutdown()
Shutdown tears down temporary resources allocated by this System.
func (*System) Start ¶
Start starts and returns a new Machine. Each new machine is provided with a supervisor. The only difference between the behavior of a supervisor of a test machine and a regular machine is that the test machine supervisor does not exec the process, as this would break testing.