From 45b90ceef1b73994f729275eae112870ff34cb64 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 22 Apr 2009 19:00:40 +0000 Subject: ensure we've got a clean data environment prior to running the region tests --- OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs | 41 +++++++++++++++++------------ 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs b/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs index 294a80e..e3f9413 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLRegionTest.cs @@ -53,6 +53,9 @@ namespace OpenSim.Data.MySQL.Tests try { database = new MySQLManager(connect); + // this is important in case a previous run ended badly + ClearDB(database); + db = new MySQLDataStore(); db.Initialise(connect); } @@ -70,24 +73,28 @@ namespace OpenSim.Data.MySQL.Tests { db.Dispose(); } - // if a new table is added, it has to be dropped here - if (database != null) + ClearDB(database); + } + + private void ClearDB(MySQLManager manager) + { + if (manager != null) { - database.ExecuteSql("drop table migrations"); - database.ExecuteSql("drop table prims"); - database.ExecuteSql("drop table primshapes"); - database.ExecuteSql("drop table primitems"); - database.ExecuteSql("drop table terrain"); - database.ExecuteSql("drop table land"); - database.ExecuteSql("drop table landaccesslist"); - database.ExecuteSql("drop table regionban"); - database.ExecuteSql("drop table regionsettings"); - database.ExecuteSql("drop table estate_managers"); - database.ExecuteSql("drop table estate_groups"); - database.ExecuteSql("drop table estate_users"); - database.ExecuteSql("drop table estateban"); - database.ExecuteSql("drop table estate_settings"); - database.ExecuteSql("drop table estate_map"); + manager.ExecuteSql("drop table migrations"); + manager.ExecuteSql("drop table prims"); + manager.ExecuteSql("drop table primshapes"); + manager.ExecuteSql("drop table primitems"); + manager.ExecuteSql("drop table terrain"); + manager.ExecuteSql("drop table land"); + manager.ExecuteSql("drop table landaccesslist"); + manager.ExecuteSql("drop table regionban"); + manager.ExecuteSql("drop table regionsettings"); + manager.ExecuteSql("drop table estate_managers"); + manager.ExecuteSql("drop table estate_groups"); + manager.ExecuteSql("drop table estate_users"); + manager.ExecuteSql("drop table estateban"); + manager.ExecuteSql("drop table estate_settings"); + manager.ExecuteSql("drop table estate_map"); } } } -- cgit v1.1