X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fpsgi-log.t;h=e010d076c39d3fc06f4a21da1bde13f0a37e49c7;hb=6e8520be0c895f96e8e28f724ba73ba70ea4fac6;hp=ce52babd619705982c117b62449e9d1d73ce0513;hpb=2d5279cd7e404e0c4f6d4fc985414f8d0cd9022b;p=catagits%2FCatalyst-Runtime.git diff --git a/t/psgi-log.t b/t/psgi-log.t index ce52bab..e010d07 100644 --- a/t/psgi-log.t +++ b/t/psgi-log.t @@ -1,3 +1,20 @@ +=head1 PROBLEM + +In https://github.com/plack/Plack/commit/cafa5db84921f020183a9c834fd6a4541e5a6b84 +chansen made a change to the FCGI handler in Plack, in which he replaced +STDERR, STDOUT and STDIN with proper IO::Handle objects. + +The side effect of that change is that catalyst outputing logs on STDERR will +no longer end up by default in the error log of the webserver when running +under FCGI. This test tries to make sure we use the propper parts of the psgi +environment when we output things from Catalyst::Log. + +There is one more "regression", and that is warnings. By using +Catalyst::Plugin::LogWarnings, you also get those in the right place if this +test passes :) + +=cut + use strict; use warnings; no warnings 'once'; @@ -29,8 +46,8 @@ use HTTP::Request::Common; no Moose; } - -subtest "psgi.errors" => sub{ +#subtest "psgi.errors" => sub +{ my $handle = MockHandle->new(); my $app = builder { @@ -52,12 +69,13 @@ subtest "psgi.errors" => sub{ my $cb = shift; my $res = $cb->(GET "/log/debug"); my @logs = $handle->logs; - is(scalar(@logs), 1, "one event output"); - like($logs[0], qr/debug$/, "event matches test data"); + is(scalar(@logs), 1, "psgi.errors: one event output"); + like($logs[0], qr/debug$/, "psgi.errors: event matches test data"); }; }; -subtest "psgix.logger" => sub { +#subtest "psgix.logger" => sub +{ my @logs; my $logger = sub { @@ -78,8 +96,8 @@ subtest "psgix.logger" => sub { test_psgi $app, sub { my $cb = shift; my $res = $cb->(GET "/log/debug"); - is(scalar(@logs), 1, "one event logged"); - is_deeply($logs[0], { level => 'debug', message => "debug" }, "right stuff"); + is(scalar(@logs), 1, "psgix.logger: one event logged"); + is_deeply($logs[0], { level => 'debug', message => "debug" }, "psgix.logger: right stuff"); }; };