Repository navigation
Failure with latst D2/D2::P::DBIC #8
Description
Activity
The actual fail-case is:
rabbit@Ahasver:~/devel/GADS$ git rev-parse HEAD e42be1115566d453210f655be33f21a98600d6f4 rabbit@Ahasver:~/devel/GADS$ prove -I /home/rabbit/devel/sqlt/lib -lr t/001_base.t t/001_base.t .. 1/1 # Failed test 'use GADS;' # at t/001_base.t line 5. # Tried to use 'GADS'. # Error: Specific subroutines cannot be exported from plugin at /home/rabbit/devel/GADS/lib/GADS.pm line 72. # BEGIN failed--compilation aborted at /home/rabbit/devel/GADS/lib/GADS.pm line 72. # Compilation failed in require at t/001_base.t line 5. # BEGIN failed--compilation aborted at t/001_base.t line 5. # Looks like you failed 1 test of 1. t/001_base.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests Test Summary Report ------------------- t/001_base.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=1, Tests=1, 1 wallclock secs ( 0.03 usr 0.00 sys + 1.41 cusr 0.07 csys = 1.51 CPU) Result: FAILThanks @ribasushi , absolutely correct. Fixed in 7399819.
Hm... master still fails tests for me with the above fix included. Latest D2, Moo, and whatever plugins you list in Makefile.PL:
rabbit@Ahasver:~/devel/GADS$ prove -I /home/rabbit/devel/sqlt/lib -l t/001_base.t t/001_base.t .. No Auth::Extensible realms configured with which to authenticate user at /home/rabbit/perl5/perlbrew/perls/5.16.2/lib/site_perl/5.16.2/Dancer2/Plugin/Auth/Extensible.pm line 1188. Array found where operator expected at /home/rabbit/devel/GADS/lib/GADS.pm line 86, at end of line (Missing operator before ?) String found where operator expected at /home/rabbit/devel/GADS/lib/GADS.pm line 1367, near "__"An email address must be specified for the new user"" String found where operator expected at /home/rabbit/devel/GADS/lib/GADS.pm line 1371, near "__"Please enter a valid email address for the new user"" String found where operator expected at /home/rabbit/devel/GADS/lib/GADS.pm line 1764, near "__"You do not have permission to create a child record"" t/001_base.t .. 1/1 # Failed test 'use GADS;' # at t/001_base.t line 5. # Tried to use 'GADS'. # Error: syntax error at /home/rabbit/devel/GADS/lib/GADS.pm line 86, near "panic @_" # syntax error at /home/rabbit/devel/GADS/lib/GADS.pm line 1367, near "__"An email address must be specified for the new user"" # syntax error at /home/rabbit/devel/GADS/lib/GADS.pm line 1371, near "__"Please enter a valid email address for the new user"" # syntax error at /home/rabbit/devel/GADS/lib/GADS.pm line 1695, near "process sub " # Global symbol "$to_write" requires explicit package name at /home/rabbit/devel/GADS/lib/GADS.pm line 1695. # syntax error at /home/rabbit/devel/GADS/lib/GADS.pm line 1695, near ") }" # Global symbol "$failed" requires explicit package name at /home/rabbit/devel/GADS/lib/GADS.pm line 1697. # syntax error at /home/rabbit/devel/GADS/lib/GADS.pm line 1699, near "}" # Global symbol "$record" requires explicit package name at /home/rabbit/devel/GADS/lib/GADS.pm line 1701. # Global symbol "$failed" requires explicit package name at /home/rabbit/devel/GADS/lib/GADS.pm line 1702. # Global symbol "$failed" requires explicit package name at /home/rabbit/devel/GADS/lib/GADS.pm line 1705. # /home/rabbit/devel/GADS/lib/GADS.pm has too many errors. # Compilation failed in require at t/001_base.t line 5. # BEGIN failed--compilation aborted at t/001_base.t line 5. # Looks like you failed 1 test of 1. t/001_base.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtestsThat looks like the
Log::Reportfunctions haven't been imported properly. Is that definitely the latest version? The latest version of D2 will require the latest version ofLog::Report(not sure how to make that a dependency failure, maybe I should just bump the version in GADS).Bah, indeed wasn't latest Log::Report. Sorry for the noise.
As far as "how to" - yes, generally requiring both latest D2 and latest L::R in your GADS Makefile.PL is the easiest way forward. That is unless you have a reason to work on older D2 versions (which is rarely the case for end-user-app level stuff).I will keep my "older but clearly passing Makefile.PL" inc around for when you get a moment to update your Makefile.PL, will retest then
Confirmed - on a fresh 5.24.0 (with an empty @inc), after nudging some of the deps with
cpanm -n(due to their own broken tests), your own tests decidedly fail with "all newest" as such:./t/001_base.t ............ No Auth::Extensible realms configured with which to authenticate user at /home/rabbit/perl5/perlbrew/perls/5.24.0/lib/site_perl/5.24.0/Dancer2/Plugin/Auth/Extensible.pm line 185. Plugin DSL method 'hook' is deprecated. Use '$self->app->add_hook' instead'. at /home/rabbit/devel/GADS/lib/GADS.pm line 74. Plugin DSL method 'hook' is deprecated. Use '$self->app->add_hook' instead'. at /home/rabbit/devel/GADS/lib/GADS.pm line 74. ./t/001_base.t ............ 1/1 # Failed test 'use GADS;' # at ./t/001_base.t line 5. # Tried to use 'GADS'. # Error: No schemas are configured at /home/rabbit/perl5/perlbrew/perls/5.24.0/lib/site_perl/5.24.0/DBICx/Sugar.pm line 46. # Compilation failed in require at ./t/001_base.t line 5. # BEGIN failed--compilation aborted at ./t/001_base.t line 5. # Looks like you failed 1 test of 1. ./t/001_base.t ............ Dubious, test returned 1 (wstat 256, 0x100)Thanks for the bug report. It turns out that I always had a valid
config.ymlin my app directory structure, so that's why the tests never failed for me.I've worked out how to place a test
config.ymland read it from the tests that are failing. However, I also need to do a$schema->deployasGADSassumes a deployed database is available (I realise I can hack that, but as I add tests I will need a deployed schema anyway).So, question: in
t/002_index_route.tI now have:BEGIN { $ENV{DANCER_CONFDIR} = 't/lib'; $ENV{DANCER_ENVIRONMENT} = 'config'; } use Dancer2; use Dancer2::Plugin::DBIC; schema->deploy; use GADS; use Test::More tests => 2; use Plack::Test; my $app = GADS->to_app; is( ref $app, 'CODE', 'Got app' ); my $test = Plack::Test->create($app); my $res = $test->request( GET '/' ); ok( $res->is_success, '[GET /] successful' );How can I pass the schema object into
$app? The problem is that the database for the tests is adbi:SQLite:dbname=:memory:, so when it's initially deployed above, the app that is then created does not know about it.I will look into this later today, will get back to you. Reopen the ticket if you don't mind - less chance I forget about it.
Thanks, reopened.
As far as "how to" - yes, generally requiring both latest D2 and latest L::R in your GADS Makefile.PL is the easiest way forward.
Thanks, that's what I've done in 006c4a8.
How can I pass the schema object into $app?
@abeverley did the above ever get sorted? Or didn't have a chance to look yet?
How can I pass the schema object into $app?
@abeverley did the above ever get sorted? Or didn't have a chance to
look yet?I did have a quick look at it, but I really couldn't see any way of
doing what I want. Within the app, everything is instantiated from new- that includes the DBIC object/plugin and associated memory database.
I can't see any way of passing in an existing one.
Unless there's an easy solution, I'll probably bypass the test or put
in a hacky workaround, as the test is fairly minor compared to the rest
of the tests.- that includes the DBIC object/plugin and associated memory database.
( I really hope this is not another red herring this time, please double check my oneliner before doing anything else)
During last test passes I upgraded my deps, and it seems this line is no longer valid:
Here is the complete version list: