Skip to content

Commit a13d930

Browse files
committed
Fix tests
1 parent a9002db commit a13d930

12 files changed

+140
-139
lines changed

tsl/test/expected/bgw_custom.out

+16-15
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,6 @@ SELECT job_id FROM alter_job(1000,scheduled:=false);
187187
1000
188188
(1 row)
189189

190-
-- test updating the job name
191-
SELECT job_id, job_name FROM alter_job(1000,job_name:='custom_name_2');
192-
job_id | job_name
193-
--------+----------------------
194-
1000 | custom_name_2 [1000]
195-
(1 row)
196-
SELECT application_name FROM timescaledb_information.jobs WHERE job_id = 1000;
197-
application_name
198-
----------------------
199-
custom_name_2 [1000]
200-
(1 row)
201-
202190
SELECT scheduled, config FROM timescaledb_information.jobs WHERE job_id = 1000;
203191
scheduled | config
204192
-----------+----------------------
@@ -242,6 +230,19 @@ SELECT scheduled, config FROM timescaledb_information.jobs WHERE job_id = 1000;
242230
f | {"test": "test"}
243231
(1 row)
244232

233+
-- test updating the job name
234+
SELECT job_id, job_name FROM alter_job(1000,job_name:='custom_name_2');
235+
job_id | job_name
236+
--------+----------------------
237+
1000 | custom_name_2 [1000]
238+
(1 row)
239+
240+
SELECT application_name FROM timescaledb_information.jobs WHERE job_id = 1000;
241+
application_name
242+
----------------------
243+
custom_name_2 [1000]
244+
(1 row)
245+
245246
-- Done with job 1000 now, so remove it.
246247
SELECT delete_job(1000);
247248
delete_job
@@ -918,9 +919,9 @@ update _timescaledb_catalog.chunk set status=3 where table_name = :'new_uncompre
918919
SELECT add_compression_policy('sensor_data', INTERVAL '1' minute) AS compressjob_id \gset
919920
-- set recompress to true
920921
SELECT alter_job(id,config:=jsonb_set(config,'{recompress}', 'true')) FROM _timescaledb_config.bgw_job WHERE id = :compressjob_id;
921-
alter_job
922-
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
923-
(1014,"@ 12 hours","@ 0",-1,"@ 1 hour",t,"{""recompress"": true, ""hypertable_id"": 4, ""compress_after"": ""@ 1 min""}",-infinity,_timescaledb_functions.policy_compression_check,f,,)
922+
alter_job
923+
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
924+
(1014,"@ 12 hours","@ 0",-1,"@ 1 hour",t,"{""recompress"": true, ""hypertable_id"": 4, ""compress_after"": ""@ 1 min""}",-infinity,_timescaledb_functions.policy_compression_check,f,,,"Compression Policy [1014]")
924925
(1 row)
925926

926927
-- verify that there are other uncompressed new chunks that need to be compressed

tsl/test/expected/bgw_db_scheduler.out

+6-6
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,9 @@ SELECT wait_for_timer_to_run(0);
14251425
SELECT insert_job('another', 'bgw_test_job_1', INTERVAL '100ms', INTERVAL '100s', INTERVAL '1s') AS job_id \gset
14261426
-- call alter_job to trigger cache invalidation
14271427
SELECT alter_job(:job_id,scheduled:=true);
1428-
alter_job
1429-
---------------------------------------------------------------------
1430-
(1024,"@ 0.1 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,f,,)
1428+
alter_job
1429+
-----------------------------------------------------------------------------
1430+
(1024,"@ 0.1 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,f,,,another)
14311431
(1 row)
14321432

14331433
SELECT ts_bgw_params_reset_time(50000, true);
@@ -1541,9 +1541,9 @@ SELECT wait_for_timer_to_run(400000);
15411541
SELECT insert_job('new_job', 'bgw_test_job_1', INTERVAL '10ms', INTERVAL '100s', INTERVAL '1s') AS job_id \gset
15421542
-- call alter_job to trigger cache invalidation
15431543
SELECT alter_job(:job_id,scheduled:=true);
1544-
alter_job
1545-
----------------------------------------------------------------------
1546-
(1025,"@ 0.01 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,f,,)
1544+
alter_job
1545+
------------------------------------------------------------------------------
1546+
(1025,"@ 0.01 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,f,,,new_job)
15471547
(1 row)
15481548

15491549
SELECT ts_bgw_params_reset_time(450000, true);

tsl/test/expected/bgw_db_scheduler_fixed.out

+9-9
Original file line numberDiff line numberDiff line change
@@ -1424,9 +1424,9 @@ SELECT wait_for_timer_to_run(0);
14241424
SELECT insert_job('another', 'bgw_test_job_1', INTERVAL '100ms', INTERVAL '100s', INTERVAL '1s') AS job_id \gset
14251425
-- call alter_job to trigger cache invalidation
14261426
SELECT alter_job(:job_id,scheduled:=true);
1427-
alter_job
1428-
---------------------------------------------------------------------------------------------------
1429-
(1024,"@ 0.1 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,t,"Fri Dec 31 16:00:00 1999 PST",)
1427+
alter_job
1428+
-----------------------------------------------------------------------------------------------------------
1429+
(1024,"@ 0.1 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,t,"Fri Dec 31 16:00:00 1999 PST",,another)
14301430
(1 row)
14311431

14321432
SELECT ts_bgw_params_reset_time(50000, true);
@@ -1526,9 +1526,9 @@ SELECT wait_for_timer_to_run(400000);
15261526
SELECT insert_job('new_job', 'bgw_test_job_1', INTERVAL '10ms', INTERVAL '100s', INTERVAL '1s') AS job_id \gset
15271527
-- call alter_job to trigger cache invalidation
15281528
SELECT alter_job(:job_id,scheduled:=true);
1529-
alter_job
1530-
----------------------------------------------------------------------------------------------------
1531-
(1025,"@ 0.01 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,t,"Fri Dec 31 16:00:00 1999 PST",)
1529+
alter_job
1530+
------------------------------------------------------------------------------------------------------------
1531+
(1025,"@ 0.01 secs","@ 1 min 40 secs",5,"@ 1 sec",t,,-infinity,,t,"Fri Dec 31 16:00:00 1999 PST",,new_job)
15321532
(1 row)
15331533

15341534
SELECT ts_bgw_params_reset_time(450000, true);
@@ -1907,8 +1907,8 @@ SELECT * FROM _timescaledb_internal.bgw_job_stat WHERE job_id = :jobid_fixed_2;
19071907

19081908
-- next start is now updated
19091909
SELECT alter_job(:jobid_fixed_2, fixed_schedule => false);
1910-
alter_job
1911-
-------------------------------------------------------------------------------------------------------------
1912-
(1035,"@ 30 secs","@ 0",-1,"@ 5 mins",t,,"Sat Jan 01 00:01:03 2000 PST",,f,"Sat Jan 01 00:00:23 2000 PST",)
1910+
alter_job
1911+
------------------------------------------------------------------------------------------------------------------------------------------
1912+
(1035,"@ 30 secs","@ 0",-1,"@ 5 mins",t,,"Sat Jan 01 00:01:03 2000 PST",,f,"Sat Jan 01 00:00:23 2000 PST",,"User-Defined Action [1035]")
19131913
(1 row)
19141914

tsl/test/expected/bgw_reorder_drop_chunks.out

+9-9
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ SELECT count(*) FROM _timescaledb_config.bgw_job WHERE proc_schema = '_timescale
406406
(1 row)
407407

408408
SELECT alter_job(:drop_chunks_job_id, schedule_interval => INTERVAL '1 second');
409-
alter_job
410-
----------------------------------------------------------------------------------------------------------------------------------------------------------------
411-
(1001,"@ 1 sec","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""hypertable_id"": 2}",-infinity,_timescaledb_functions.policy_retention_check,f,,)
409+
alter_job
410+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
411+
(1001,"@ 1 sec","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""hypertable_id"": 2}",-infinity,_timescaledb_functions.policy_retention_check,f,,,"Retention Policy [1001]")
412412
(1 row)
413413

414414
SELECT * FROM timescaledb_information.jobs WHERE job_id=:drop_chunks_job_id;
@@ -619,16 +619,16 @@ SELECT add_retention_policy('test_drop_chunks_table_tsntz', INTERVAL '4 months')
619619
-- Test that retention policy is being logged
620620
SELECT alter_job(id,config:=jsonb_set(config,'{verbose_log}', 'true'))
621621
FROM _timescaledb_config.bgw_job WHERE id = :drop_chunks_date_job_id;
622-
alter_job
623-
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
624-
(1002,"@ 1 day","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""verbose_log"": true, ""hypertable_id"": 3}",-infinity,_timescaledb_functions.policy_retention_check,f,,)
622+
alter_job
623+
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
624+
(1002,"@ 1 day","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""verbose_log"": true, ""hypertable_id"": 3}",-infinity,_timescaledb_functions.policy_retention_check,f,,,"Retention Policy [1002]")
625625
(1 row)
626626

627627
SELECT alter_job(id,config:=jsonb_set(config,'{verbose_log}', 'true'))
628628
FROM _timescaledb_config.bgw_job WHERE id = :drop_chunks_tsntz_job_id;
629-
alter_job
630-
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
631-
(1003,"@ 1 day","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""verbose_log"": true, ""hypertable_id"": 4}",-infinity,_timescaledb_functions.policy_retention_check,f,,)
629+
alter_job
630+
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
631+
(1003,"@ 1 day","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""verbose_log"": true, ""hypertable_id"": 4}",-infinity,_timescaledb_functions.policy_retention_check,f,,,"Retention Policy [1003]")
632632
(1 row)
633633

634634
SELECT ts_bgw_db_scheduler_test_run_and_wait_for_scheduler_finish(1000);

tsl/test/expected/cagg_bgw-17.out

+6-6
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ SELECT ts_bgw_params_reset_time((extract(epoch from interval '12 hour')::bigint
250250

251251
--alter the refresh interval and check if next_start is altered
252252
SELECT alter_job(:job_id, schedule_interval => '1m', retry_period => '1m');
253-
alter_job
254-
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
255-
(1000,"@ 1 min","@ 0",-1,"@ 1 min",t,"{""end_offset"": 4, ""start_offset"": null, ""mat_hypertable_id"": 2}","Sat Jan 01 04:01:00 2000 PST",_timescaledb_functions.policy_refresh_continuous_aggregate_check,f,,)
253+
alter_job
254+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
255+
(1000,"@ 1 min","@ 0",-1,"@ 1 min",t,"{""end_offset"": 4, ""start_offset"": null, ""mat_hypertable_id"": 2}","Sat Jan 01 04:01:00 2000 PST",_timescaledb_functions.policy_refresh_continuous_aggregate_check,f,,,"Refresh Continuous Aggregate Policy [1000]")
256256
(1 row)
257257

258258
SELECT job_id, next_start - last_finish as until_next, total_runs
@@ -290,9 +290,9 @@ SELECT (next_start - '30s'::interval) AS "NEW_NEXT_START"
290290
FROM _timescaledb_internal.bgw_job_stat
291291
WHERE job_id=:job_id \gset
292292
SELECT alter_job(:job_id, next_start => :'NEW_NEXT_START');
293-
alter_job
294-
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
295-
(1000,"@ 1 min","@ 0",-1,"@ 1 min",t,"{""end_offset"": 4, ""start_offset"": null, ""mat_hypertable_id"": 2}","Sat Jan 01 04:02:30 2000 PST",_timescaledb_functions.policy_refresh_continuous_aggregate_check,f,,)
293+
alter_job
294+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
295+
(1000,"@ 1 min","@ 0",-1,"@ 1 min",t,"{""end_offset"": 4, ""start_offset"": null, ""mat_hypertable_id"": 2}","Sat Jan 01 04:02:30 2000 PST",_timescaledb_functions.policy_refresh_continuous_aggregate_check,f,,,"Refresh Continuous Aggregate Policy [1000]")
296296
(1 row)
297297

298298
SELECT ts_bgw_params_reset_time((extract(epoch from interval '12 hour')::bigint * 1000000)+(extract(epoch from interval '2 minute 30 seconds')::bigint * 1000000), true);

tsl/test/expected/cagg_bgw_drop_chunks.out

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ WHERE hypertable_name = '_materialized_hypertable_2' ORDER BY range_start_intege
9797

9898
SELECT add_retention_policy( 'drop_chunks_view1', drop_after => 10) as drop_chunks_job_id1 \gset
9999
SELECT alter_job(:drop_chunks_job_id1, schedule_interval => INTERVAL '1 second');
100-
alter_job
101-
------------------------------------------------------------------------------------------------------------------------------------------------------
102-
(1000,"@ 1 sec","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": 10, ""hypertable_id"": 2}",-infinity,_timescaledb_functions.policy_retention_check,f,,)
100+
alter_job
101+
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
102+
(1000,"@ 1 sec","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": 10, ""hypertable_id"": 2}",-infinity,_timescaledb_functions.policy_retention_check,f,,,"Retention Policy [1000]")
103103
(1 row)
104104

105105
SELECT ts_bgw_db_scheduler_test_run_and_wait_for_scheduler_finish(2000000);

tsl/test/expected/cagg_usage-17.out

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ SELECT schedule_interval FROM _timescaledb_config.bgw_job WHERE id = 1000;
102102

103103
-- You can change this setting with ALTER VIEW (equivalently, specify in WITH clause of CREATE VIEW)
104104
SELECT alter_job(1000, schedule_interval := '1h');
105-
alter_job
106-
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
107-
(1000,"@ 1 hour","@ 0",-1,"@ 2 hours",t,"{""end_offset"": ""@ 2 hours"", ""start_offset"": null, ""mat_hypertable_id"": 2}",-infinity,_timescaledb_functions.policy_refresh_continuous_aggregate_check,f,,)
105+
alter_job
106+
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
107+
(1000,"@ 1 hour","@ 0",-1,"@ 2 hours",t,"{""end_offset"": ""@ 2 hours"", ""start_offset"": null, ""mat_hypertable_id"": 2}",-infinity,_timescaledb_functions.policy_refresh_continuous_aggregate_check,f,,,"Refresh Continuous Aggregate Policy [1000]")
108108
(1 row)
109109

110110
SELECT schedule_interval FROM _timescaledb_config.bgw_job WHERE id = 1000;

tsl/test/expected/compress_bgw_reorder_drop_chunks.out

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ SELECT count(*) FROM _timescaledb_config.bgw_job WHERE proc_schema = '_timescale
8181
(1 row)
8282

8383
SELECT alter_job(:retention_job_id, schedule_interval => INTERVAL '1 second');
84-
alter_job
85-
----------------------------------------------------------------------------------------------------------------------------------------------------------------
86-
(1000,"@ 1 sec","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""hypertable_id"": 1}",-infinity,_timescaledb_functions.policy_retention_check,f,,)
84+
alter_job
85+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
86+
(1000,"@ 1 sec","@ 5 mins",-1,"@ 5 mins",t,"{""drop_after"": ""@ 4 mons"", ""hypertable_id"": 1}",-infinity,_timescaledb_functions.policy_retention_check,f,,,"Retention Policy [1000]")
8787
(1 row)
8888

8989
SELECT * FROM _timescaledb_config.bgw_job where id=:retention_job_id;

0 commit comments

Comments
 (0)