Skip to content

Commit

Permalink
improve test reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Apr 14, 2024
1 parent f3503b7 commit 1684f26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion t/TestUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ sub wait_for_job {
sleep => time to wait after executing the command
env => hash with extra environment variables
waitfor => wait till regex occurs (max 120sec)
maxwait => how long should be waited (default 30sec)
}
=cut
Expand All @@ -751,7 +752,7 @@ sub test_command {

# wait for something?
if(defined $test->{'waitfor'}) {
my $duration = 30;
my $duration = $test->{'maxwait'} // 30;
my $start = time();
my $now = time();
my $waitfor = $test->{'waitfor'};
Expand Down
1 change: 1 addition & 0 deletions t/scenarios/auth/t/local/012-grafana-export.t
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ TestUtils::test_command({
TestUtils::test_command({
cmd => $curl.' "http://127.0.0.1/demo/histou/index.php?host=test&service=Ping&annotations=true&callback=jQuery36108434547110946526_1676536465838"',
waitfor => 'test\ Ping\ check_ping\ pl',
maxwait => 120, # grafana might need some time to get ready
});

# fails directly after first start, so do it twice
Expand Down

0 comments on commit 1684f26

Please sign in to comment.