t/Setup: move subs calling hydra-* programs to a CliPrograms module
[?]
Dec 15, 2021, 1:25 AM
LEW5O57PMQ4SMFWYFWJ22R3IFJ63RPV5FMPEAGW3JRZCDJCR5WNACDependencies
- [2]
MIQH5W3FTest: Show error output from hydra-queue-runner on timeout - [3]
YIZWKGFItests: add jobsdir and testdir to ctx hash - [4]
HXEZUCTDAdd test to verify includes work - [5]
EAFAL4V3Test Setup: fix evalSucceeds to actually output evaluation errors - [6]
FAIJDQKZ - [7]
UGA45FNCAdd a plugin for backing up builds in s3 - [8]
OWRS526HCreate an ephemeral PostgreSQL database per test - [9]
3AKZKWCRRunCommand: Test - [10]
4QI6G7YBtests: replace the flat list of contexts with a hash - [11]
UIA3ULNUGive each test its own Nix directories - [12]
VI32YSGAI should test first - [13]
HX4QYOYAadd first evaluations tests - [14]
SBKX3YH2cleanup - [15]
OSIBECOEAttempt to fix errors during test teardown - [16]
QIW2WZKWFix indentation - [17]
V2ALOFRRFix the test - [18]
7VQ4ALFYUpdate "make check" for the new queue runner - [19]
OB7GB5DLTest environment cleanups - [20]
HE3GX5IPOptimize fetch-git. - [21]
4YCF3KBGConcurrent hydra-evaluator - [22]
A43SLRSHFix handling of IPC::Run::run exit status - [*]
2JJP7673tests: move to t, allow `yath test` from root
Change contents
- file addition: CliRunners.pm[24.2459]
use warnings;use strict;package CliRunners;our @ISA = qw(Exporter);our @EXPORT = qw(evalSucceeds runBuild sendNotificationscaptureStdoutStderr);sub captureStdoutStderr {# "Lazy"-load Hydra::Helper::Nix to avoid the compile-time# import of Hydra::Model::DB. Early loading of the DB class# causes fixation of the DSN, and we need to fixate it after# the temporary DB is setup.require Hydra::Helper::Nix;return Hydra::Helper::Nix::captureStdoutStderr(@_)}sub evalSucceeds {my ($jobset) = @_;my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-eval-jobset", $jobset->project->name, $jobset->name));$jobset->discard_changes; # refresh from DBchomp $stdout; chomp $stderr;print STDERR "Evaluation errors for jobset ".$jobset->project->name.":".$jobset->name.": \n".$jobset->errormsg."\n" if $jobset->errormsg;print STDERR "STDOUT: $stdout\n" if $stdout ne "";print STDERR "STDERR: $stderr\n" if $stderr ne "";return !$res;}sub runBuild {my ($build) = @_;my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-queue-runner", "-vvvv", "--build-one", $build->id));if ($res) {print STDERR "Queue runner stdout: $stdout\n" if $stdout ne "";print STDERR "Queue runner stderr: $stderr\n" if $stderr ne "";}return !$res;}sub sendNotifications() {my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-notify", "--queued-only"));if ($res) {print STDERR "hydra notify stdout: $stdout\n" if $stdout ne "";print STDERR "hydra notify stderr: $stderr\n" if $stderr ne "";}return !$res;}1; - edit in t/lib/Setup.pm at line 11
use CliRunners; - edit in t/lib/Setup.pm at line 47[6.137]→[6.915:1256](∅→∅),[4.1031]→[6.915:1256](∅→∅),[6.2224]→[6.915:1256](∅→∅),[6.915]→[6.915:1256](∅→∅)
}sub captureStdoutStderr {# "Lazy"-load Hydra::Helper::Nix to avoid the compile-time# import of Hydra::Model::DB. Early loading of the DB class# causes fixation of the DSN, and we need to fixate it after# the temporary DB is setup.require Hydra::Helper::Nix;return Hydra::Helper::Nix::captureStdoutStderr(@_) - edit in t/lib/Setup.pm at line 96[6.1172]→[6.763:766](∅→∅),[6.1312]→[6.763:766](∅→∅),[6.763]→[6.763:766](∅→∅),[6.766]→[6.1173:1192](∅→∅),[6.1192]→[6.1313:1336](∅→∅),[6.1336]→[6.11450:11571](∅→∅),[6.11571]→[5.0:49](∅→∅),[5.49]→[6.1469:1755](∅→∅),[6.9463]→[6.1469:1755](∅→∅),[6.11571]→[6.1469:1755](∅→∅),[6.1469]→[6.1469:1755](∅→∅),[6.1755]→[6.3646:3664](∅→∅),[6.1772]→[6.1482:1485](∅→∅),[6.3664]→[6.1482:1485](∅→∅),[6.1482]→[6.1482:1485](∅→∅),[6.1485]→[6.707:722](∅→∅),[6.722]→[6.1773:1795](∅→∅),[6.1795]→[6.1696:1815](∅→∅),[6.1815]→[2.62:228](∅→∅),[2.228]→[6.3711:3729](∅→∅),[6.1815]→[6.3711:3729](∅→∅),[6.3711]→[6.3711:3729](∅→∅),[6.271]→[6.4328:4331](∅→∅),[6.1971]→[6.4328:4331](∅→∅),[6.3729]→[6.4328:4331](∅→∅),[6.440]→[6.4328:4331](∅→∅),[6.4331]→[6.900:1204](∅→∅)
}sub evalSucceeds {my ($jobset) = @_;my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-eval-jobset", $jobset->project->name, $jobset->name));$jobset->discard_changes; # refresh from DBchomp $stdout; chomp $stderr;print STDERR "Evaluation errors for jobset ".$jobset->project->name.":".$jobset->name.": \n".$jobset->errormsg."\n" if $jobset->errormsg;print STDERR "STDOUT: $stdout\n" if $stdout ne "";print STDERR "STDERR: $stderr\n" if $stderr ne "";return !$res;}sub runBuild {my ($build) = @_;my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-queue-runner", "-vvvv", "--build-one", $build->id));if ($res) {print STDERR "Queue runner stdout: $stdout\n" if $stdout ne "";print STDERR "Queue runner stderr: $stderr\n" if $stderr ne "";}return !$res;}sub sendNotifications() {my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-notify", "--queued-only"));if ($res) {print STDERR "hydra notify stdout: $stdout\n" if $stdout ne "";print STDERR "hydra notify stderr: $stderr\n" if $stderr ne "";}return !$res;