[Koha-patches] [PATCH] testing framework: adding more warnings about possible data loss

Andrew Moore andrew.moore at liblime.com
Tue Apr 22 16:00:42 CEST 2008


I'm adding some more warnings in Makefile.PL to indicate that you WILL lose the data
in your testing database.

I've also relaxed the requirement that the teting database have "test" in its name.
---
 Makefile.PL       |   12 +++++++++++-
 t/lib/KohaTest.pm |   25 -------------------------
 2 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 3a05922..7f04cb7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1065,9 +1065,19 @@ Would you like to run the database-dependent test suite?);
   if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) {
       $config{'TEST_DB_TYPE'} = $config{'DB_TYPE'};
       $config{'TEST_DB_HOST'} = $config{'DB_HOST'};
-      $msg = q(
+      $msg = q(TEST DATABASE
+
+THE DATA IN THIS DATABASE WILL BE DESTROYED during the process of
+testing. Please don't do this on your production database. It is not
+reversable.
+
+YOU WILL SUFFER DATA LOSS if you run this test suite on your test
+database. You are better off not running this optional test suite than
+doing it in a database that you don't want to lose.
+
 Please specify the name of the test database to be
 used by Koha);
+      
     $config{'TEST_DB_NAME'} = _get_value('TEST_DB_NAME', $msg, $defaults->{'TEST_DB_NAME'}, $valid_values, $install_log_values);
 
       $msg = q(
diff --git a/t/lib/KohaTest.pm b/t/lib/KohaTest.pm
index 9286306..0a21b21 100644
--- a/t/lib/KohaTest.pm
+++ b/t/lib/KohaTest.pm
@@ -28,31 +28,6 @@ these are run once, at the beginning of the whole test suite
 
 =cut
 
-=head2 startup_10_prepare_database
-
-prepare a blank database.
-
-This ends up getting run once for each test module, so that's several
-times throughout the test suite. That may be too many times to refresh
-the database. We may have to tune that.
-
-=cut
-
-sub startup_10_prepare_database : Test(startup => 1) {
-    my $self = shift;
-    # this is how I'm refreshing my database for now.  I'll think of
-    # something better later.  Eventually, I'd like to drop the
-    # database entirely and use the regular install code to rebuild a
-    # base database.
-    my $class = ref $self;
-
-    # like( C4::Context->config( 'database '), qr/test$/, 'using test database: ' . C4::Context->config( 'database' ) )
-    like( C4::Context->database(), qr/test$/, 'using test database: ' . C4::Context->database() )
-      or BAIL_OUT( 'This appears to not be a test database.' );
-
-    return;
-}
-
 sub startup_15_truncate_tables : Test( startup => 1 ) {
     my $self = shift;
     
-- 
1.5.2.1




More information about the Koha-patches mailing list