Skip to content

Commit 682c628

Browse files
authored
Merge pull request #2070 from joto/test-expire-z0
Always test with empty grids in append tests, test expire on zoom level 0
2 parents 34d5265 + 1199f90 commit 682c628

File tree

11 files changed

+246
-43
lines changed

11 files changed

+246
-43
lines changed

tests/bdd/flex/expire.feature

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
Feature: Changes on way with expire on zoom 0
2+
3+
Background:
4+
Given the style file 'test_expire.lua'
5+
6+
And the 0.1 grid
7+
| 11 | 13 |
8+
| 10 | 12 |
9+
10+
And the OSM data
11+
"""
12+
w11 v1 dV Tt1=yes Nn12,n13
13+
"""
14+
When running osm2pgsql flex with parameters
15+
| --slim |
16+
17+
Then table osm2pgsql_test_t1 contains exactly
18+
| way_id |
19+
| 11 |
20+
Then table osm2pgsql_test_expire contains exactly
21+
| zoom | x | y |
22+
23+
24+
Scenario: way is not relevant
25+
Given the OSM data
26+
"""
27+
w10 v1 dV Ta=b Nn10,n11
28+
"""
29+
And an empty grid
30+
31+
When running osm2pgsql flex with parameters
32+
| --slim | -a |
33+
34+
Then table osm2pgsql_test_t1 contains exactly
35+
| way_id |
36+
| 11 |
37+
Then table osm2pgsql_test_expire contains exactly
38+
| zoom | x | y |
39+
40+
41+
Scenario: node is not relevant
42+
Given the OSM data
43+
"""
44+
n1 v2 dV x1 y2
45+
"""
46+
And an empty grid
47+
48+
When running osm2pgsql flex with parameters
49+
| --slim | -a |
50+
51+
Then table osm2pgsql_test_t1 contains exactly
52+
| way_id |
53+
| 11 |
54+
Then table osm2pgsql_test_expire contains exactly
55+
| zoom | x | y |
56+
57+
58+
Scenario: add to t1
59+
Given the OSM data
60+
"""
61+
w10 v1 dV Tt1=yes Nn10,n11
62+
"""
63+
And an empty grid
64+
65+
When running osm2pgsql flex with parameters
66+
| --slim | -a |
67+
68+
Then table osm2pgsql_test_t1 contains exactly
69+
| way_id |
70+
| 10 |
71+
| 11 |
72+
Then table osm2pgsql_test_expire contains exactly
73+
| zoom | x | y |
74+
| 0 | 0 | 0 |
75+
76+
77+
Scenario: change in t1
78+
Given the OSM data
79+
"""
80+
w11 v2 dV Ta=b Nn10,n11
81+
"""
82+
And an empty grid
83+
84+
When running osm2pgsql flex with parameters
85+
| --slim | -a |
86+
87+
Then table osm2pgsql_test_t1 contains exactly
88+
| way_id |
89+
Then table osm2pgsql_test_expire contains exactly
90+
| zoom | x | y |
91+
| 0 | 0 | 0 |
92+
93+
94+
Scenario: remove from t1
95+
Given the OSM data
96+
"""
97+
w11 v2 dD
98+
"""
99+
And an empty grid
100+
101+
When running osm2pgsql flex with parameters
102+
| --slim | -a |
103+
104+
Then table osm2pgsql_test_t1 contains exactly
105+
| way_id |
106+
Then table osm2pgsql_test_expire contains exactly
107+
| zoom | x | y |
108+
| 0 | 0 | 0 |

tests/bdd/flex/lua-expire.feature

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,26 @@ Feature: Expire configuration in Lua file
238238
Then table nodes has 1562 rows
239239
And table tiles has 0 rows
240240

241+
Scenario: Expire into table without maxzoom means maxzoom 0
242+
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
243+
And the lua style
244+
"""
245+
local eo = osm2pgsql.define_expire_output({
246+
table = 'tiles',
247+
})
248+
local t = osm2pgsql.define_node_table('nodes', {
249+
{ column = 'geom',
250+
type = 'point',
251+
expire = {
252+
{ output = eo }
253+
}}
254+
})
255+
256+
function osm2pgsql.process_node(object)
257+
t:insert({ geom = object:as_point() })
258+
end
259+
"""
260+
When running osm2pgsql flex
261+
Then table nodes has 1562 rows
262+
And table tiles has 0 rows
263+

tests/bdd/flex/relation-changes.feature

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Feature: Handling changes to relations
3232
| --slim |
3333
Then table osm2pgsql_test_relations has 0 rows
3434

35-
Given the OSM data
35+
Given an empty grid
36+
And the OSM data
3637
"""
3738
r30 v2 dV Ttype=multipolygon Mw20@,w21@
3839
"""
@@ -55,7 +56,8 @@ Feature: Handling changes to relations
5556
| --slim |
5657
Then table osm2pgsql_test_relations has 0 rows
5758

58-
Given the OSM data
59+
Given an empty grid
60+
And the OSM data
5961
"""
6062
w21 v2 dV Nn12,n13,n10
6163
"""
@@ -77,7 +79,8 @@ Feature: Handling changes to relations
7779
| --slim |
7880
Then table osm2pgsql_test_relations has 0 rows
7981

80-
Given the OSM data
82+
Given an empty grid
83+
And the OSM data
8184
"""
8285
n12 v2 dV x10.1 y10.1
8386
"""
@@ -100,7 +103,8 @@ Feature: Handling changes to relations
100103
| --slim |
101104
Then table osm2pgsql_test_relations has 0 rows
102105

103-
Given the OSM data
106+
Given an empty grid
107+
And the OSM data
104108
"""
105109
r30 v2 dV Ttype=multipolygon Mw20@,w21@
106110
"""
@@ -123,7 +127,8 @@ Feature: Handling changes to relations
123127
| --slim |
124128
Then table osm2pgsql_test_relations has 1 row
125129

126-
Given the OSM data
130+
Given an empty grid
131+
And the OSM data
127132
"""
128133
r30 v2 dV Mw20@,w21@
129134
"""
@@ -146,7 +151,8 @@ Feature: Handling changes to relations
146151
| --slim |
147152
Then table osm2pgsql_test_relations has 1 row
148153

149-
Given the OSM data
154+
Given an empty grid
155+
And the OSM data
150156
"""
151157
w21 v2 dV <new nodelist>
152158
"""
@@ -174,7 +180,8 @@ Feature: Handling changes to relations
174180
| --slim |
175181
Then table osm2pgsql_test_relations has 1 row
176182

177-
Given the OSM data
183+
Given an empty grid
184+
And the OSM data
178185
"""
179186
n12 v2 dV <new coordinates>
180187
"""
@@ -202,7 +209,8 @@ Feature: Handling changes to relations
202209
| --slim |
203210
Then table osm2pgsql_test_relations has 1 row
204211

205-
Given the OSM data
212+
Given an empty grid
213+
And the OSM data
206214
"""
207215
r30 v2 dV Ttype=multipolygon <new memberlist>
208216
"""
@@ -232,7 +240,8 @@ Feature: Handling changes to relations
232240
| area_id | tags->'natural' | tags->'landuse' |
233241
| -30 | wood | NULL |
234242

235-
Given the OSM data
243+
Given an empty grid
244+
And the OSM data
236245
"""
237246
r30 v2 dV Ttype=multipolygon,landuse=forest Mw20@,w21@
238247
"""

tests/bdd/flex/way-add.feature

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Feature: Adding ways to a flex database
3131

3232

3333
Scenario: way is not relevant
34-
Given the OSM data
34+
Given an empty grid
35+
And the OSM data
3536
"""
3637
w10 v1 dV Tt=ag Nn10,n11
3738
r30 v2 dV Tt=ag Mw10@,w11@,w12@mark,w13@,w14@mark
@@ -52,7 +53,8 @@ Feature: Adding ways to a flex database
5253

5354

5455
Scenario: add to t1
55-
Given the OSM data
56+
Given an empty grid
57+
And the OSM data
5658
"""
5759
w10 v1 dV Tt1=yes Nn10,n11
5860
r30 v2 dV Tt=ag Mw10@,w11@,w12@mark,w13@,w14@mark
@@ -74,7 +76,8 @@ Feature: Adding ways to a flex database
7476

7577

7678
Scenario: add to t2
77-
Given the OSM data
79+
Given an empty grid
80+
And the OSM data
7881
"""
7982
w10 v1 dV Tt2=yes Nn10,n11
8083
r30 v2 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
@@ -96,7 +99,8 @@ Feature: Adding ways to a flex database
9699

97100

98101
Scenario: add to t1 and t2
99-
Given the OSM data
102+
Given an empty grid
103+
And the OSM data
100104
"""
101105
w10 v1 dV Tt1=yes,t2=yes Nn10,n11
102106
r30 v2 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark
@@ -119,7 +123,8 @@ Feature: Adding ways to a flex database
119123

120124

121125
Scenario: add to tboth (only stage1)
122-
Given the OSM data
126+
Given an empty grid
127+
And the OSM data
123128
"""
124129
w10 v1 dV Ttboth=yes Nn10,n11
125130
r30 v2 dV Tt=ag Mw10@,w11@,w12@mark,w13@,w14@mark
@@ -141,7 +146,8 @@ Feature: Adding ways to a flex database
141146

142147

143148
Scenario: add to tboth (stage1 and stage2)
144-
Given the OSM data
149+
Given an empty grid
150+
And the OSM data
145151
"""
146152
w10 v1 dV Ttboth=yes Nn10,n11
147153
r30 v2 dV Tt=ag Mw10@mark,w11@,w12@mark,w13@,w14@mark

tests/bdd/flex/way-change.feature

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Feature: Changing ways in a flex database
3131
| 13 |
3232
| 14 |
3333

34-
Given the OSM data
34+
Given an empty grid
35+
And the OSM data
3536
"""
3637
<input>
3738
"""
@@ -83,7 +84,8 @@ Feature: Changing ways in a flex database
8384
| 13 |
8485
| 14 |
8586

86-
Given the OSM data
87+
Given an empty grid
88+
And the OSM data
8789
"""
8890
<input>
8991
"""
@@ -136,7 +138,8 @@ Feature: Changing ways in a flex database
136138
| 13 |
137139
| 14 |
138140

139-
Given the OSM data
141+
Given an empty grid
142+
And the OSM data
140143
"""
141144
<input>
142145
"""
@@ -193,7 +196,8 @@ Feature: Changing ways in a flex database
193196
| 13 | NULL |
194197
| 14 | {30} |
195198

196-
Given the OSM data
199+
Given an empty grid
200+
And the OSM data
197201
"""
198202
<input>
199203
"""
@@ -239,7 +243,8 @@ Feature: Changing ways in a flex database
239243
| 13 | NULL |
240244
| 14 | {30} |
241245

242-
Given the OSM data
246+
Given an empty grid
247+
And the OSM data
243248
"""
244249
w10 v2 dV Tt1=yes,t2=yes,tboth=yes Nn10,n11
245250
"""

0 commit comments

Comments
 (0)