test: rerun indexing after updates until really all is done

There are caess where indexing needs to be done a second round
because related objects need to be updated.
This commit is contained in:
Sarah Hoffmann
2017-03-11 17:09:14 +01:00
parent 6153ad3b31
commit 1aaeee19a1

View File

@@ -243,7 +243,14 @@ def update_place_table(context):
col.db_insert(cur)
context.db.commit()
context.nominatim.run_update_script('index')
while True:
context.nominatim.run_update_script('index')
cur = context.db.cursor()
cur.execute("SELECT 'a' FROM placex WHERE indexed_status != 0 LIMIT 1")
if cur.rowcount == 0:
break
@when("marking for delete (?P<oids>.*)")
def delete_places(context, oids):
@@ -254,7 +261,14 @@ def delete_places(context, oids):
where, params = NominatimID(oid).table_select()
cur.execute("DELETE FROM place WHERE " + where, params)
context.db.commit()
context.nominatim.run_update_script('index')
while True:
context.nominatim.run_update_script('index')
cur = context.db.cursor()
cur.execute("SELECT 'a' FROM placex WHERE indexed_status != 0 LIMIT 1")
if cur.rowcount == 0:
break
@then("placex contains(?P<exact> exactly)?")
def check_placex_contents(context, exact):