Skip to content

Commit

Permalink
tetragon: Adjust TestMissedProgStatsKprobeMulti test for session
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Olsa <[email protected]>
  • Loading branch information
olsajiri committed Jan 6, 2025
1 parent 03e8d4a commit 2beb244
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/sensors/tracing/kprobe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7013,14 +7013,22 @@ spec:
fmt.Printf("Failed to execute test binary: %s\n", err)
}

expected := strings.NewReader(` # HELP tetragon_missed_prog_probes_total The total number of Tetragon probe missed by program.
s := ` # HELP tetragon_missed_prog_probes_total The total number of Tetragon probe missed by program.
# TYPE tetragon_missed_prog_probes_total counter
tetragon_missed_prog_probes_total{attach="acct_process",policy="__base__"} 0
tetragon_missed_prog_probes_total{attach="kprobe_multi (2 functions)",policy="syswritefollowfdpsswd"} 1
tetragon_missed_prog_probes_total{attach="kprobe_session (2 functions)",policy="syswritefollowfdpsswd"} %d
tetragon_missed_prog_probes_total{attach="sched/sched_process_exec",policy="__base__"} 0
tetragon_missed_prog_probes_total{attach="security_bprm_committing_creds",policy="__base__"} 0
tetragon_missed_prog_probes_total{attach="wake_up_new_task",policy="__base__"} 0
`)
`

// Session programs get accounted missed counts also for return
// probe even if it's not executed.
missed := 1
if bpf.HasKprobeSession() {
missed = 2
}
expected := strings.NewReader(fmt.Sprintf(s, missed))

assert.NoError(t, testutil.GatherAndCompare(metricsconfig.GetRegistry(), expected,
prometheus.BuildFQName(consts.MetricsNamespace, "", "missed_prog_probes_total")))
Expand Down

0 comments on commit 2beb244

Please sign in to comment.