Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a70505

Browse files
committed
add more sanity checks to pathman_bgw tests
1 parent 0faf90f commit 9a70505

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

expected/pathman_bgw.out

+6-2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ DECLARE
187187
i int4 := 0; -- protect from endless loop
188188
BEGIN
189189
LOOP
190+
-- get total number of processed rows
190191
SELECT processed
191192
FROM pathman_concurrent_part_tasks
192193
WHERE relid = 'test_bgw.conc_part'::regclass
@@ -200,9 +201,12 @@ BEGIN
200201

201202
ASSERT rows IS NOT NULL;
202203

203-
-- rows should increase!
204-
IF rows_old <= rows THEN
204+
IF rows_old = rows THEN
205205
i = i + 1;
206+
ELSIF rows < rows_old THEN
207+
RAISE EXCEPTION 'rows is decreasing: new %, old %', rows, rows_old;
208+
ELSIF rows > 500 THEN
209+
RAISE EXCEPTION 'processed % rows', rows;
206210
END IF;
207211
ELSE
208212
EXIT; -- exit loop

sql/pathman_bgw.sql

+6-2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ DECLARE
101101
i int4 := 0; -- protect from endless loop
102102
BEGIN
103103
LOOP
104+
-- get total number of processed rows
104105
SELECT processed
105106
FROM pathman_concurrent_part_tasks
106107
WHERE relid = 'test_bgw.conc_part'::regclass
@@ -114,9 +115,12 @@ BEGIN
114115

115116
ASSERT rows IS NOT NULL;
116117

117-
-- rows should increase!
118-
IF rows_old <= rows THEN
118+
IF rows_old = rows THEN
119119
i = i + 1;
120+
ELSIF rows < rows_old THEN
121+
RAISE EXCEPTION 'rows is decreasing: new %, old %', rows, rows_old;
122+
ELSIF rows > 500 THEN
123+
RAISE EXCEPTION 'processed % rows', rows;
120124
END IF;
121125
ELSE
122126
EXIT; -- exit loop

0 commit comments

Comments
 (0)