observertesthelper

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerCreate

func DockerCreate(tb testing.TB, args ...string) (containerId string)

DockerCreate creates a new docker container in the background. The container will be killed and removed on test cleanup. It returns the containerId on success, or an error if spawning the container failed.

func DockerExec

func DockerExec(tb testing.TB, id string, args ...string)

dockerExec executes a command in a container.

func DockerRun

func DockerRun(tb testing.TB, args ...string) (containerId string)

dockerRun starts a new docker container in the background. The container will be killed and removed on test cleanup. It returns the containerId on success, or an error if spawning the container failed.

func DockerStart

func DockerStart(tb testing.TB, id string)

DockerStart starts a new docker container with a given ID.

func ExecWGCurl

func ExecWGCurl(readyWG *sync.WaitGroup, retries uint, args ...string) error

func GetDefaultObserver

func GetDefaultObserver(tb testing.TB, ctx context.Context, lib string, opts ...TestOption) (*observer.Observer, error)

func GetDefaultObserverWithBase

func GetDefaultObserverWithBase(tb testing.TB, ctx context.Context, b *sensors.Sensor, file, lib string, opts ...TestOption) (*observer.Observer, error)

func GetDefaultObserverWithConfig

func GetDefaultObserverWithConfig(tb testing.TB, ctx context.Context, config, lib string, opts ...TestOption) (*observer.Observer, error)

func GetDefaultObserverWithFile

func GetDefaultObserverWithFile(tb testing.TB, ctx context.Context, file, lib string, opts ...TestOption) (*observer.Observer, error)

func GetDefaultObserverWithWatchers

func GetDefaultObserverWithWatchers(tb testing.TB, ctx context.Context, base *sensors.Sensor, opts ...TestOption) (*observer.Observer, error)

func GetDefaultSensorsWithBase

func GetDefaultSensorsWithBase(tb testing.TB, b *sensors.Sensor, file, lib string, opts ...TestOption) ([]*sensors.Sensor, error)

func GetDefaultSensorsWithFile

func GetDefaultSensorsWithFile(tb testing.TB, file, lib string, opts ...TestOption) ([]*sensors.Sensor, error)

func GetMyPid

func GetMyPid() uint32

func LoopEvents

func LoopEvents(ctx context.Context, tb testing.TB, doneWG, readyWG *sync.WaitGroup, obs *observer.Observer)

func WaitForProcess

func WaitForProcess(process string) error

Used to wait for a process to start, we do a lookup on PROCFS because this may be called before obs is created.

func WriteConfigFile

func WriteConfigFile(fileName, config string) error

Types

type TestOption

type TestOption func(*TestOptions)

func WithAllowList

func WithAllowList(allowList *tetragon.Filter) TestOption

func WithConfig

func WithConfig(config string) TestOption

func WithContainerId

func WithContainerId(id string) TestOption

Filter for a container id by prefix in event export

func WithDenyList

func WithDenyList(denyList *tetragon.Filter) TestOption

func WithLib

func WithLib(lib string) TestOption

func WithMyPid

func WithMyPid() TestOption

Filter for the gotest process and its children in the export

func WithProcCacheGCInterval

func WithProcCacheGCInterval(GCInterval time.Duration) TestOption

type TestOptions

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

Jump to

Keyboard shortcuts

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