mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
TEST-04-JOURNAL: Make LogFilterPatterns= tests more robust
Let's use oneshot services as we don't need long running services for the tests we're doing. Let's also increase the sleeps a little as the current values weren't sufficient when running the test locally on my machine with mkosi.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Description=Test service for delegated logs filtering
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Type=oneshot
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload.sh
|
||||
Delegate=yes
|
||||
SyslogLevel=notice
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
Description=Log filtering unit
|
||||
|
||||
[Service]
|
||||
ExecStart=sh -c 'while true; do echo "Logging from the service, and ~more~ foo bar"; sleep .25; done'
|
||||
Type=oneshot
|
||||
ExecStart=sh -c 'echo "Logging from the service, and ~more~ foo bar" && sleep 2'
|
||||
SyslogLevel=notice
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
mkdir /sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child
|
||||
/bin/sh /usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload_child.sh &
|
||||
/bin/sh /usr/lib/systemd/tests/testdata/units/delegated_cgroup_filtering_payload_child.sh
|
||||
|
||||
while true
|
||||
do
|
||||
echo "parent_process: hello, world!"
|
||||
echo "parent_process: hello, people!"
|
||||
sleep .15
|
||||
done
|
||||
echo "parent_process: hello, world!"
|
||||
echo "parent_process: hello, people!"
|
||||
sleep .15
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
|
||||
echo $$ >/sys/fs/cgroup/system.slice/delegated-cgroup-filtering.service/the_child/cgroup.procs
|
||||
|
||||
while true
|
||||
do
|
||||
echo "child_process: hello, world!"
|
||||
echo "child_process: hello, people!"
|
||||
sleep .15
|
||||
done
|
||||
echo "child_process: hello, world!"
|
||||
echo "child_process: hello, people!"
|
||||
sleep .15
|
||||
|
||||
@@ -18,16 +18,12 @@ add_logs_filtering_override() {
|
||||
|
||||
run_service_and_fetch_logs() {
|
||||
local unit="${1:?}"
|
||||
local start end
|
||||
local start
|
||||
|
||||
start="$(date '+%Y-%m-%d %T.%6N')"
|
||||
systemctl restart "$unit"
|
||||
sleep .5
|
||||
systemctl start "$unit"
|
||||
journalctl --sync
|
||||
end="$(date '+%Y-%m-%d %T.%6N')"
|
||||
|
||||
journalctl -q -u "$unit" -S "$start" -U "$end" -p notice
|
||||
systemctl stop "$unit"
|
||||
journalctl -q -u "$unit" -S "$start" -p notice
|
||||
}
|
||||
|
||||
if cgroupfs_supports_user_xattrs; then
|
||||
|
||||
Reference in New Issue
Block a user