Skip to content

Commit

Permalink
testsuite: cover sdexec perilog configuration
Browse files Browse the repository at this point in the history
Problem: there is no test coverage for configuring the system
prolog and epilog to run under sdexec.

Add a test script.
  • Loading branch information
garlick committed Jul 10, 2023
1 parent d9c9094 commit 8a708fd
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
68 changes: 68 additions & 0 deletions t/t2412-sdexec-perilog.t
Original file line number Diff line number Diff line change
@@ -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 <<EOT
[systemd]
enable = true
sdbus-debug = true
sdexec-debug = true
[exec]
service = "sdexec"
[job-manager]
plugins = [
{ load = "perilog.so" }
]
prolog.command = [
"flux", "perilog-run", "prolog", "--sdexec", "-e", "$(pwd)/flist.sh"
]
epilog.command = [
"flux", "perilog-run", "epilog", "--sdexec", "-e", "$(pwd)/flist.sh"
]
EOT

test_under_flux 1 full -o,--config-path=$(pwd)/config

flux setattr log-stderr-level 1

test_expect_success 'create flist.sh script' '
cat >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

0 comments on commit 8a708fd

Please sign in to comment.