RunCommand: calculate all the commands to run against before starting

This commit is contained in:
Graham Christensen
2021-12-08 14:36:27 -05:00
parent b7962c3882
commit 26b197ea62
2 changed files with 87 additions and 19 deletions

View File

@ -134,4 +134,44 @@ subtest "eventMatches" => sub {
);
};
subtest "fanoutToCommands" => sub {
my $config = {
runcommand => [
{
job => "",
command => "foo"
},
{
job => "project:*:*",
command => "bar"
},
{
job => "project:jobset:nomatch",
command => "baz"
}
]
};
is(
Hydra::Plugin::RunCommand::fanoutToCommands(
$config,
"buildFinished",
"project",
"jobset",
"job"
),
[
{
matcher => "",
command => "foo"
},
{
matcher => "project:*:*",
command => "bar"
}
],
"fanoutToCommands returns a command per matching job"
);
};
done_testing;