From 6f662a606abe02c1c4918742c21eeec772e8fcfc Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 20 Mar 2021 09:06:54 -0400 Subject: [PATCH] hydra-send-stats: add a failing test asserting it can run --- t/lib/Setup.pm | 5 ++++- t/scripts/hydra-send-stats.t | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 t/scripts/hydra-send-stats.t diff --git a/t/lib/Setup.pm b/t/lib/Setup.pm index 3cc9828e..cdea38ce 100644 --- a/t/lib/Setup.pm +++ b/t/lib/Setup.pm @@ -9,7 +9,10 @@ use File::Basename; use Cwd qw(abs_path getcwd); our @ISA = qw(Exporter); -our @EXPORT = qw(test_init hydra_setup nrBuildsForJobset queuedBuildsForJobset nrQueuedBuildsForJobset createBaseJobset createJobsetWithOneInput evalSucceeds runBuild sendNotifications updateRepository); +our @EXPORT = qw(test_init hydra_setup nrBuildsForJobset queuedBuildsForJobset + nrQueuedBuildsForJobset createBaseJobset createJobsetWithOneInput + evalSucceeds runBuild sendNotifications updateRepository + captureStdoutStderr); # Set up the environment for running tests. # diff --git a/t/scripts/hydra-send-stats.t b/t/scripts/hydra-send-stats.t new file mode 100644 index 00000000..174bde64 --- /dev/null +++ b/t/scripts/hydra-send-stats.t @@ -0,0 +1,20 @@ +use feature 'unicode_strings'; +use strict; +use Setup; + +my %ctx = test_init(); + +require Hydra::Schema; +require Hydra::Model::DB; + +use Test2::V0; + +my $db = Hydra::Model::DB->new; +hydra_setup($db); + +my ($res, $stdout, $stderr) = captureStdoutStderr(60, ("hydra-send-stats")); +is($stdout, "", "hydra-send-stats stdout should be empty"); +is($stderr, "", "hydra-send-stats stderr should be empty"); +is($res, 0, "hydra-send-stats --once should exit zero"); + +done_testing;