feat(t/evaluator/evaluate-oom): comment intentions
This commit is contained in:
parent
87f610e7c1
commit
065039beba
|
@ -4,6 +4,10 @@ use Setup;
|
||||||
use Test2::V0;
|
use Test2::V0;
|
||||||
use Hydra::Helper::Exec;
|
use Hydra::Helper::Exec;
|
||||||
|
|
||||||
|
# Ensure that `systemd-run` is
|
||||||
|
# - Available in the PATH/envionment
|
||||||
|
# - Accessable to the user executing it
|
||||||
|
# - Capable of using the command switches we use in our test
|
||||||
my $sd_res;
|
my $sd_res;
|
||||||
eval {
|
eval {
|
||||||
($sd_res) = captureStdoutStderr(3, (
|
($sd_res) = captureStdoutStderr(3, (
|
||||||
|
@ -17,12 +21,21 @@ eval {
|
||||||
"true"
|
"true"
|
||||||
));
|
));
|
||||||
} or do {
|
} or do {
|
||||||
|
# The command failed to execute, likely because `systemd-run` is not present
|
||||||
|
# in `PATH`
|
||||||
skip_all("`systemd-run` failed when invoked in this environment");
|
skip_all("`systemd-run` failed when invoked in this environment");
|
||||||
};
|
};
|
||||||
if ($sd_res != 0) { skip_all("`systemd-run` returned non-zero when executing `true` (expected 0)"); }
|
if ($sd_res != 0) {
|
||||||
|
# `systemd-run` executed but `sytemd-run` failed to call `true` and return
|
||||||
|
# successfully
|
||||||
|
skip_all("`systemd-run` returned non-zero when executing `true` (expected 0)");
|
||||||
|
}
|
||||||
|
|
||||||
my $ctx = test_context();
|
my $ctx = test_context();
|
||||||
|
|
||||||
|
# Contain the memory usage to 25 MegaBytes using `systemd-run`
|
||||||
|
# Run `hydra-eval-jobs` on test job that will purposefully consume all memory
|
||||||
|
# available
|
||||||
my ($res, $stdout, $stderr) = captureStdoutStderr(60, (
|
my ($res, $stdout, $stderr) = captureStdoutStderr(60, (
|
||||||
"systemd-run",
|
"systemd-run",
|
||||||
"--user",
|
"--user",
|
||||||
|
@ -41,6 +54,8 @@ isnt($res, 0, "`hydra-eval-jobs` exits non-zero");
|
||||||
ok(utf8::decode($stderr), "Stderr output is UTF8-clean");
|
ok(utf8::decode($stderr), "Stderr output is UTF8-clean");
|
||||||
like(
|
like(
|
||||||
$stderr,
|
$stderr,
|
||||||
|
# Assert error log contains messages added in PR
|
||||||
|
# https://github.com/NixOS/hydra/pull/1203
|
||||||
qr/^child process \(\d+?\) killed by signal=9$/m,
|
qr/^child process \(\d+?\) killed by signal=9$/m,
|
||||||
"The stderr record includes a relevant error message"
|
"The stderr record includes a relevant error message"
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue