Merge pull request #15633 from thediveo/events

Closes #15617: emit container labels for container exited and exec died events
This commit is contained in:
OpenShift Merge Robot
2022-09-07 10:39:38 +02:00
committed by GitHub
2 changed files with 31 additions and 0 deletions

View File

@@ -194,3 +194,22 @@ EOF
is "$(wc -l <$eventsFile)" "$(wc -l <<<$output)" "all events are returned"
is "${lines[-2]}" ".* log-rotation $eventsFile"
}
# Prior to #15633, container labels would not appear in 'die' log events
@test "events - labels included in container die" {
skip_if_remote "remote does not support --events-backend"
local cname=c$(random_string 15)
local lname=l$(random_string 10)
local lvalue="v$(random_string 10) $(random_string 5)"
run_podman 17 --events-backend=file run --rm \
--name=$cname \
--label=$lname="$lvalue" \
$IMAGE sh -c 'exit 17'
run_podman --events-backend=file events \
--filter=container=$cname \
--filter=status=died \
--stream=false \
--format="{{.Attributes.$lname}}"
assert "$output" = "$lvalue" "podman-events output includes container label"
}