From 5e28cbc5fcdd89fc3623fe2324d7ba7fa6117d21 Mon Sep 17 00:00:00 2001
From: Daniel J Walsh <dwalsh@redhat.com>
Date: Wed, 23 Mar 2022 14:12:07 -0400
Subject: When running systemd in a container set container_uuid

systemd expects the container_uuid environment variable be set
when it is running in a container.

Fixes: https://github.com/containers/podman/issues/13187

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
---
 test/system/250-systemd.bats | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'test')

diff --git a/test/system/250-systemd.bats b/test/system/250-systemd.bats
index 3847d9510..6c72e14e8 100644
--- a/test/system/250-systemd.bats
+++ b/test/system/250-systemd.bats
@@ -281,6 +281,13 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
     is "$output" "" "output should be empty"
 }
 
+@test "podman --systemd sets container_uuid" {
+    run_podman run --systemd=always --name test $IMAGE printenv container_uuid
+    container_uuid=$output
+    run_podman inspect test --format '{{ .ID }}'
+    is "${container_uuid}" "${output:0:32}" "UUID should be first 32 chars of Container id"
+}
+
 # https://github.com/containers/podman/issues/13153
 @test "podman rootless-netns slirp4netns process should be in different cgroup" {
     is_rootless || skip "only meaningful for rootless"
-- 
cgit v1.2.3-54-g00ecf