Test that no maxzoom setting works on you'll get expire on zoom 0

This commit is contained in:
Jochen Topf
2023-09-02 22:01:22 +02:00
parent 616d0159a6
commit 1199f90a04
3 changed files with 151 additions and 0 deletions

View File

@ -0,0 +1,108 @@
Feature: Changes on way with expire on zoom 0
Background:
Given the style file 'test_expire.lua'
And the 0.1 grid
| 11 | 13 |
| 10 | 12 |
And the OSM data
"""
w11 v1 dV Tt1=yes Nn12,n13
"""
When running osm2pgsql flex with parameters
| --slim |
Then table osm2pgsql_test_t1 contains exactly
| way_id |
| 11 |
Then table osm2pgsql_test_expire contains exactly
| zoom | x | y |
Scenario: way is not relevant
Given the OSM data
"""
w10 v1 dV Ta=b Nn10,n11
"""
And an empty grid
When running osm2pgsql flex with parameters
| --slim | -a |
Then table osm2pgsql_test_t1 contains exactly
| way_id |
| 11 |
Then table osm2pgsql_test_expire contains exactly
| zoom | x | y |
Scenario: node is not relevant
Given the OSM data
"""
n1 v2 dV x1 y2
"""
And an empty grid
When running osm2pgsql flex with parameters
| --slim | -a |
Then table osm2pgsql_test_t1 contains exactly
| way_id |
| 11 |
Then table osm2pgsql_test_expire contains exactly
| zoom | x | y |
Scenario: add to t1
Given the OSM data
"""
w10 v1 dV Tt1=yes Nn10,n11
"""
And an empty grid
When running osm2pgsql flex with parameters
| --slim | -a |
Then table osm2pgsql_test_t1 contains exactly
| way_id |
| 10 |
| 11 |
Then table osm2pgsql_test_expire contains exactly
| zoom | x | y |
| 0 | 0 | 0 |
Scenario: change in t1
Given the OSM data
"""
w11 v2 dV Ta=b Nn10,n11
"""
And an empty grid
When running osm2pgsql flex with parameters
| --slim | -a |
Then table osm2pgsql_test_t1 contains exactly
| way_id |
Then table osm2pgsql_test_expire contains exactly
| zoom | x | y |
| 0 | 0 | 0 |
Scenario: remove from t1
Given the OSM data
"""
w11 v2 dD
"""
And an empty grid
When running osm2pgsql flex with parameters
| --slim | -a |
Then table osm2pgsql_test_t1 contains exactly
| way_id |
Then table osm2pgsql_test_expire contains exactly
| zoom | x | y |
| 0 | 0 | 0 |

View File

@ -238,3 +238,26 @@ Feature: Expire configuration in Lua file
Then table nodes has 1562 rows
And table tiles has 0 rows
Scenario: Expire into table without maxzoom means maxzoom 0
Given the input file 'liechtenstein-2013-08-03.osm.pbf'
And the lua style
"""
local eo = osm2pgsql.define_expire_output({
table = 'tiles',
})
local t = osm2pgsql.define_node_table('nodes', {
{ column = 'geom',
type = 'point',
expire = {
{ output = eo }
}}
})
function osm2pgsql.process_node(object)
t:insert({ geom = object:as_point() })
end
"""
When running osm2pgsql flex
Then table nodes has 1562 rows
And table tiles has 0 rows

View File

@ -0,0 +1,20 @@
-- No maxzoom sets it to 0
local eo = osm2pgsql.define_expire_output({
table = 'osm2pgsql_test_expire',
})
local the_table = osm2pgsql.define_way_table('osm2pgsql_test_t1', {
{ column = 'tags', type = 'hstore' },
{ column = 'geom', type = 'linestring', expire = {{ output = eo }} },
})
function osm2pgsql.process_way(object)
if object.tags.t1 then
the_table:insert{
tags = object.tags,
geom = object:as_linestring()
}
end
end