sensor

package
v0.0.0-...-9159377 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Intentionally duplicating values here since to make sure a refactoing
	// of the paths on the sensor side won't be unnoticed.
	CommandsFileName  = "commands.json"
	SensorLogFileName = "sensor.log"
	MondelFileName    = "mondel.ndjson"
	AppStdoutFileName = "app_stdout.log"
	AppStderrFileName = "app_stderr.log"
	EventsFileName    = "events.json"
)

Variables

This section is empty.

Functions

func NewMonitorStartCommand

func NewMonitorStartCommand(opts ...StartMonitorOpt) command.StartMonitor

func WithEnableMondel

func WithEnableMondel() sensorOpt

func WithSensorArtifactsDir

func WithSensorArtifactsDir(dir string) sensorOpt

func WithSensorCapabilities

func WithSensorCapabilities(caps ...string) sensorOpt

func WithSensorLifecycleHook

func WithSensorLifecycleHook(cmd string) sensorOpt

func WithSensorLogsToFile

func WithSensorLogsToFile() sensorOpt

func WithStopSignal

func WithStopSignal(sig syscall.Signal) sensorOpt

func WithoutSensorCapabilities

func WithoutSensorCapabilities(caps ...string) sensorOpt

Types

type Sensor

type Sensor struct {
	// contains filtered or unexported fields
}

func NewSensor

func NewSensor(
	ctx context.Context,
	contextDirPath string,
	contName string,
	imageName string,
	opts ...sensorOpt,
) (*Sensor, error)

func NewSensorOrFail

func NewSensorOrFail(
	t *testing.T,
	ctx context.Context,
	contextDirPath string,
	contName string,
	imageName string,
	opts ...sensorOpt,
) *Sensor

func (*Sensor) AssertArtifactsArchiveContains

func (s *Sensor) AssertArtifactsArchiveContains(
	t *testing.T,
	ctx context.Context,
	filename ...string,
)

func (*Sensor) AssertMondelIncludesFiles

func (s *Sensor) AssertMondelIncludesFiles(t *testing.T, filepath ...string)

func (*Sensor) AssertMondelNotIncludesFiles

func (s *Sensor) AssertMondelNotIncludesFiles(t *testing.T, filepath ...string)

func (*Sensor) AssertReportAndMondelFileListsMatch

func (s *Sensor) AssertReportAndMondelFileListsMatch(t *testing.T)

func (*Sensor) AssertReportIncludesFiles

func (s *Sensor) AssertReportIncludesFiles(t *testing.T, filepath ...string)

func (*Sensor) AssertReportNotIncludesFiles

func (s *Sensor) AssertReportNotIncludesFiles(t *testing.T, filepath ...string)

func (*Sensor) AssertSensorEventsFileContains

func (s *Sensor) AssertSensorEventsFileContains(
	t *testing.T,
	ctx context.Context,
	expected ...event.Type,
)

Checks the presense of the expected events AND the occurrence order.

func (*Sensor) AssertSensorLogsContain

func (s *Sensor) AssertSensorLogsContain(t *testing.T, ctx context.Context, what ...string)

func (*Sensor) AssertTargetAppLogsContain

func (s *Sensor) AssertTargetAppLogsContain(t *testing.T, ctx context.Context, what ...string)

func (*Sensor) AssertTargetAppLogsEqualTo

func (s *Sensor) AssertTargetAppLogsEqualTo(t *testing.T, ctx context.Context, what string)

func (*Sensor) AssertTargetAppStderrFileEqualsTo

func (s *Sensor) AssertTargetAppStderrFileEqualsTo(t *testing.T, ctx context.Context, expected string)

func (*Sensor) AssertTargetAppStdoutFileEqualsTo

func (s *Sensor) AssertTargetAppStdoutFileEqualsTo(t *testing.T, ctx context.Context, expected string)

func (*Sensor) Cleanup

func (s *Sensor) Cleanup(t *testing.T, ctx context.Context)

func (*Sensor) ContainerLogs

func (s *Sensor) ContainerLogs(ctx context.Context) (string, error)

func (*Sensor) ContainerLogsOrFail

func (s *Sensor) ContainerLogsOrFail(t *testing.T, ctx context.Context) string

func (*Sensor) DownloadArtifacts

func (s *Sensor) DownloadArtifacts(ctx context.Context) error

func (*Sensor) DownloadArtifactsOrFail

func (s *Sensor) DownloadArtifactsOrFail(t *testing.T, ctx context.Context)

func (*Sensor) ExecuteControlCommand

func (s *Sensor) ExecuteControlCommand(ctx context.Context, cmd control.Command) error

func (*Sensor) ExecuteControlCommandOrFail

func (s *Sensor) ExecuteControlCommandOrFail(t *testing.T, ctx context.Context, cmd control.Command)

func (*Sensor) ExpectEvent

func (s *Sensor) ExpectEvent(t *testing.T, name event.Type)

func (*Sensor) PrintState

func (s *Sensor) PrintState(ctx context.Context)

func (*Sensor) SendCommand

func (s *Sensor) SendCommand(ctx context.Context, cmd command.Message) error

func (*Sensor) SendStartCommand

func (s *Sensor) SendStartCommand(
	ctx context.Context,
	cmdOverride ...command.StartMonitor,
) error

func (*Sensor) SendStartCommandOrFail

func (s *Sensor) SendStartCommandOrFail(
	t *testing.T,
	ctx context.Context,
	cmdOverride ...command.StartMonitor,
)

func (*Sensor) SendStopCommand

func (s *Sensor) SendStopCommand(ctx context.Context) error

func (*Sensor) SendStopCommandOrFail

func (s *Sensor) SendStopCommandOrFail(t *testing.T, ctx context.Context)

func (*Sensor) SensorLogs

func (s *Sensor) SensorLogs(ctx context.Context) (string, error)

func (*Sensor) SensorLogsOrFail

func (s *Sensor) SensorLogsOrFail(t *testing.T, ctx context.Context) string

func (*Sensor) Shutdown

func (s *Sensor) Shutdown(ctx context.Context) error

func (*Sensor) ShutdownOrFail

func (s *Sensor) ShutdownOrFail(t *testing.T, ctx context.Context)

func (*Sensor) Signal

func (s *Sensor) Signal(ctx context.Context, sig syscall.Signal) error

func (*Sensor) SignalOrFail

func (s *Sensor) SignalOrFail(t *testing.T, ctx context.Context, sig syscall.Signal)

func (*Sensor) StartControlled

func (s *Sensor) StartControlled(ctx context.Context) error

func (*Sensor) StartControlledOrFail

func (s *Sensor) StartControlledOrFail(t *testing.T, ctx context.Context)

func (*Sensor) StartStandalone

func (s *Sensor) StartStandalone(
	ctx context.Context,
	runArgs []string,
	cmdOverride ...command.StartMonitor,
) error

func (*Sensor) StartStandaloneOrFail

func (s *Sensor) StartStandaloneOrFail(
	t *testing.T,
	ctx context.Context,
	runArgs []string,
	cmdOverride ...command.StartMonitor,
)

func (*Sensor) Wait

func (s *Sensor) Wait(ctx context.Context) (int, error)

func (*Sensor) WaitForEvent

func (s *Sensor) WaitForEvent(ctx context.Context, evt event.Type) error

func (*Sensor) WaitForEventOrFail

func (s *Sensor) WaitForEventOrFail(t *testing.T, ctx context.Context, evt event.Type)

func (*Sensor) WaitOrFail

func (s *Sensor) WaitOrFail(t *testing.T, ctx context.Context) int

type StartMonitorOpt

type StartMonitorOpt func(*command.StartMonitor)

func WithAppNameArgs

func WithAppNameArgs(name string, arg ...string) StartMonitorOpt

func WithAppStderrToFile

func WithAppStderrToFile() StartMonitorOpt

func WithAppStdoutToFile

func WithAppStdoutToFile() StartMonitorOpt

func WithAppUser

func WithAppUser(user string) StartMonitorOpt

func WithPreserves

func WithPreserves(path ...string) StartMonitorOpt

func WithSaneDefaults

func WithSaneDefaults() StartMonitorOpt

Jump to

Keyboard shortcuts

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