From f9226b4b9d03d090f26e2d0418a0bb0c31449662 Mon Sep 17 00:00:00 2001 From: Andreas Romeyke <andreas.romeyke@slub-dresden.de> Date: Tue, 28 May 2024 14:08:21 +0200 Subject: [PATCH] - added overrides tests --- t/03-count.t | 9 ++++++++- t/03-info.t | 8 ++++---- t/03-report.t | 11 +++++++++-- t/03-search.t | 10 +++++++++- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/t/03-count.t b/t/03-count.t index 2f9d420..864e8af 100644 --- a/t/03-count.t +++ b/t/03-count.t @@ -1,6 +1,6 @@ use v5.36; use Test::Cmd; -use Test::More tests =>27; +use Test::More tests =>30; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -97,5 +97,12 @@ like($testapp->stdout, qr/^25$/, 'ta-tool count dates, existing, stdout'); like($testapp->stderr, qr/^$/, 'ta-tool count dates, existing, stderr'); is($? >> 8, 0, 'ta-tool count dates, existing, exit status'); +note "overrides"; +$testapp->run(args =>'count --elasticsearch-host localhost --creationdate 2023-09-05...2023-12-22'); +#say "STDOUT:",$testapp->stdout; +#say "STDERR:",$testapp->stderr; +like($testapp->stdout, qr/^$/, 'ta-tool count dates, existing, override, stdout'); +like($testapp->stderr, qr/^Hint: override local config with/, 'ta-tool count dates, existing, override, stderr'); +is($? >> 8, 111, 'ta-tool count dates, existing, override, exit status'); 1; diff --git a/t/03-info.t b/t/03-info.t index 6aa0261..08ebf16 100644 --- a/t/03-info.t +++ b/t/03-info.t @@ -27,7 +27,6 @@ password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f9 user: lza _CFG_ # tests - note "help check"; foreach my $param ("help info", "info -h", "info --help") { $testapp->run(args => $param); @@ -44,12 +43,13 @@ like($testapp->stdout, qr/^6\.\d\.\d{1,2}$/, 'ta-tool elasticsearch version, std like($testapp->stderr, qr/^$/, 'ta-tool elasticsearch version, stderr'); is($? >> 8, 0, 'ta-tool elasticsearch version, exit status'); +note "overrides"; $testapp->run(args =>'info --elasticsearch-host localhost --target-version'); #say "STDOUT:",$testapp->stdout; #say "STDERR:",$testapp->stderr; -like($testapp->stdout, qr/^$/, 'ta-tool elasticsearch version, stdout'); -like($testapp->stderr, qr/^Hint: override local config/, 'ta-tool elasticsearch version, stderr'); -is($? >> 8, 111, 'ta-tool elasticsearch version, exit status'); +like($testapp->stdout, qr/^$/, 'ta-tool elasticsearch version, override, stdout'); +like($testapp->stderr, qr/^Hint: override local config/, 'ta-tool elasticsearch version, override, stderr'); +is($? >> 8, 111, 'ta-tool elasticsearch version, override, exit status'); 1; diff --git a/t/03-report.t b/t/03-report.t index f427e87..62f33f5 100644 --- a/t/03-report.t +++ b/t/03-report.t @@ -1,7 +1,6 @@ - use v5.36; use Test::Cmd; -use Test::More tests =>15; +use Test::More tests =>18; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -52,3 +51,11 @@ $testapp->run(args =>'report --output-as-csv'); like($testapp->stdout, qr/^"set","subset","aip_state","flavour","value"\n"([a-z]+)",,"([a-z]+)","([a-z]+)",\d+(\.\d+)?\n/s, 'ta-tool report, base, stdout'); like($testapp->stderr, qr/^reporting for period/s, 'ta-tool report, base, stderr'); is($? >> 8, 0, 'ta-tool report, base, exit status'); + +note "overrides"; +$testapp->run(args =>'report --elasticsearch-host localhost'); +#say "STDOUT:",$testapp->stdout; +#say "STDERR:",$testapp->stderr; +like($testapp->stdout, qr/^$/s, 'ta-tool report, base, stdout'); +like($testapp->stderr, qr/^Hint: override local config with/s, 'ta-tool report, base, stderr'); +is($? >> 8, 111, 'ta-tool report, base, exit status'); diff --git a/t/03-search.t b/t/03-search.t index 2c31d00..a2c88a2 100644 --- a/t/03-search.t +++ b/t/03-search.t @@ -1,6 +1,6 @@ use v5.36; use Test::Cmd; -use Test::More tests =>108; +use Test::More tests =>111; use Path::Tiny; my $perl = $^X; my $testapp = Test::Cmd->new( @@ -173,4 +173,12 @@ like($testapp->stdout, qr/\A"aipid"\n"47daf26a-02a1-4776-a8db-de04c6708bd2"\n/s, like($testapp->stderr, qr/\Afound 25 results\nreporting results 1 … 10 output as csv/s, 'ta-tool search dates, existing, stderr'); is($? >> 8, 0, 'ta-tool search dates, existing, exit status'); +note "overrides"; +$testapp->run(args =>'search --elasticsearch-host localhost --creationdate 2023-09-05...2023-12-22'); +#say "STDOUT:",$testapp->stdout; +#say "STDERR:",$testapp->stderr; +like($testapp->stdout, qr/^$/s, 'ta-tool search dates, existing, override, stdout'); +like($testapp->stderr, qr/^Hint: override local config with/s, 'ta-tool search dates, existing, override stderr'); +is($? >> 8, 111, 'ta-tool search dates, existing, override, exit status'); + 1; -- GitLab