Skip to content

Commit b121ece

Browse files
author
Vladimir Ershov
committed
regression tests revoked
1 parent 0d6531b commit b121ece

File tree

6 files changed

+105
-4
lines changed

6 files changed

+105
-4
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ OBJS = src/pgpro_scheduler.o src/cron_string.o src/sched_manager_poll.o \
66
$(WIN32RES)
77
EXTENSION = pgpro_scheduler
88
DATA = pgpro_scheduler--1.0.sql
9-
#SCRIPTS = bin/pgpro_scheduler
10-
#REGRESS = install_pgpro_scheduler cron_string
11-
#REGRESS_OPTS = --create-role=robot --user=postgres
12-
#CFLAGS=-ggdb -Og -g3 -fno-omit-frame-pointer
9+
REGRESS = install_pgpro_scheduler cron_string
10+
REGRESS_OPTS = --create-role=__robot__ --user=postgres
11+
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
1312

1413
ifdef USE_PGXS
1514
PG_CONFIG = pg_config

conf.add

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shared_preload_libraries='pgpro_scheduler'

expected/cron_string.out

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
select schedule.create_job(
2+
'{
3+
"name": "Test @reboot",
4+
"cron": "@reboot",
5+
"command": "show all",
6+
"run_as": "__robot__"
7+
}'
8+
);
9+
create_job
10+
------------
11+
1
12+
(1 row)
13+
14+
select schedule.create_job(
15+
'{
16+
"name": "Test 1",
17+
"cron": "* * * * *",
18+
"command": "select ''this is every minute job''",
19+
"run_as": "__robot__",
20+
"last_start_available": "2 hours"
21+
}'
22+
);
23+
create_job
24+
------------
25+
2
26+
(1 row)
27+
28+
select schedule.create_job(
29+
'{
30+
"name": "Test 2 4/4 2/4 * * *",
31+
"cron": "4/4 2/4 * * *",
32+
"command": "select pg_sleep(10)",
33+
"run_as": "__robot__"
34+
}'
35+
);
36+
create_job
37+
------------
38+
3
39+
(1 row)
40+
41+
select schedule.create_job(
42+
'{
43+
"name": "Test 3",
44+
"cron": "23 1 * * THU,SUN",
45+
"command": "select ''ok'' as ok"
46+
}'
47+
);
48+
create_job
49+
------------
50+
4
51+
(1 row)
52+
53+
select * from schedule.cron order by id;
54+
id | node | name | comments | rule | next_time_statement | do_sql | same_transaction | onrollback_statement | active | broken | executor | owner | postpone | retry | max_run_time | max_instances | start_date | end_date | reason | _next_exec_time
55+
----+--------+----------------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------------------------+------------------+----------------------+--------+--------+-----------+----------+-----------+-------+--------------+---------------+------------+----------+--------+-----------------
56+
1 | master | Test @reboot | | {"crontab": "@reboot", "onstart": 1} | | {"show all"} | f | | t | f | __robot__ | postgres | | 0 | | 1 | | | |
57+
2 | master | Test 1 | | {"days": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], "hours": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], "wdays": [0, 1, 2, 3, 4, 5, 6], "months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "crontab": "* * * * *", "minutes": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]} | | {"select 'this is every minute job'"} | f | | t | f | __robot__ | postgres | @ 2 hours | 0 | | 1 | | | |
58+
3 | master | Test 2 4/4 2/4 * * * | | {"days": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], "hours": [2, 6, 10, 14, 18, 22], "wdays": [0, 1, 2, 3, 4, 5, 6], "months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "crontab": "4/4 2/4 * * *", "minutes": [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56]} | | {"select pg_sleep(10)"} | f | | t | f | __robot__ | postgres | | 0 | | 1 | | | |
59+
4 | master | Test 3 | | {"days": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], "hours": [1], "wdays": [0, 4], "months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "crontab": "23 1 * * THU,SUN", "minutes": [23]} | | {"select 'ok' as ok"} | f | | t | f | postgres | postgres | | 0 | | 1 | | | |
60+
(4 rows)
61+

expected/install_pgpro_scheduler.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION pgpro_scheduler;

sql/cron_string.sql

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
select schedule.create_job(
2+
'{
3+
"name": "Test @reboot",
4+
"cron": "@reboot",
5+
"command": "show all",
6+
"run_as": "__robot__"
7+
}'
8+
);
9+
10+
select schedule.create_job(
11+
'{
12+
"name": "Test 1",
13+
"cron": "* * * * *",
14+
"command": "select ''this is every minute job''",
15+
"run_as": "__robot__",
16+
"last_start_available": "2 hours"
17+
}'
18+
);
19+
20+
select schedule.create_job(
21+
'{
22+
"name": "Test 2 4/4 2/4 * * *",
23+
"cron": "4/4 2/4 * * *",
24+
"command": "select pg_sleep(10)",
25+
"run_as": "__robot__"
26+
}'
27+
);
28+
29+
select schedule.create_job(
30+
'{
31+
"name": "Test 3",
32+
"cron": "23 1 * * THU,SUN",
33+
"command": "select ''ok'' as ok"
34+
}'
35+
);
36+
37+
select * from schedule.cron order by id;
38+

sql/install_pgpro_scheduler.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION pgpro_scheduler;

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