From 1aaeee19a14e7ac5fb24ea5b8deb98626e37c6bb Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 11 Mar 2017 17:09:14 +0100 Subject: [PATCH] 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. --- test/bdd/steps/db_ops.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/bdd/steps/db_ops.py b/test/bdd/steps/db_ops.py index fa66cd4d..869cf829 100644 --- a/test/bdd/steps/db_ops.py +++ b/test/bdd/steps/db_ops.py @@ -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.*)") 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 exactly)?") def check_placex_contents(context, exact): -- 2.39.5