Commit c086681c authored by Arnaud Fontaine's avatar Arnaud Fontaine

runUnitTest: ZODB is removed on '--save', so also recreate the Catalog tables installed by bt5s.

Assuming that the test database already exists and 'movement' table already
contains data, on '--save' before this commit:
  1. Create a new ERP5 Site:
     1. Install erp5_mysql_innodb_catalog.
     2. Call ERP5Site_reindexAll(clear_catalog=True) (from ERP5Generator.setupIndex()).
        => At this point, erp5_mysql_innodb_catalog tables are recreated.
  2. Install erp5_movement_table_catalog or any bt5 adding a new SQL table.
     => This does not recreate the table and leave the existing data as it is.
  3. Dump MySQL database to dump.sql.
  => dump.sql contains 'INSERT INTO' for 'movement' table *before* calling runUnitTest command.

This fixes random Unit Tests failures on SQL queries accessing 'movement'
table directly and getting {non-existing,past executions} Movements.
parent 1db19cd3
...@@ -82,9 +82,12 @@ if load: ...@@ -82,9 +82,12 @@ if load:
if not live_instance_path: if not live_instance_path:
backup_path = os.path.basename(backup_path) backup_path = os.path.basename(backup_path)
os.symlink(backup_path, full_path) os.symlink(backup_path, full_path)
elif save and not (neo_storage or zeo_client) and os.path.exists(data_fs_path): elif save:
if not (neo_storage or zeo_client) and os.path.exists(data_fs_path):
os.remove(data_fs_path) os.remove(data_fs_path)
os.environ['erp5_tests_recreate_catalog'] = '1'
for static_dir in static_dir_list: for static_dir in static_dir_list:
static_dir = os.path.join(instance_home, static_dir) static_dir = os.path.join(instance_home, static_dir)
if not os.path.exists(static_dir): if not os.path.exists(static_dir):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment