hydra-notify: move BuildFinished processing to an Event
This commit is contained in:
committed by
Your Name
parent
4a1389e36e
commit
fa6d7abc13
36
t/Event.t
36
t/Event.t
@ -1,6 +1,5 @@
|
||||
use strict;
|
||||
use Hydra::Event;
|
||||
use Hydra::Event::BuildFinished;
|
||||
|
||||
use Test2::V0;
|
||||
use Test2::Tools::Exception;
|
||||
@ -12,41 +11,6 @@ subtest "Event: new event" => sub {
|
||||
is($event->{'event'}->{'build_id'}, 19);
|
||||
};
|
||||
|
||||
|
||||
subtest "Payload type: build_finished" => sub {
|
||||
like(
|
||||
dies { Hydra::Event::parse_payload("build_finished", "") },
|
||||
qr/at least one argument/,
|
||||
"empty payload"
|
||||
);
|
||||
like(
|
||||
dies { Hydra::Event::parse_payload("build_finished", "abc123") },
|
||||
qr/should be integers/,
|
||||
"build ID should be an integer"
|
||||
);
|
||||
like(
|
||||
dies { Hydra::Event::parse_payload("build_finished", "123\tabc123") },
|
||||
qr/should be integers/,
|
||||
"dependent ID should be an integer"
|
||||
);
|
||||
is(
|
||||
Hydra::Event::parse_payload("build_finished", "123"),
|
||||
Hydra::Event::BuildFinished->new(123, []),
|
||||
"no dependent builds"
|
||||
);
|
||||
is(
|
||||
Hydra::Event::parse_payload("build_finished", "123\t456"),
|
||||
Hydra::Event::BuildFinished->new(123, [456]),
|
||||
"one dependent build"
|
||||
);
|
||||
is(
|
||||
Hydra::Event::parse_payload("build_finished", "123\t456\t789\t012\t345"),
|
||||
Hydra::Event::BuildFinished->new(123, [456, 789, 12, 345]),
|
||||
"four dependent builds"
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
subtest "Payload type: bogus" => sub {
|
||||
like(
|
||||
dies { Hydra::Event::parse_payload("bogus", "") },
|
||||
|
Reference in New Issue
Block a user