test

package
v1.1.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright Authors of Tetragon

Index

Constants

This section is empty.

Variables

View Source
var (
	CgroupMkdir = program.Builder(
		"bpf_cgroup_mkdir.o",
		"cgroup/cgroup_mkdir",
		"raw_tracepoint/cgroup_mkdir",
		"tg_tp_cgrp_mkdir",
		"raw_tracepoint",
	)

	CgroupRmdir = program.Builder(
		"bpf_cgroup_rmdir.o",
		"cgroup/cgroup_rmdir",
		"raw_tracepoint/cgroup_rmdir",
		"tg_tp_cgrp_rmdir",
		"raw_tracepoint",
	)

	CgroupRelease = program.Builder(
		"bpf_cgroup_release.o",
		"cgroup/cgroup_release",
		"raw_tracepoint/cgroup_release",
		"tg_tp_cgrp_release",
		"raw_tracepoint",
	)

	/* Cgroup tracking maps */
	CgroupsTrackingMap    = program.MapBuilder("tg_cgrps_tracking_map", CgroupMkdir)
	CgroupsTrackingMapV53 = program.MapBuilder("tg_cgrps_tracking_map", CgroupMkdir)
)
View Source
var (

	// BogusFd is the fd value required to trigger the lseek test probe
	BogusFd = -1
	// BogusWhenceVal is the whence value required to trigger the lseek test probe
	BogusWhenceVal = 4729
)

Functions

func AddTest

func AddTest()

func GetCgroupSensor added in v0.8.4

func GetCgroupSensor() *sensors.Sensor

GetCgroupSensor returns the Cgroups base sensor

func GetCgroupsTrackingMap added in v0.8.4

func GetCgroupsTrackingMap() *program.Map

func GetTestSensor

func GetTestSensor() *sensors.Sensor

GetTestSensor creates a new test sensor.

func TestCheckerMarkEnd

func TestCheckerMarkEnd(t *testing.T)

TestCheckerMarkEnd executes the necessary operations to mark the end of event stream on all CPUs

Types

type CompletionChecker added in v0.8.3

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

func NewCompletionChecker added in v0.8.3

func NewCompletionChecker() *CompletionChecker

func (*CompletionChecker) Done added in v0.8.3

func (cc *CompletionChecker) Done() bool

func (*CompletionChecker) Reset added in v0.8.3

func (cc *CompletionChecker) Reset()

func (*CompletionChecker) Update added in v0.8.3

func (cc *CompletionChecker) Update(cpu uint64)

type TestEventChecker added in v0.8.3

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

TestEventChecker is a checker that relies on:

  • the test sensor being loaded
  • user-space executing hooks that trigger the test sensor on all cores (see contrib/tester-progs/trigger-test-events).

The typical structure of a test is:

  1. start observer
  2. do some things on user-space
  3. check that we get the expected events from tetragon

In such a test there is no way to determine when to stop looking for events. Hence, we retry step 3 a number of times to gain confidence that all events from step 2 have been processed. These retries induce a significant time cost in failing tests or in tests that check the absence of events (e.g., when doing filtering).

TestEventChecker enables testing without timeouts. Timeouts are still used for robustness, but assuming TestEventChecker works correctly they are not needed.

After step 2, we trigger the hook of the test sensor (a simple sensor that generates test events) on all CPUs. Once we have seen all the test events (on all CPUs), then we know that if we expect any events, they are not there because events cannot be reordered on the same CPU.

func NewTestChecker

func NewTestChecker(c ec.MultiEventChecker) *TestEventChecker

func (*TestEventChecker) FinalCheck added in v0.8.3

func (tc *TestEventChecker) FinalCheck(l *logrus.Logger) error

func (*TestEventChecker) NextEventCheck added in v0.8.3

func (tc *TestEventChecker) NextEventCheck(ev ec.Event, l *logrus.Logger) (bool, error)

Jump to

Keyboard shortcuts

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