From 62f21638756062827b5bd9d9371cdd2c7d04fb59 Mon Sep 17 00:00:00 2001 From: Alexandre Pujol Date: Sat, 15 Oct 2022 22:05:52 +0100 Subject: [PATCH] test: add a dummy output for journalctl --user -b -u dbus.service -o json --- .gitlab-ci.yml | 3 ++- tests/journalctl | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/journalctl diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ce00c745..4380ed65 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,7 +48,8 @@ tests: stage: test image: golang script: - - echo '#!/usr/bin/env bash\nexit 0' > /usr/bin/journalctl + - cp tests/journalctl /usr/bin/journalctl + - chmod 755 /usr/bin/journalctl - go test ./cmd/aa-log -v -cover diff --git a/tests/journalctl b/tests/journalctl new file mode 100644 index 00000000..8a7ee141 --- /dev/null +++ b/tests/journalctl @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Dummy output for journalctl --user -b -u dbus.service -o json + +cat <<-_EOF +{"MESSAGE":"apparmor=\"ALLOWED\" operation=\"dbus_method_call\" bus=\"session\" path=\"/org/freedesktop/systemd1\" interface=\"org.freedesktop.systemd1.Manager\" member=\"SetEnvironment\" mask=\"send\" name=\"org.freedesktop.systemd1\" pid=2202 label=\"gnome-session-binary\" peer_pid=2070 peer_label=\"unconfined\"","_SYSTEMD_UNIT":"user@1000.service","_MACHINE_ID":"5ae7ab47ad014f699b6b60833dfad879","_CAP_EFFECTIVE":"0","SYSLOG_IDENTIFIER":"dbus-daemon","_SYSTEMD_CGROUP":"/user.slice/user-1000.slice/user@1000.service/app.slice/dbus.service","__MONOTONIC_TIMESTAMP":"4648713","_SELINUX_CONTEXT":"dbus-daemon (complain)\n","_SYSTEMD_OWNER_UID":"1000","_PID":"2115","_SYSTEMD_USER_UNIT":"dbus.service","_SYSTEMD_USER_SLICE":"app.slice","_AUDIT_SESSION":"2","SYSLOG_FACILITY":"1","_CMDLINE":"/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only","SYSLOG_RAW":"<13>Sep 23 19:08:22 dbus-daemon[2115]: apparmor=\"ALLOWED\" operation=\"dbus_method_call\" bus=\"session\" path=\"/org/freedesktop/systemd1\" interface=\"org.freedesktop.systemd1.Manager\" member=\"SetEnvironment\" mask=\"send\" name=\"org.freedesktop.systemd1\" pid=2202 label=\"gnome-session-binary\" peer_pid=2070 peer_label=\"unconfined\"\n"} +{"MESSAGE":"apparmor=\"ALLOWED\" operation=\"dbus_method_call\" bus=\"session\" path=\"/org/freedesktop/DBus\" interface=\"org.freedesktop.DBus\" member=\"UpdateActivationEnvironment\" mask=\"send\" name=\"org.freedesktop.DBus\" pid=2202 label=\"gnome-session-binary\" peer_label=\"dbus-daemon\"","_SYSTEMD_UNIT":"user@1000.service","_MACHINE_ID":"5ae7ab47ad014f699b6b60833dfad879","__MONOTONIC_TIMESTAMP":"4649441","_PID":"2115","_CMDLINE":"/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only","_SYSTEMD_USER_UNIT":"dbus.service","_SYSTEMD_USER_SLICE":"app.slice","_SYSTEMD_OWNER_UID":"1000","_SELINUX_CONTEXT":"dbus-daemon (complain)\n","_CAP_EFFECTIVE":"0","SYSLOG_TIMESTAMP":"Sep 23 19:08:22 ","PRIORITY":"5","_UID":"1000","_SYSTEMD_CGROUP":"/user.slice/user-1000.slice/user@1000.service/app.slice/dbus.service","_TRANSPORT":"syslog","_HOSTNAME":"ubuntu","SYSLOG_RAW":"<13>Sep 23 19:08:22 dbus-daemon[2115]: apparmor=\"ALLOWED\" operation=\"dbus_method_call\" bus=\"session\" path=\"/org/freedesktop/DBus\" interface=\"org.freedesktop.DBus\" member=\"UpdateActivationEnvironment\" mask=\"send\" name=\"org.freedesktop.DBus\" pid=2202 label=\"gnome-session-binary\" peer_label=\"dbus-daemon\"\n"} +_EOF +exit 0