clitesting

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package clitesting contains utilities useful for testing clients and client components.

Index

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL