@@ -22,7 +22,7 @@ $dbh->do($query);
22
22
ok($dbh -> err == 0)or (print $DBI::errstr ." \n " and $dbh -> disconnect()and BAIL_OUT);
23
23
24
24
$query =" SELECT schedule.create_job(\' {\" name\" :\" Test 1\" ,
25
- \" cron\" :\" * * * * *\" ,
25
+ \" cron\" :\" */3 * * * *\" ,
26
26
\" commands\" : [\" SELECT pg_sleep(120)\" ,
27
27
\" INSERT INTO test_results (time_mark, commentary) VALUES(now(), ''createJob'')\" ],
28
28
\" run_as\" :\" tester\" ,
@@ -34,7 +34,7 @@ my $sth = $dbh->prepare($query);
34
34
ok($sth -> execute())or (print $DBI::errstr ." \n " and $dbh -> disconnect()and BAIL_OUT);
35
35
my $job_id =$sth -> fetchrow_array()and $sth -> finish();
36
36
37
- sleep 130 ;
37
+ sleep 250 ;
38
38
$query =" SELECT count(*) FROM test_results" ;
39
39
$sth =$dbh -> prepare($query );
40
40
ok($sth -> execute())or (print $DBI::errstr ." \n " and $dbh -> disconnect()and BAIL_OUT);
@@ -48,6 +48,13 @@ $sth->bind_param(1, $job_id);
48
48
ok($sth -> execute(),$dbh -> errstr)or print $DBI::errstr ." \n " ;
49
49
$sth -> finish();
50
50
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
+
51
58
$query =" DELETE FROM test_results;" ;
52
59
$dbh -> do($query );
53
60
ok($dbh -> err == 0,$dbh -> errstr)or print $DBI::errstr ." \n " ;