Skip to content
Snippets Groups Projects
Commit f9226b4b authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added overrides tests

parent 2d8f96af
No related branches found
No related tags found
No related merge requests found
use v5.36; use v5.36;
use Test::Cmd; use Test::Cmd;
use Test::More tests =>27; use Test::More tests =>30;
use Path::Tiny; use Path::Tiny;
my $perl = $^X; my $perl = $^X;
my $testapp = Test::Cmd->new( my $testapp = Test::Cmd->new(
...@@ -97,5 +97,12 @@ like($testapp->stdout, qr/^25$/, 'ta-tool count dates, existing, stdout'); ...@@ -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'); like($testapp->stderr, qr/^$/, 'ta-tool count dates, existing, stderr');
is($? >> 8, 0, 'ta-tool count dates, existing, exit status'); 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; 1;
...@@ -27,7 +27,6 @@ password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f9 ...@@ -27,7 +27,6 @@ password: 839852bed005a7f1237578a6ac1197c142f7d0dd58bb248446dc7849d4bf770902e7f9
user: lza user: lza
_CFG_ _CFG_
# tests # tests
note "help check"; note "help check";
foreach my $param ("help info", "info -h", "info --help") { foreach my $param ("help info", "info -h", "info --help") {
$testapp->run(args => $param); $testapp->run(args => $param);
...@@ -44,12 +43,13 @@ like($testapp->stdout, qr/^6\.\d\.\d{1,2}$/, 'ta-tool elasticsearch version, std ...@@ -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'); like($testapp->stderr, qr/^$/, 'ta-tool elasticsearch version, stderr');
is($? >> 8, 0, 'ta-tool elasticsearch version, exit status'); is($? >> 8, 0, 'ta-tool elasticsearch version, exit status');
note "overrides";
$testapp->run(args =>'info --elasticsearch-host localhost --target-version'); $testapp->run(args =>'info --elasticsearch-host localhost --target-version');
#say "STDOUT:",$testapp->stdout; #say "STDOUT:",$testapp->stdout;
#say "STDERR:",$testapp->stderr; #say "STDERR:",$testapp->stderr;
like($testapp->stdout, qr/^$/, 'ta-tool elasticsearch version, stdout'); like($testapp->stdout, qr/^$/, 'ta-tool elasticsearch version, override, stdout');
like($testapp->stderr, qr/^Hint: override local config/, 'ta-tool elasticsearch version, stderr'); like($testapp->stderr, qr/^Hint: override local config/, 'ta-tool elasticsearch version, override, stderr');
is($? >> 8, 111, 'ta-tool elasticsearch version, exit status'); is($? >> 8, 111, 'ta-tool elasticsearch version, override, exit status');
1; 1;
use v5.36; use v5.36;
use Test::Cmd; use Test::Cmd;
use Test::More tests =>15; use Test::More tests =>18;
use Path::Tiny; use Path::Tiny;
my $perl = $^X; my $perl = $^X;
my $testapp = Test::Cmd->new( my $testapp = Test::Cmd->new(
...@@ -52,3 +51,11 @@ $testapp->run(args =>'report --output-as-csv'); ...@@ -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->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'); like($testapp->stderr, qr/^reporting for period/s, 'ta-tool report, base, stderr');
is($? >> 8, 0, 'ta-tool report, base, exit status'); 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');
use v5.36; use v5.36;
use Test::Cmd; use Test::Cmd;
use Test::More tests =>108; use Test::More tests =>111;
use Path::Tiny; use Path::Tiny;
my $perl = $^X; my $perl = $^X;
my $testapp = Test::Cmd->new( my $testapp = Test::Cmd->new(
...@@ -173,4 +173,12 @@ like($testapp->stdout, qr/\A"aipid"\n"47daf26a-02a1-4776-a8db-de04c6708bd2"\n/s, ...@@ -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'); 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'); 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; 1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment