Skip to content

Commit 8924125

Browse files
author
Vladimir Ershov
committed
drop user after test
1 parent b121ece commit 8924125

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ OBJS = src/pgpro_scheduler.o src/cron_string.o src/sched_manager_poll.o \
77
EXTENSION = pgpro_scheduler
88
DATA = pgpro_scheduler--1.0.sql
99
REGRESS = install_pgpro_scheduler cron_string
10-
REGRESS_OPTS = --create-role=__robot__ --user=postgres
10+
REGRESS_OPTS = --user=postgres
1111
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
1212

1313
ifdef USE_PGXS

expected/cron_string.out

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
create user __temp_robot;
12
select schedule.create_job(
23
'{
34
"name": "Test @reboot",
45
"cron": "@reboot",
56
"command": "show all",
6-
"run_as": "__robot__"
7+
"run_as": "__temp_robot"
78
}'
89
);
910
create_job
@@ -16,7 +17,7 @@ select schedule.create_job(
1617
"name": "Test 1",
1718
"cron": "* * * * *",
1819
"command": "select ''this is every minute job''",
19-
"run_as": "__robot__",
20+
"run_as": "__temp_robot",
2021
"last_start_available": "2 hours"
2122
}'
2223
);
@@ -30,7 +31,7 @@ select schedule.create_job(
3031
"name": "Test 2 4/4 2/4 * * *",
3132
"cron": "4/4 2/4 * * *",
3233
"command": "select pg_sleep(10)",
33-
"run_as": "__robot__"
34+
"run_as": "__temp_robot"
3435
}'
3536
);
3637
create_job
@@ -51,11 +52,12 @@ select schedule.create_job(
5152
(1 row)
5253

5354
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 | | | |
55+
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
56+
----+--------+----------------------+----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------------------------------------+------------------+----------------------+--------+--------+--------------+----------+-----------+-------+--------------+---------------+------------+----------+--------+-----------------
57+
1 | master | Test @reboot | | {"crontab": "@reboot", "onstart": 1} | | {"show all"} | f | | t | f | __temp_robot | postgres | | 0 | | 1 | | | |
58+
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 | __temp_robot | postgres | @ 2 hours | 0 | | 1 | | | |
59+
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 | __temp_robot | postgres | | 0 | | 1 | | | |
60+
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 | | | |
6061
(4 rows)
6162

63+
drop user __temp_robot;

sql/cron_string.sql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
create user __temp_robot;
12
select schedule.create_job(
23
'{
34
"name": "Test @reboot",
45
"cron": "@reboot",
56
"command": "show all",
6-
"run_as": "__robot__"
7+
"run_as": "__temp_robot"
78
}'
89
);
910

@@ -12,7 +13,7 @@ select schedule.create_job(
1213
"name": "Test 1",
1314
"cron": "* * * * *",
1415
"command": "select ''this is every minute job''",
15-
"run_as": "__robot__",
16+
"run_as": "__temp_robot",
1617
"last_start_available": "2 hours"
1718
}'
1819
);
@@ -22,7 +23,7 @@ select schedule.create_job(
2223
"name": "Test 2 4/4 2/4 * * *",
2324
"cron": "4/4 2/4 * * *",
2425
"command": "select pg_sleep(10)",
25-
"run_as": "__robot__"
26+
"run_as": "__temp_robot"
2627
}'
2728
);
2829

@@ -36,3 +37,4 @@ select schedule.create_job(
3637

3738
select * from schedule.cron order by id;
3839

40+
drop user __temp_robot;

0 commit comments

Comments
 (0)