Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't locate object method "message" via package "NO at t/lib/DBIEngineTest.pm... #858

Open
eserte opened this issue Jan 8, 2025 · 2 comments · May be fixed by #860
Open

Can't locate object method "message" via package "NO at t/lib/DBIEngineTest.pm... #858

eserte opened this issue Jan 8, 2025 · 2 comments · May be fixed by #860
Assignees
Labels

Comments

@eserte
Copy link

eserte commented Jan 8, 2025

t/firebird.t fails on some of my smokers like this:

...
t/exasol.t .......... ok
    # No tests run!

#   Failed test 'No tests run for subtest "live database"'
#   at t/lib/DBIEngineTest.pm line 1826.
Can't locate object method "message" via package "NO at t/lib/DBIEngineTest.pm line 91.\n" (perhaps you forgot to load "NO at t/lib/DBIEngineTest.pm line 91.\n"?) at t/lib/DBIEngineTest.pm line 97.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 104.
t/firebird.t ........ 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/104 subtests 
t/help.t ............ ok
...
@eserte
Copy link
Author

eserte commented Jan 8, 2025

t/exasol.t may also fail with a similar "Can't locate object method" failure:

#   Failed test 'No tests run for subtest "live database"'
#   at t/lib/DBIEngineTest.pm line 1826.
Can't locate object method "message" via package "Can't connect to data source 'dbname=password@localhost/dbadmin' because I can't work out what driver to use (it doesn't seem to"..."river to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at t/exasol.t line 423.\n" (perhaps you forgot to load "Can't connect to data source 'dbname=password@localhost/dbadmin' because I can't work out what driver to use (it doesn't seem to"..."river to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at t/exasol.t line 423.\n"?) at t/lib/DBIEngineTest.pm line 97.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 97.
t/exasol.t .......... 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/97 subtests 

@theory
Copy link
Collaborator

theory commented Jan 9, 2025

I tweaked things in v1.5.0 to "always" raise an exception, but it seems I missed some. There trick is to figure out what bits are dying without raising an exception. Given the exasol error, it seems like you have DBD::ODBC but Sqitch isn't passing dbi:ODBC, and DBI->connect I guess doesn't use the HandleError param there. As for Firebird, well the skip_unless is doing more than usual there.

Does this patch fix these issues?

--- a/t/exasol.t
+++ b/t/exasol.t
@@ -414,7 +414,7 @@ END {
 $uri = URI->new(
     $ENV{SQITCH_TEST_EXASOL_URI} ||
     $ENV{EXA_URI} ||
-    'db:dbadmin:password@localhost/dbadmin'
+    'db:exasol://dbadmin:password@localhost/dbadmin'
 );
 my $err;
 for my $i (1..30) {
--- a/t/firebird.t
+++ b/t/firebird.t
@@ -31,7 +31,7 @@ my $uri;
 my $tmpdir;
 my $have_fb_driver = 1; # assume DBD::Firebird is installed and so is Firebird
 
-# Is DBD::Firebird realy installed?
+# Is DBD::Firebird really installed?
 try { require DBD::Firebird; } catch { $have_fb_driver = 0; };
 
 BEGIN {
@@ -472,11 +472,13 @@ DBIEngineTest->run(
         # DBD::Firebird.
         my $cmd = $self->client;
         my $cmd_echo = qx(echo "quit;" | "$cmd" -z -quiet 2>&1 );
-        return 0 unless $cmd_echo =~ m{Firebird}ims;
+        App::Sqitch::X::hurl('isql not for Firebird')
+             unless $cmd_echo =~ m{Firebird}ims;
         chomp $cmd_echo;
         say "# Detected $cmd_echo";
         # Skip if no DBD::Firebird.
-        return 0 unless $have_fb_driver;
+        App::Sqitch::X::hurl('DBD::Firebird did not load')
+            unless $have_fb_driver;
         say "# Connected to Firebird $fb_version" if $fb_version;
         return 1;
     },
--- a/t/lib/DBIEngineTest.pm
+++ b/t/lib/DBIEngineTest.pm
@@ -88,7 +88,7 @@ sub run {
         );
         if (my $code = $p{skip_unless}) {
             try {
-                $code->( $engine ) || die 'NO';
+                $code->( $engine ) || App::Sqitch::X::hurl('NO');
             } catch {
                 plan skip_all => sprintf(
                     'Unable to live-test %s engine: %s',

Thanks, as ever, for your QA diligence, @eserte, I very much appreciate it!

@theory theory added the bug label Jan 9, 2025
@theory theory self-assigned this Jan 9, 2025
theory added a commit that referenced this issue Jan 15, 2025
Plug a few more holes in the expectation that Sqitch always raises
App::Sqitch::X objects rather than strings, as discovered by some
unanticipated test configurations (resolves #858). Also fix a couple of
typos and the default URI for Exasol tests.
@theory theory linked a pull request Jan 15, 2025 that will close this issue
theory added a commit that referenced this issue Jan 15, 2025
Plug a few more holes in the expectation that Sqitch always raises
App::Sqitch::X objects rather than strings, as discovered by some
unanticipated test configurations (resolves #858). Also fix a couple of
typos and the default URI for Exasol tests.
theory added a commit that referenced this issue Jan 18, 2025
Plug a few more holes in the expectation that Sqitch always raises
App::Sqitch::X objects rather than strings, as discovered by some
unanticipated test configurations (resolves #858). Also fix a couple of
typos and the default URI for Exasol tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants