]> git.openstreetmap.org Git - nominatim.git/commitdiff
bdd: extend osm2pgsql update tests
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 8 Nov 2022 13:06:18 +0000 (14:06 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 10 Nov 2022 08:38:25 +0000 (09:38 +0100)
Now also checks for correct indexing state of placex table.

test/bdd/osm2pgsql/update/simple.feature
test/bdd/osm2pgsql/update/tags.feature

index 072f83fa4e98d4c86a939fa9bfb937cb3b231ebf..5a86917c3036c95278fbce44934750eef9fce8aa 100644 (file)
@@ -2,60 +2,48 @@
 Feature: Update of simple objects by osm2pgsql
     Testing basic update functions of osm2pgsql.
 
-    Scenario: Import object with two main tags
+    Scenario: Adding a new object
         When loading osm data
           """
-          n1 Ttourism=hotel,amenity=restaurant,name=foo
-          n2 Tplace=locality,name=spotty
+          n1 Tplace=town,name=Middletown
           """
-        Then place contains
-          | object     | type       | name+name |
-          | N1:tourism | hotel      | foo |
-          | N1:amenity | restaurant | foo |
-          | N2:place   | locality   | spotty |
-        When updating osm data
-          """
-          n1 dV Ttourism=hotel,name=foo
-          n2 dD
-          """
-        Then place has no entry for N1:amenity
-        And place has no entry for N2
-        And place contains
-          | object     | class   | type       | name |
-          | N1:tourism | tourism | hotel      | 'name' : 'foo' |
+        Then place contains exactly
+          | object   | type | name+name  |
+          | N1:place | town | Middletown |
+
+       When updating osm data
+         """
+         n2 Tamenity=hotel,name=Posthotel
+         """
+        Then place contains exactly
+          | object     | type  | name+name  |
+          | N1:place   | town  | Middletown |
+          | N2:amenity | hotel | Posthotel  |
+        And placex contains exactly
+          | object     | type  | name+name  | indexed_status |
+          | N1:place   | town  | Middletown | 0              |
+          | N2:amenity | hotel | Posthotel  | 1              |
 
-    Scenario: Downgrading a highway to one that is dropped without name
-        When loading osm data
-          """
-          n100 x0 y0
-          n101 x0.0001 y0.0001
-          w1 Thighway=residential Nn100,n101
-          """
-        Then place contains
-          | object     |
-          | W1:highway |
-        When updating osm data
-          """
-          w1 Thighway=service Nn100,n101
-          """
-        Then place has no entry for W1
 
-    Scenario: Downgrading a highway when a second tag is present
+    Scenario: Deleting an existing object
         When loading osm data
           """
-          n100 x0 y0
-          n101 x0.0001 y0.0001
-          w1 Thighway=residential,tourism=hotel Nn100,n101
-          """
-        Then place contains
-          | object     |
-          | W1:highway |
-          | W1:tourism |
-        When updating osm data
+          n1 Tplace=town,name=Middletown
+          n2 Tamenity=hotel,name=Posthotel
           """
-          w1 Thighway=service,tourism=hotel Nn100,n101
-          """
-        Then place has no entry for W1:highway
-        And place contains
-          | object     |
-          | W1:tourism |
+        Then place contains exactly
+          | object     | type  | name+name  |
+          | N1:place   | town  | Middletown |
+          | N2:amenity | hotel | Posthotel  |
+
+       When updating osm data
+         """
+         n2 dD
+         """
+        Then place contains exactly
+          | object     | type  | name+name  |
+          | N1:place   | town  | Middletown |
+        And placex contains exactly
+          | object     | type  | name+name  | indexed_status |
+          | N1:place   | town  | Middletown | 0              |
+          | N2:amenity | hotel | Posthotel  | 100            |
index 0b6c2a624bda27ce2438d207b9c476ba3ed66e14..bfd3c54696b366420529f29418e2a5c15a3c83b2 100644 (file)
@@ -26,6 +26,12 @@ Feature: Tag evaluation
             | object     | class   | type       |
             | N2:highway | highway | bus_stop   |
             | N3         | amenity | prison     |
+        And placex contains exactly
+            | object     | indexed_status |
+            | N1:amenity | 100            |
+            | N2:highway | 2              |
+            | N2:railway | 100            |
+            | N3:amenity | 0              |
 
 
     Scenario: Main tag added
@@ -48,6 +54,11 @@ Feature: Tag evaluation
             | N1         | amenity | restaurant |
             | N2:highway | highway | bus_stop   |
             | N2:railway | railway | stop       |
+        And placex contains exactly
+            | object     | indexed_status |
+            | N1:amenity | 1              |
+            | N2:highway | 2              |
+            | N2:railway | 1              |
 
 
     Scenario: Main tag modified
@@ -70,6 +81,10 @@ Feature: Tag evaluation
             | object | class   | type    |
             | N10    | highway | path    |
             | N11    | highway | primary |
+        And placex contains
+            | object      | indexed_status |
+            | N11:amenity | 100            |
+            | N11:highway | 1              |
 
 
     Scenario: Main tags with name, name added
@@ -90,6 +105,10 @@ Feature: Tag evaluation
             | object | class   | type    |
             | N45    | landuse | cemetry |
             | N46    | building| yes     |
+        And placex contains exactly
+            | object       | indexed_status |
+            | N45:landuse  | 1              |
+            | N46:building | 1              |
 
 
     Scenario: Main tags with name, name removed
@@ -110,6 +129,10 @@ Feature: Tag evaluation
             """
         Then place contains exactly
             | object | class   | type    |
+        And placex contains exactly
+            | object       | indexed_status |
+            | N45:landuse  | 100            |
+            | N46:building | 100            |
 
 
     Scenario: Main tags with name, name modified
@@ -132,6 +155,10 @@ Feature: Tag evaluation
             | object | class   | type    | name            | address            |
             | N45    | landuse | cemetry | 'name' : 'DONE' | -                  |
             | N46    | building| yes     | -               | 'housenumber': '10'|
+        And placex contains exactly
+            | object       | indexed_status |
+            | N45:landuse  | 2              |
+            | N46:building | 2              |
 
 
     Scenario: Main tag added to address only node
@@ -150,6 +177,10 @@ Feature: Tag evaluation
         Then place contains exactly
             | object | class    | type  | address |
             | N1     | building | yes   | 'housenumber': '345'|
+        And placex contains exactly
+            | object       | indexed_status |
+            | N1:place     | 100            |
+            | N1:building  | 1              |
 
 
     Scenario: Main tag removed from address only node
@@ -168,6 +199,10 @@ Feature: Tag evaluation
         Then place contains exactly
             | object | class | type  | address |
             | N1     | place | house | 'housenumber': '345'|
+        And placex contains exactly
+            | object       | indexed_status |
+            | N1:place     | 1              |
+            | N1:building  | 100            |
 
 
     Scenario: Main tags with name key, adding key name
@@ -185,6 +220,9 @@ Feature: Tag evaluation
         Then place contains exactly
             | object | class    | type  | name           |
             | N22    | bridge   | yes   | 'name': 'high' |
+        And placex contains exactly
+            | object       | indexed_status |
+            | N22:bridge   | 1              |
 
 
     Scenario: Main tags with name key, deleting key name
@@ -202,6 +240,9 @@ Feature: Tag evaluation
             """
         Then place contains exactly
             | object | class    | type  |
+        And placex contains exactly
+            | object       | indexed_status |
+            | N22:bridge   | 100            |
 
 
     Scenario: Main tags with name key, changing key name
@@ -220,4 +261,103 @@ Feature: Tag evaluation
         Then place contains exactly
             | object | class    | type  | name           |
             | N22    | bridge   | yes   | 'name:en': 'high' |
+        And placex contains exactly
+            | object       | indexed_status |
+            | N22:bridge   | 2              |
 
+
+    Scenario: Downgrading a highway to one that is dropped without name
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0.0001 y0.0001
+          w1 Thighway=residential Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+          | W1:highway |
+
+        When updating osm data
+          """
+          w1 Thighway=service Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+        And placex contains exactly
+          | object     | indexed_status |
+          | W1:highway | 100            |
+
+
+    Scenario: Upgrading a highway to one that is not dropped without name
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0.0001 y0.0001
+          w1 Thighway=service Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+
+        When updating osm data
+          """
+          w1 Thighway=unclassified Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+          | W1:highway |
+        And placex contains exactly
+          | object     | indexed_status |
+          | W1:highway | 1              |
+
+
+    Scenario: Downgrading a highway when a second tag is present
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0.0001 y0.0001
+          w1 Thighway=residential,tourism=hotel Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+          | W1:highway |
+          | W1:tourism |
+
+        When updating osm data
+          """
+          w1 Thighway=service,tourism=hotel Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+          | W1:tourism |
+        And placex contains exactly
+          | object     |
+          | W1:tourism |
+          | W1:highway |
+        And placex contains
+          | object     | indexed_status |
+          | W1:highway | 100            |
+
+
+    Scenario: Upgrading a highway when a second tag is present
+        When loading osm data
+          """
+          n100 x0 y0
+          n101 x0.0001 y0.0001
+          w1 Thighway=service,tourism=hotel Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+          | W1:tourism |
+
+        When updating osm data
+          """
+          w1 Thighway=residential,tourism=hotel Nn100,n101
+          """
+        Then place contains exactly
+          | object     |
+          | W1:highway |
+          | W1:tourism |
+        And placex contains exactly
+          | object     | indexed_status |
+          | W1:tourism | 2              |
+          | W1:highway | 1              |