diff options
author | Pascal Terjan <pterjan@mageia.org> | 2022-04-26 15:23:25 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2022-04-26 15:23:25 +0000 |
commit | cef4f68aedff52d0bfbc9dca867d3d7724a7020b (patch) | |
tree | b626316e36511a81b07760ad3af9dc802bc6ef50 | |
parent | c5778711ae16c34ba16e3ba87e1fff5e79587efc (diff) | |
download | iurt-cef4f68aedff52d0bfbc9dca867d3d7724a7020b.tar iurt-cef4f68aedff52d0bfbc9dca867d3d7724a7020b.tar.gz iurt-cef4f68aedff52d0bfbc9dca867d3d7724a7020b.tar.bz2 iurt-cef4f68aedff52d0bfbc9dca867d3d7724a7020b.tar.xz iurt-cef4f68aedff52d0bfbc9dca867d3d7724a7020b.zip |
Commit some forgotten test
-rw-r--r-- | t/queue.t | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/t/queue.t b/t/queue.t new file mode 100644 index 0000000..d9f8056 --- /dev/null +++ b/t/queue.t @@ -0,0 +1,60 @@ +use Test::More; +use Iurt::Queue; + +$config = {}; + +my $media = 'core/release'; +my $bot = 'iurt'; + +my $b1 = { + bot => $bot, + host => 'h1', + date => 20220401, + pid => 1, + 'arch' => 'a1', + 'time' => 42 +}; + +my $b2 = { + bot => $bot, + host => 'h1', + date => 20220401, + pid => 2, + 'arch' => 'a2', + 'time' => 42 +}; + +my $b3 = { + bot => $bot, + host => 'h2', + date => 20220401, + pid => 1, + 'arch' => 'a1', + 'time' => 42 +}; + +sub create_ent { + my %ent; + $ent->{media}{$media}{bot} = [$b1, $b2, $b3]; + return $ent; +} + +my $ent, $expected_ent; + +$ent = create_ent(); +remove_bot_from_package($ent, $media, 'h1', 42); +is_deeply $ent->{media}{$media}{bot}, [$b1, $b2, $b3] or diag explain $ent->{media}{$media}{bot}; + +$ent = create_ent(); +remove_bot_from_package($ent, $media, 'h1', 1); +is_deeply $ent->{media}{$media}{bot}, [$b2, $b3] or diag explain $ent->{media}{$media}{bot}; + +$ent = create_ent(); +remove_bot_from_package($ent, $media, 'h2', 1); +is_deeply $ent->{media}{$media}{bot}, [$b1, $b2] or diag explain $ent->{media}{$media}{bot}; + +$ent = create_ent(); +remove_bot_from_package($ent, $media, 'h1', 2); +is_deeply $ent->{media}{$media}{bot}, [$b1, $b3] or diag explain $ent->{media}{$media}{bot}; + +done_testing(); |