From 8a708fd38fbcd6d83ea203720df16a653e77292c Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Mon, 10 Jul 2023 18:02:21 +0100 Subject: [PATCH] testsuite: cover sdexec perilog configuration Problem: there is no test coverage for configuring the system prolog and epilog to run under sdexec. Add a test script. --- t/Makefile.am | 1 + t/t2412-sdexec-perilog.t | 68 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100755 t/t2412-sdexec-perilog.t diff --git a/t/Makefile.am b/t/Makefile.am index f39cfd28efdd..e65ad56a5b53 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -181,6 +181,7 @@ TESTSCRIPTS = \ t2409-sdexec.t \ t2410-exec-systemd.t \ t2411-sdexec-job.t \ + t2412-sdexec-perilog.t \ t2500-job-attach.t \ t2501-job-status.t \ t2600-job-shell-rcalc.t \ diff --git a/t/t2412-sdexec-perilog.t b/t/t2412-sdexec-perilog.t new file mode 100755 index 000000000000..78e0aa4cc332 --- /dev/null +++ b/t/t2412-sdexec-perilog.t @@ -0,0 +1,68 @@ +#!/bin/sh +# ci=system + +test_description='Test that prolog and epilog can be run under systemd' + +. $(dirname $0)/sharness.sh + +if ! flux version | grep systemd; then + skip_all="flux was not built with systemd" + test_done +fi +if ! systemctl --user show --property Version; then + skip_all="user systemd is not running" + test_done +fi +if ! busctl --user status >/dev/null; then + skip_all="user dbus is not running" + test_done +fi + +mkdir -p config +cat >config/config.toml <flist.sh<<-EOT && + #!/bin/sh + systemctl --user list-units --type=service | grep "active running" + EOT + chmod +x flist.sh +' +test_expect_success 'run a single node job and capture broker logs' ' + flux dmesg -C && + flux run --wait-event=clean -vvv -N1 ./flist.sh >run.out && + flux dmesg >dmesg.out +' +test_expect_success 'shell was run under systemd' ' + grep "User workload" run.out +' +test_expect_success 'prolog was run under systemd' ' + grep "System prolog script" dmesg.out +' +test_expect_success 'epilog was run under systemd' ' + grep "System epilog script" dmesg.out +' +test_done