On Fri Nov 29 03:52:11 2013, jeppe@ioslo.net wrote:
Show quoted text> All the other tests skip when we don't have a database connection, but
> t/rt83494-quotes-comments.t doesn't check this.
For 4.025 Patrick added the below commit to git:
basically it aborts all testing if connecting to the database fails with $DBI::err == 1045 -- this is when login fails due to bad username or password.
but if there is no server on localhost, or if the server is stopped, there is no $DBI::err == 1045 so the 'old' behaviour applies which means all tests are skipped, as mentioned, all tests except the quotes-comments test.
There also is a side-effect. In the previous situation, before bailout was called the tests were SKIPPED which means that the tests still exited 'succesful'. Currently, if bailout is called, the tests are considered failed and it will not install your module.
I'd propose remove the bailout because of this reason, and add the skip part to the quotes text. @Patrick: do you agree?
--
Mike
https://github.com/perl5-dbi/DBD-mysql/commit/580d8de9f78166635ed758716d0b5605097645a0
commit 580d8de9f78166635ed758716d0b5605097645a0
Author: Patrick Galbraith <patg@patg.net>
Date: Fri Oct 25 03:39:56 2013 -0400
Bail if connect fails early on, per suggestion RT31823
diff --git a/t/10connect.t b/t/10connect.t
index d63d192..9c08e05 100644
--- a/t/10connect.t
+++ b/t/10connect.t
@@ -15,9 +15,12 @@ require 'lib.pl';
my $dbh;
eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password,
{ RaiseError => 1, PrintError => 1, AutoCommit => 0 });};
-
if ($@) {
- plan skip_all => "ERROR: $DBI::errstr Can't continue test";
+ #
https://rt.cpan.org/Ticket/Display.html?id=31823
+ if ($DBI::err == 1045) {
+ Test::More::BAIL_OUT("ERROR: $DBI::errstr\nAborting remaining tests!");
+ }
+ plan skip_all => "ERROR: $DBI::errstr $DBI::err Can't continue test";
}
plan tests => 2;