Documentation ¶
Index ¶
- Variables
- func CheckSensorLoad(sensors []*sensors.Sensor, sensorMaps []SensorMap, sensorProgs []SensorProg, ...)
- func LoadSensor(t *testing.T, sensor *sensors.Sensor)
- func TestSensorsRun(m *testing.M, sensorName string) int
- func TetragonBpfPath() string
- type Config
- type SensorMap
- type SensorProg
- type TestSensorManager
- func (tsm *TestSensorManager) AddAndEnableSensor(ctx context.Context, t *testing.T, sensor *sensors.Sensor, sensorName string)
- func (tsm *TestSensorManager) AddAndEnableSensors(ctx context.Context, t *testing.T, targets []*sensors.Sensor)
- func (tsm *TestSensorManager) DisableSensors(ctx context.Context, t *testing.T, targets []*sensors.Sensor)
- func (tsm *TestSensorManager) EnableSensors(ctx context.Context, t *testing.T, targets []*sensors.Sensor)
Constants ¶
This section is empty.
Variables ¶
var ConfigDefaults = Config{ TetragonLib: filepath.Join(TetragonBpfPath(), "objs"), SelfBinary: filepath.Base(os.Args[0]), CmdWaitTime: 60000 * time.Millisecond, DisableTetragonLogs: false, Debug: false, Trace: false, }
Functions ¶
func CheckSensorLoad ¶
func LoadSensor ¶
LoadSensor is a helper for loading a sensor in tests
Types ¶
type Config ¶
type Config struct { TetragonLib string SelfBinary string CmdWaitTime time.Duration DisableTetragonLogs bool Debug bool Trace bool }
Conf is configuration for testing sensors. It is intialized in TestSensorsRun() so all sensors test should call this function in their TestMain
type SensorProg ¶
type SensorProg struct { Name string Type ebpf.ProgramType NotIn bool }
type TestSensorManager ¶
TestSensorManager sensor manager used in tests
func GetTestSensorManager ¶ added in v1.0.0
func GetTestSensorManager(ctx context.Context, t *testing.T) *TestSensorManager
GetTestSensorManager returns a new test sensor manager. Some tests require an observer running, some do not. To support both, the function checks if a sensor manager has already been setup in the observer, and uses it if so. Otherwise, it creates a new one. If it creates a new one it will use the test name to create a unqique directory for maps/etc, and will also register the necessary cleanup functions using t.Cleanup()
func (*TestSensorManager) AddAndEnableSensor ¶
func (tsm *TestSensorManager) AddAndEnableSensor( ctx context.Context, t *testing.T, sensor *sensors.Sensor, sensorName string, )
AddAndEnableSensor is a helper function that adds and enables a new sensor
func (*TestSensorManager) AddAndEnableSensors ¶ added in v0.9.0
func (tsm *TestSensorManager) AddAndEnableSensors( ctx context.Context, t *testing.T, targets []*sensors.Sensor, )
AddAndEnableSensor is a helper function that adds and enables a new sensor
func (*TestSensorManager) DisableSensors ¶ added in v0.8.4
func (tsm *TestSensorManager) DisableSensors( ctx context.Context, t *testing.T, targets []*sensors.Sensor, )
EnableSensors is a helper function that enables a list of sensors
func (*TestSensorManager) EnableSensors ¶ added in v0.8.4
func (tsm *TestSensorManager) EnableSensors( ctx context.Context, t *testing.T, targets []*sensors.Sensor, )
EnableSensors is a helper function that enables a list of sensors