test: drop template DB when something goes wrong during creation

Fixes #951.
This commit is contained in:
Sarah Hoffmann
2018-04-08 10:06:33 +02:00
parent b4ef3d91ab
commit 28ee59dd64

View File

@@ -86,6 +86,7 @@ class NominatimEnvironment(object):
# just in case... make sure a previous table has been dropped # just in case... make sure a previous table has been dropped
self.db_drop_database(self.template_db) self.db_drop_database(self.template_db)
try:
# call the first part of database setup # call the first part of database setup
self.write_nominatim_config(self.template_db) self.write_nominatim_config(self.template_db)
self.run_setup_script('create-db', 'setup-db') self.run_setup_script('create-db', 'setup-db')
@@ -113,6 +114,10 @@ class NominatimEnvironment(object):
'create-search-indices', 'create-search-indices',
osm_file=fd.name, osm_file=fd.name,
osm2pgsql_cache='200') osm2pgsql_cache='200')
except:
self.db_drop_database(self.template_db)
raise
def setup_api_db(self, context): def setup_api_db(self, context):
self.write_nominatim_config(self.api_test_db) self.write_nominatim_config(self.api_test_db)