Documentation ¶
Overview ¶
Package sertesting contains utilities useful for testing the fleetspeak server and server components.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetClientCacheMaxAge ¶
SetClientCacheMaxAge adjusts the maximum age that cached client data is considered valid for. This can be used to make tests run faster.
func SetClientRetryTime ¶
SetClientRetryTime changes db.ClientRetryTime method used by datastores to decide when to retry requests to clients. It returns a closure which returns the system to the previous state.
This function and the returned closure are not thread safe. In particular, they should be called at the start and end of tests when no Fleetspeak component is started.
func SetServerRetryTime ¶
SetServerRetryTime changes the db.ServerRetryTime used by the Fleetspeak server to decide when to retry requests to clients. It returns a closure which returns the system to the previous state.
This function and the returned closure are not thread safe. In particular, they should be called at the start and end of tests when no Fleetspeak component is started.
Types ¶
type FakeContext ¶
type FakeContext struct { SentMessages chan *fspb.Message ClientData map[common.ClientID]*db.ClientData }
A FakeContext is a fake service.Context, suitable for unit testing services.
func (*FakeContext) GetClientData ¶
func (c *FakeContext) GetClientData(_ context.Context, id common.ClientID) (*db.ClientData, error)
type FakeTime ¶
type FakeTime struct {
// contains filtered or unexported fields
}
FakeTime represents a fake time which can control the time seen by the fleetspeak system during unit tests.
func FakeNow ¶
FakeNow changes the implementation of Now used by the fleetspeak system. It returns a FakeTime which controls the time that the system sees until Revert is called.
Note that this function, and FakeTime.Revert are not thread safe. In particular it they should be called at the start and end of tests when no Fleetspeak component is started.
func (*FakeTime) AddSeconds ¶
AddSeconds adds s seconds to the fake time.
func (*FakeTime) Revert ¶
func (t *FakeTime) Revert()
Revert returns the time seen by the fleetspeak system to what it was previously.
func (*FakeTime) SetSeconds ¶
SetSeconds sets the current fake time to s seconds since epoch.