Skip to content

Commit 8fc16a5

Browse files
committed
fix(tests): update e2e-kernel-test to work with detectors
- Update test validation to search for detector event names instead of signatureID field (which doesn't exist in detector output) - Add detector ID to event name mapping for all tested detectors
1 parent 73ada53 commit 8fc16a5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/e2e-kernel-test.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ outputfile="${SCRIPT_TMP_DIR}/tracee-output-$$"
7676
tracee_command="./dist/tracee \
7777
--runtime workdir=$TRACEE_TMP_DIR \
7878
--output json:$outputfile \
79+
--output option:exec-env \
7980
--logging file=$logfile \
8081
--policy ./tests/policies/kernel/kernel.yaml 2>&1 \
8182
| tee $SCRIPT_TMP_DIR/build-$$"
@@ -151,9 +152,27 @@ kill -SIGKILL "${tracee_pids[@]}" >/dev/null 2>&1
151152

152153
info "= CHECKING TESTS RESULTS ======================================"
153154
info
155+
156+
# Map detector IDs to event names (detectors produce events with "name" field, not "signatureID")
157+
declare -A detector_to_event=(
158+
["TRC-102"]="anti_debugging"
159+
["TRC-103"]="ptrace_code_injection"
160+
["TRC-104"]="dynamic_code_loading"
161+
["TRC-105"]="fileless_execution"
162+
["TRC-107"]="ld_preload"
163+
["TRC-1010"]="cgroup_release_agent"
164+
["TRC-1014"]="disk_mount"
165+
["TRC-1016"]="illegitimate_shell"
166+
["TRC-1018"]="k8s_cert_theft"
167+
["TRC-1022"]="dropped_executable"
168+
)
169+
154170
for TEST in $TESTS; do
155171
found=0
156-
cat $outputfile | grep "\"signatureID\":\"$TEST\"" -B2 && found=1
172+
EVENT_NAME="${detector_to_event[$TEST]}"
173+
if [[ -n "$EVENT_NAME" ]]; then
174+
cat $outputfile | grep "\"name\":\"$EVENT_NAME\"" -B2 && found=1
175+
fi
157176
info
158177
if [[ $found -eq 1 ]]; then
159178
info "$TEST: SUCCESS"

0 commit comments

Comments
 (0)