Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 47b75b0

Browse files
committed
[PGPRO-9334] Enable isolation tests
Tags: pg_pathman
1 parent 9283ab7 commit 47b75b0

File tree

4 files changed

+28
-49
lines changed

4 files changed

+28
-49
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.deps
2-
isolation_output
32
results/*
43
regression.diffs
54
regression.out

Makefile

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ REGRESS = pathman_array_qual \
6464
pathman_views \
6565
pathman_CVE-2020-14350
6666

67+
ISOLATION = insert_nodes for_update rollback_on_create_partitions
6768

68-
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
69+
REGRESS_OPTS = --temp-config $(top_srcdir)/$(subdir)/conf.add
70+
ISOLATION_OPTS = --temp-config $(top_srcdir)/$(subdir)/conf.add
6971

7072
CMOCKA_EXTRA_CLEAN = missing_basic.o missing_list.o missing_stringinfo.o missing_bitmapset.o rangeset_tests.o rangeset_tests
71-
EXTRA_CLEAN = ./isolation_output $(patsubst %,tests/cmocka/%, $(CMOCKA_EXTRA_CLEAN))
73+
EXTRA_CLEAN = $(patsubst %,tests/cmocka/%, $(CMOCKA_EXTRA_CLEAN))
7274

7375
ifdef USE_PGXS
7476
PG_CONFIG=pg_config
@@ -83,6 +85,14 @@ OBJS += src/declarative.o
8385
override PG_CPPFLAGS += -DENABLE_DECLARATIVE
8486
endif
8587

88+
# We cannot run isolation test for versions 12,13 in PGXS case
89+
# because 'pg_isolation_regress' is not copied to install
90+
# directory, see src/test/isolation/Makefile
91+
ifeq ($(VNUM),$(filter 12% 13%,$(VNUM)))
92+
undefine ISOLATION
93+
undefine ISOLATION_OPTS
94+
endif
95+
8696
include $(PGXS)
8797
else
8898
subdir = contrib/pg_pathman
@@ -94,18 +104,6 @@ endif
94104
$(EXTENSION)--$(EXTVERSION).sql: init.sql hash.sql range.sql
95105
cat $^ > $@
96106

97-
ISOLATIONCHECKS=insert_nodes for_update rollback_on_create_partitions
98-
99-
submake-isolation:
100-
$(MAKE) -C $(top_builddir)/src/test/isolation all
101-
102-
isolationcheck: | submake-isolation temp-install
103-
$(MKDIR_P) isolation_output
104-
$(pg_isolation_regress_check) \
105-
--temp-config=$(top_srcdir)/$(subdir)/conf.add \
106-
--outputdir=./isolation_output \
107-
$(ISOLATIONCHECKS)
108-
109107
python_tests:
110108
$(MAKE) -C tests/python partitioning_tests CASE=$(CASE)
111109

expected/insert_nodes.out

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,26 @@ step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
1111
step s1r: ROLLBACK;
1212
step s1_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
1313
ON c.conrelid = i.inhrelid
14-
WHERE i.inhparent = 'range_rel'::regclass
14+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
1515
ORDER BY c.oid;
1616
pg_get_constraintdef
1717
------------------------------------
18-
PRIMARY KEY (id)
1918
CHECK (((id >= 1) AND (id < 101)))
20-
PRIMARY KEY (id)
2119
CHECK (((id >= 101) AND (id < 201)))
22-
(4 rows)
20+
(2 rows)
2321

2422
step s2b: BEGIN;
2523
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
2624
step s2c: COMMIT;
2725
step s2_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
2826
ON c.conrelid = i.inhrelid
29-
WHERE i.inhparent = 'range_rel'::regclass
27+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
3028
ORDER BY c.oid;
3129
pg_get_constraintdef
3230
------------------------------------
33-
PRIMARY KEY (id)
3431
CHECK (((id >= 1) AND (id < 101)))
35-
PRIMARY KEY (id)
3632
CHECK (((id >= 101) AND (id < 201)))
37-
(4 rows)
33+
(2 rows)
3834

3935

4036
starting permutation: s1b s1_insert_150 s1r s1_show_partitions s2b s2_insert_300 s2c s2_show_partitions
@@ -48,32 +44,27 @@ step s1_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
4844
step s1r: ROLLBACK;
4945
step s1_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
5046
ON c.conrelid = i.inhrelid
51-
WHERE i.inhparent = 'range_rel'::regclass
47+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
5248
ORDER BY c.oid;
5349
pg_get_constraintdef
5450
------------------------------------
55-
PRIMARY KEY (id)
5651
CHECK (((id >= 1) AND (id < 101)))
57-
PRIMARY KEY (id)
5852
CHECK (((id >= 101) AND (id < 201)))
59-
(4 rows)
53+
(2 rows)
6054

6155
step s2b: BEGIN;
6256
step s2_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
6357
step s2c: COMMIT;
6458
step s2_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
6559
ON c.conrelid = i.inhrelid
66-
WHERE i.inhparent = 'range_rel'::regclass
60+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
6761
ORDER BY c.oid;
6862
pg_get_constraintdef
6963
------------------------------------
70-
PRIMARY KEY (id)
7164
CHECK (((id >= 1) AND (id < 101)))
72-
PRIMARY KEY (id)
7365
CHECK (((id >= 101) AND (id < 201)))
74-
PRIMARY KEY (id)
7566
CHECK (((id >= 201) AND (id < 301)))
76-
(6 rows)
67+
(3 rows)
7768

7869

7970
starting permutation: s1b s1_insert_300 s1r s1_show_partitions s2b s2_insert_150 s2c s2_show_partitions
@@ -87,34 +78,28 @@ step s1_insert_300: INSERT INTO range_rel SELECT generate_series(151, 300);
8778
step s1r: ROLLBACK;
8879
step s1_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
8980
ON c.conrelid = i.inhrelid
90-
WHERE i.inhparent = 'range_rel'::regclass
81+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
9182
ORDER BY c.oid;
9283
pg_get_constraintdef
9384
------------------------------------
94-
PRIMARY KEY (id)
9585
CHECK (((id >= 1) AND (id < 101)))
96-
PRIMARY KEY (id)
9786
CHECK (((id >= 101) AND (id < 201)))
98-
PRIMARY KEY (id)
9987
CHECK (((id >= 201) AND (id < 301)))
100-
(6 rows)
88+
(3 rows)
10189

10290
step s2b: BEGIN;
10391
step s2_insert_150: INSERT INTO range_rel SELECT generate_series(1, 150);
10492
step s2c: COMMIT;
10593
step s2_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
10694
ON c.conrelid = i.inhrelid
107-
WHERE i.inhparent = 'range_rel'::regclass
95+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
10896
ORDER BY c.oid;
10997
pg_get_constraintdef
11098
------------------------------------
111-
PRIMARY KEY (id)
11299
CHECK (((id >= 1) AND (id < 101)))
113-
PRIMARY KEY (id)
114100
CHECK (((id >= 101) AND (id < 201)))
115-
PRIMARY KEY (id)
116101
CHECK (((id >= 201) AND (id < 301)))
117-
(6 rows)
102+
(3 rows)
118103

119104

120105
starting permutation: s1b s1_insert_150 s2b s2_insert_300 s1r s2r s2_show_partitions
@@ -131,15 +116,12 @@ step s1r: ROLLBACK;
131116
step s2r: ROLLBACK;
132117
step s2_show_partitions: SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
133118
ON c.conrelid = i.inhrelid
134-
WHERE i.inhparent = 'range_rel'::regclass
119+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
135120
ORDER BY c.oid;
136121
pg_get_constraintdef
137122
------------------------------------
138-
PRIMARY KEY (id)
139123
CHECK (((id >= 1) AND (id < 101)))
140-
PRIMARY KEY (id)
141124
CHECK (((id >= 101) AND (id < 201)))
142-
PRIMARY KEY (id)
143125
CHECK (((id >= 201) AND (id < 301)))
144-
(6 rows)
126+
(3 rows)
145127

specs/insert_nodes.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ step "s1_insert_150" { INSERT INTO range_rel SELECT generate_series(1, 150);
1919
step "s1_insert_300" { INSERT INTO range_rel SELECT generate_series(151, 300); }
2020
step "s1_show_partitions" { SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
2121
ON c.conrelid = i.inhrelid
22-
WHERE i.inhparent = 'range_rel'::regclass
22+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
2323
ORDER BY c.oid; }
2424
step "s1r" { ROLLBACK; }
2525

@@ -29,7 +29,7 @@ step "s2_insert_150" { INSERT INTO range_rel SELECT generate_series(1, 150);
2929
step "s2_insert_300" { INSERT INTO range_rel SELECT generate_series(151, 300); }
3030
step "s2_show_partitions" { SELECT pg_get_constraintdef(c.oid) FROM pg_inherits i LEFT JOIN pg_constraint c
3131
ON c.conrelid = i.inhrelid
32-
WHERE i.inhparent = 'range_rel'::regclass
32+
WHERE i.inhparent = 'range_rel'::regclass AND c.contype = 'c'
3333
ORDER BY c.oid; }
3434
step "s2r" { ROLLBACK; }
3535
step "s2c" { COMMIT; }

0 commit comments

Comments
 (0)