Skip to content

Commit a0093a7

Browse files
author
Stepan Pesternikov
committed
job max run time error message
1 parent 2225c2f commit a0093a7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/perl/t/jobMaxRunTime.t

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $dbh->do($query);
2222
ok($dbh->err == 0) or (print $DBI::errstr . "\n" and $dbh->disconnect() and BAIL_OUT);
2323

2424
$query = "SELECT schedule.create_job(\'{ \"name\": \"Test 1\",
25-
\"cron\": \"* * * * *\",
25+
\"cron\": \"*/3 * * * *\",
2626
\"commands\": [\"SELECT pg_sleep(120)\",
2727
\"INSERT INTO test_results (time_mark, commentary) VALUES(now(), ''createJob'')\"],
2828
\"run_as\": \"tester\",
@@ -34,7 +34,7 @@ my $sth = $dbh->prepare($query);
3434
ok($sth->execute()) or (print $DBI::errstr . "\n" and $dbh->disconnect() and BAIL_OUT);
3535
my $job_id = $sth->fetchrow_array() and $sth->finish();
3636

37-
sleep 130;
37+
sleep 250;
3838
$query = "SELECT count(*) FROM test_results";
3939
$sth = $dbh->prepare($query);
4040
ok($sth->execute()) or (print $DBI::errstr . "\n" and $dbh->disconnect() and BAIL_OUT);
@@ -48,6 +48,13 @@ $sth->bind_param(1, $job_id);
4848
ok($sth->execute(), $dbh->errstr) or print $DBI::errstr . "\n";
4949
$sth->finish();
5050

51+
$query = "SELECT message FROM schedule.get_log() WHERE cron=$job_id AND status=\'error\' ORDER BY cron DESC LIMIT 1";
52+
my $sth = $dbh->prepare($query);
53+
ok($sth->execute()) or (print $DBI::errstr . "\n" and $dbh->disconnect() and BAIL_OUT);
54+
55+
my $errorstr = $sth->fetchrow_array() and $sth->finish();
56+
ok($errorstr eq "job timeout") or print $DBI::errstr . "\n";
57+
5158
$query = "DELETE FROM test_results;";
5259
$dbh->do($query);
5360
ok($dbh->err == 0, $dbh->errstr) or print $DBI::errstr . "\n";

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy