Documentation
¶
Overview ¶
Package clitesting contains utilities useful for testing clients and client components.
Index ¶
- Constants
- type FakeServiceContext
- func (sc *FakeServiceContext) GetFileIfModified(ctx context.Context, name string, modSince time.Time) (data io.ReadCloser, mod time.Time, err error)
- func (sc *FakeServiceContext) GetLocalInfo() *service.LocalInfo
- func (sc *FakeServiceContext) Send(ctx context.Context, m service.AckMessage) error
- func (sc *FakeServiceContext) Stats() stats.Collector
Constants ¶
View Source
const ( // FakeCommTimeout is how long we wait for the test to accept messages sent // through FakeServiceContext. FakeCommTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeServiceContext ¶ added in v0.1.18
type FakeServiceContext struct {
service.Context
OutChan chan *fspb.Message
StatsCollector stats.Collector
LocalInfo *service.LocalInfo
Files fstest.MapFS
}
FakeServiceContext is a fake service.Context which allows a test to run a service without a full Fleetspeak client.
func (*FakeServiceContext) GetFileIfModified ¶ added in v0.1.18
func (sc *FakeServiceContext) GetFileIfModified(ctx context.Context, name string, modSince time.Time) (data io.ReadCloser, mod time.Time, err error)
GetFileIfModified implements service.Context by looking up file contents and modification times in the assigned maps.
func (*FakeServiceContext) GetLocalInfo ¶ added in v0.1.18
func (sc *FakeServiceContext) GetLocalInfo() *service.LocalInfo
GetLocalInfo implements service.Context.
func (*FakeServiceContext) Send ¶ added in v0.1.18
func (sc *FakeServiceContext) Send(ctx context.Context, m service.AckMessage) error
Send implements service.Context by writing the message to sc.OutChan.
func (*FakeServiceContext) Stats ¶ added in v0.1.18
func (sc *FakeServiceContext) Stats() stats.Collector
Stats implements service.Context by returning the assigned stats.Collector or a NoopCollector if none was set.
Click to show internal directories.
Click to hide internal directories.