mirror of
https://github.com/containers/podman.git
synced 2025-08-14 02:41:34 +08:00
CI: sys: quadlet %T test: do not rely on journal
Some people might expect this to work: systemctl --wait start foo journalctl -u foo ---> displays output from foo Well, it does not. Not reliably, anyway: https://github.com/systemd/systemd/issues/28650 Shrug, okay, deal with it: write value of %T to a tmpfile instead of relying on journal. I tested with TMPDIR=<many values> on an SELinux system and, by golly, it works fine. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -784,6 +784,7 @@ EOF
|
||||
#
|
||||
# Step 1: determine what systemd is using for %T. There does not
|
||||
# seem to be any systemctly way to find this.
|
||||
percent_t_file="${PODMAN_TMPDIR}/foo"
|
||||
local service=get-percent-t.$(random_string 10).service
|
||||
local unitfile=${UNIT_DIR}/$service
|
||||
cat >$unitfile <<EOF
|
||||
@ -791,15 +792,12 @@ EOF
|
||||
Description=Get the value of percent T
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/bash -c "echo --==%T==--"
|
||||
ExecStart=/bin/bash -c "echo %T >$percent_t_file"
|
||||
Type=oneshot
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
systemctl --wait start $service
|
||||
echo "$_LOG_PROMPT journalctl -u $service"
|
||||
run journalctl -u $service
|
||||
echo "$output"
|
||||
assert "$output" =~ " --==.*==--" "get-percent-T unit ran to completion"
|
||||
percent_t=$(expr "$output" : ".* --==\(.*\)==--")
|
||||
percent_t=$(< $percent_t_file)
|
||||
# Clean up. Don't bother to systemctl-reload, service_setup does that below.
|
||||
rm -f $unitfile
|
||||
|
||||
|
Reference in New Issue
Block a user