Hello community, here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2016-12-05 16:30:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2016-11-11 14:31:46.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2016-12-05 16:30:01.000000000 +0100 @@ -1,0 +2,17 @@ +Thu Dec 1 06:51:27 UTC 2016 - [email protected] + +- updated to 7.11 + see /usr/share/doc/packages/perl-Mojolicious/Changes + + 7.11 2016-11-30 + - Added EXPERIMENTAL close_idle_connections method to Mojo::Server::Daemon. + - Improved one_tick method in Mojo::IOLoop to protect from recursion, similar + to the start method. + - Improved log attribute in Mojolicious to make it easier to override default + settings. (jberger) + - Fixed bug in Mojo::Server::Prefork where workers would accept keep-alive + requests after a graceful shutdown had already been initiated. + - Fixed bugs in Mojo::Util and Mojo::Asset::File where incomplete writes would + not be recognized as errors. (bobkare, sri) + +------------------------------------------------------------------- Old: ---- Mojolicious-7.10.tar.gz New: ---- Mojolicious-7.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious.spec ++++++ --- /var/tmp/diff_new_pack.2OqUIO/_old 2016-12-05 16:30:03.000000000 +0100 +++ /var/tmp/diff_new_pack.2OqUIO/_new 2016-12-05 16:30:03.000000000 +0100 @@ -17,7 +17,7 @@ Name: perl-Mojolicious -Version: 7.10 +Version: 7.11 Release: 0 %define cpan_name Mojolicious Summary: Real-time web framework ++++++ Mojolicious-7.10.tar.gz -> Mojolicious-7.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/Changes new/Mojolicious-7.11/Changes --- old/Mojolicious-7.10/Changes 2016-11-01 13:07:05.000000000 +0100 +++ new/Mojolicious-7.11/Changes 2016-11-30 00:24:18.000000000 +0100 @@ -1,4 +1,15 @@ +7.11 2016-11-30 + - Added EXPERIMENTAL close_idle_connections method to Mojo::Server::Daemon. + - Improved one_tick method in Mojo::IOLoop to protect from recursion, similar + to the start method. + - Improved log attribute in Mojolicious to make it easier to override default + settings. (jberger) + - Fixed bug in Mojo::Server::Prefork where workers would accept keep-alive + requests after a graceful shutdown had already been initiated. + - Fixed bugs in Mojo::Util and Mojo::Asset::File where incomplete writes would + not be recognized as errors. (bobkare, sri) + 7.10 2016-11-01 - Added getopt function to Mojo::Util. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/META.json new/Mojolicious-7.11/META.json --- old/Mojolicious-7.10/META.json 2016-11-01 20:01:02.000000000 +0100 +++ new/Mojolicious-7.11/META.json 2016-11-30 10:22:52.000000000 +0100 @@ -58,6 +58,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "7.10", + "version" : "7.11", "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/META.yml new/Mojolicious-7.11/META.yml --- old/Mojolicious-7.10/META.yml 2016-11-01 20:01:01.000000000 +0100 +++ new/Mojolicious-7.11/META.yml 2016-11-30 10:22:52.000000000 +0100 @@ -31,5 +31,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/mojo.git -version: '7.10' +version: '7.11' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Asset/File.pm new/Mojolicious-7.11/lib/Mojo/Asset/File.pm --- old/Mojolicious-7.10/lib/Mojo/Asset/File.pm 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/Asset/File.pm 2016-11-29 18:15:44.000000000 +0100 @@ -46,7 +46,8 @@ sub add_chunk { my ($self, $chunk) = @_; - defined $self->handle->syswrite($chunk) or croak "Can't write to asset: $!"; + ($self->handle->syswrite($chunk) // -1) == length $chunk + or croak "Can't write to asset: $!"; return $self; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/IOLoop.pm new/Mojolicious-7.11/lib/Mojo/IOLoop.pm --- old/Mojolicious-7.10/lib/Mojo/IOLoop.pm 2016-09-23 14:34:21.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/IOLoop.pm 2016-11-29 18:30:36.000000000 +0100 @@ -81,7 +81,11 @@ return $self->reactor->next_tick(sub { $self->$cb }); } -sub one_tick { _instance(shift)->reactor->one_tick } +sub one_tick { + my $self = _instance(shift); + croak 'Mojo::IOLoop already running' if $self->is_running; + $self->reactor->one_tick; +} sub recurring { shift->_timer(recurring => @_) } @@ -333,7 +337,8 @@ shutting down gracefully without interrupting existing connections, defaults to C<0>. Setting the value to C<0> will allow this event loop to accept new connections indefinitely. Note that up to half of this value can be subtracted -randomly to improve load balancing between multiple server processes. +randomly to improve load balancing between multiple server processes, and to +make sure that not all of them restart at the same time. =head2 max_connections @@ -482,8 +487,7 @@ Mojo::IOLoop->one_tick; $loop->one_tick; -Run event loop until an event occurs. Note that this method can recurse back -into the reactor, so you need to be careful. +Run event loop until an event occurs. # Don't block longer than 0.5 seconds my $id = Mojo::IOLoop->timer(0.5 => sub {}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Reactor/EV.pm new/Mojolicious-7.11/lib/Mojo/Reactor/EV.pm --- old/Mojolicious-7.10/lib/Mojo/Reactor/EV.pm 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/Reactor/EV.pm 2016-11-07 23:29:54.000000000 +0100 @@ -144,8 +144,7 @@ $reactor->one_tick; -Run reactor until an event occurs or no events are being watched anymore. Note -that this method can recurse back into the reactor, so you need to be careful. +Run reactor until an event occurs or no events are being watched anymore. # Don't block longer than 0.5 seconds my $id = $reactor->timer(0.5 => sub {}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Reactor/Poll.pm new/Mojolicious-7.11/lib/Mojo/Reactor/Poll.pm --- old/Mojolicious-7.10/lib/Mojo/Reactor/Poll.pm 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/Reactor/Poll.pm 2016-11-07 23:29:38.000000000 +0100 @@ -232,8 +232,7 @@ $reactor->one_tick; -Run reactor until an event occurs or no events are being watched anymore. Note -that this method can recurse back into the reactor, so you need to be careful. +Run reactor until an event occurs or no events are being watched anymore. # Don't block longer than 0.5 seconds my $id = $reactor->timer(0.5 => sub {}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Server/Daemon.pm new/Mojolicious-7.11/lib/Mojo/Server/Daemon.pm --- old/Mojolicious-7.10/lib/Mojo/Server/Daemon.pm 2016-08-27 04:08:11.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/Server/Daemon.pm 2016-11-29 17:34:10.000000000 +0100 @@ -25,6 +25,13 @@ $loop->remove($_) for keys %{$self->{connections} || {}}, @{$self->acceptors}; } +sub close_idle_connections { + my $self = shift; + my $c = $self->{connections}; + my $loop = $self->ioloop; + !$c->{$_}{tx} and $c->{$_}{requests} and $loop->remove($_) for keys %$c; +} + sub run { my $self = shift; @@ -455,6 +462,13 @@ L<Mojo::Server::Daemon> inherits all methods from L<Mojo::Server> and implements the following new ones. +=head2 close_idle_connections + + $daemon->close_idle_connections; + +Close all connections without active requests. Note that this method is +EXPERIMENTAL and might change without warning! + =head2 run $daemon->run; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Server/Hypnotoad.pm new/Mojolicious-7.11/lib/Mojo/Server/Hypnotoad.pm --- old/Mojolicious-7.10/lib/Mojo/Server/Hypnotoad.pm 2016-08-01 02:01:37.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/Server/Hypnotoad.pm 2016-11-29 18:37:34.000000000 +0100 @@ -8,7 +8,7 @@ use File::Basename 'dirname'; use File::Spec::Functions 'catfile'; use Mojo::Server::Prefork; -use Mojo::Util qw(steady_time); +use Mojo::Util 'steady_time'; use Scalar::Util 'weaken'; has prefork => sub { Mojo::Server::Prefork->new(listen => ['http://*:8080']) }; @@ -254,7 +254,8 @@ gracefully and then getting replaced with a newly started worker, defaults to the value of L<Mojo::Server::Prefork/"accepts">. Setting the value to C<0> will allow workers to accept new connections indefinitely. Note that up to half of -this value can be subtracted randomly to improve load balancing. +this value can be subtracted randomly to improve load balancing, and to make +sure that not all workers restart at the same time. =head2 backlog @@ -280,7 +281,9 @@ Maximum amount of time in seconds stopping a worker gracefully may take before being forced, defaults to the value of -L<Mojo::Server::Prefork/"graceful_timeout">. +L<Mojo::Server::Prefork/"graceful_timeout">. Note that this value should usually +be a little larger than the maximum amount of time you expect any one request to +take. =head2 heartbeat_interval @@ -295,7 +298,9 @@ Maximum amount of time in seconds before a worker without a heartbeat will be stopped gracefully, defaults to the value of -L<Mojo::Server::Prefork/"heartbeat_timeout">. +L<Mojo::Server::Prefork/"heartbeat_timeout">. Note that this value should +usually be a little larger than the maximum amount of time you expect any one +operation to block the event loop. =head2 inactivity_timeout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Server/Prefork.pm new/Mojolicious-7.11/lib/Mojo/Server/Prefork.pm --- old/Mojolicious-7.10/lib/Mojo/Server/Prefork.pm 2016-08-01 02:02:21.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojo/Server/Prefork.pm 2016-11-29 18:31:37.000000000 +0100 @@ -148,6 +148,7 @@ # Clean worker environment $SIG{$_} = 'DEFAULT' for qw(CHLD INT TERM TTIN TTOU); $SIG{QUIT} = sub { $loop->stop_gracefully }; + $loop->on(finish => sub { $self->max_requests(1)->close_idle_connections }); delete $self->{reader}; srand; @@ -357,7 +358,8 @@ gracefully and then getting replaced with a newly started worker, passed along to L<Mojo::IOLoop/"max_accepts">, defaults to C<10000>. Setting the value to C<0> will allow workers to accept new connections indefinitely. Note that up to -half of this value can be subtracted randomly to improve load balancing. +half of this value can be subtracted randomly to improve load balancing, and to +make sure that not all workers restart at the same time. =head2 cleanup @@ -373,7 +375,8 @@ $prefork = $prefork->graceful_timeout(15); Maximum amount of time in seconds stopping a worker gracefully may take before -being forced, defaults to C<20>. +being forced, defaults to C<20>. Note that this value should usually be a little +larger than the maximum amount of time you expect any one request to take. =head2 heartbeat_interval @@ -388,7 +391,9 @@ $prefork = $prefork->heartbeat_timeout(2); Maximum amount of time in seconds before a worker without a heartbeat will be -stopped gracefully, defaults to C<20>. +stopped gracefully, defaults to C<20>. Note that this value should usually be a +little larger than the maximum amount of time you expect any one operation to +block the event loop. =head2 pid_file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojo/Util.pm new/Mojolicious-7.11/lib/Mojo/Util.pm --- old/Mojolicious-7.10/lib/Mojo/Util.pm 2016-11-01 18:19:36.000000000 +0100 +++ new/Mojolicious-7.11/lib/Mojo/Util.pm 2016-11-29 18:15:48.000000000 +0100 @@ -269,7 +269,7 @@ sub spurt { my ($content, $path) = @_; open my $file, '>', $path or croak qq{Can't open file "$path": $!}; - defined $file->syswrite($content) + ($file->syswrite($content) // -1) == length $content or croak qq{Can't write to file "$path": $!}; return $content; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojolicious/Guides/Cookbook.pod new/Mojolicious-7.11/lib/Mojolicious/Guides/Cookbook.pod --- old/Mojolicious-7.10/lib/Mojolicious/Guides/Cookbook.pod 2016-09-23 15:20:47.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojolicious/Guides/Cookbook.pod 2016-11-25 15:11:21.000000000 +0100 @@ -249,8 +249,7 @@ <VirtualHost *:80> ServerName localhost <Proxy *> - Order deny,allow - Allow from all + Require all granted </Proxy> ProxyRequests Off ProxyPreserveHost On diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/lib/Mojolicious.pm new/Mojolicious-7.11/lib/Mojolicious.pm --- old/Mojolicious-7.10/lib/Mojolicious.pm 2016-10-23 11:46:45.000000000 +0200 +++ new/Mojolicious-7.11/lib/Mojolicious.pm 2016-11-30 00:23:06.000000000 +0100 @@ -4,6 +4,7 @@ # "Fry: Shut up and take my money!" use Carp (); use Mojo::Exception; +use Mojo::Log; use Mojo::Util; use Mojolicious::Commands; use Mojolicious::Controller; @@ -23,6 +24,19 @@ return $commands; }; has controller_class => 'Mojolicious::Controller'; +has log => sub { + my $self = shift; + + # Check if we have a log directory that is writable + my $log = Mojo::Log->new; + my $home = $self->home; + my $mode = $self->mode; + $log->path($home->rel_file("log/$mode.log")) + if -d $home->rel_file('log') && -w _; + + # Reduced log output outside of development mode + return $mode eq 'development' ? $log : $log->level('info'); +}; has mode => sub { $ENV{MOJO_MODE} || $ENV{PLACK_ENV} || 'development' }; has moniker => sub { Mojo::Util::decamelize ref shift }; has plugins => sub { Mojolicious::Plugins->new }; @@ -43,7 +57,7 @@ has validator => sub { Mojolicious::Validator->new }; our $CODENAME = 'Doughnut'; -our $VERSION = '7.10'; +our $VERSION = '7.11'; sub AUTOLOAD { my $self = shift; @@ -151,20 +165,12 @@ $r->hide(qw(rendered req res respond_to send session signed_cookie stash)); $r->hide(qw(tx url_for validation write write_chunk)); - # Check if we have a log directory that is writable - my $mode = $self->mode; - $self->log->path($home->rel_file("log/$mode.log")) - if -d $home->rel_file('log') && -w _; - $self->plugin($_) for qw(HeaderCondition DefaultHelpers TagHelpers EPLRenderer EPRenderer); # Exception handling should be first in chain $self->hook(around_dispatch => \&_exception); - # Reduced log output outside of development mode - $self->log->level('info') unless $mode eq 'development'; - $self->startup; return $self; @@ -393,16 +399,26 @@ L<Mojolicious::Controller>. Note that this class needs to have already been loaded before the first request arrives. +=head2 log + + my $log = $app->log; + $app = $app->log(Mojo::Log->new); + +The logging layer of your application, defaults to a L<Mojo::Log> object. The +level will default to C<debug> if the L</mode> is C<development>, or C<info> +otherwise. All messages will be written to C<STDERR>, or a C<log/$mode.log> file +if a C<log> directory exists. + + # Log debug message + $app->log->debug('It works'); + =head2 mode my $mode = $app->mode; $app = $app->mode('production'); The operating mode for your application, defaults to a value from the -C<MOJO_MODE> and C<PLACK_ENV> environment variables or C<development>. Right -before calling L</"startup">, L<Mojolicious> will pick up the current mode, -name the log file after it and raise the log level from C<debug> to C<info> if -it has a value other than C<development>. +C<MOJO_MODE> and C<PLACK_ENV> environment variables or C<development>. =head2 moniker @@ -634,10 +650,9 @@ my $app = Mojolicious->new({moniker => 'foo_bar'}); Construct a new L<Mojolicious> application and call L</"startup">. Will -automatically detect your home directory and set up logging based on your -current operating mode. Also sets up the renderer, static file server, a -default set of plugins and an L</"around_dispatch"> hook with the default -exception handling. +automatically detect your home directory. Also sets up the renderer, static file +server, a default set of plugins and an L</"around_dispatch"> hook with the +default exception handling. =head2 plugin @@ -915,6 +930,8 @@ Klaus S. Madsen +Knut Arne Bjorndal + Lars Balker Rasmussen Lee Johnson diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/t/mojo/asset.t new/Mojolicious-7.11/t/mojo/asset.t --- old/Mojolicious-7.10/t/mojo/asset.t 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.11/t/mojo/asset.t 2016-11-29 18:15:39.000000000 +0100 @@ -238,6 +238,14 @@ unlink $path; ok !-e $path, 'file has been cleaned up'; +# Incomplete write +{ + no warnings 'redefine'; + local *IO::Handle::syswrite = sub { $! = 0; 2 }; + eval { Mojo::Asset::File->new->add_chunk('test') }; + like $@, qr/Can't write to asset: .*/, 'right error'; +} + # Abstract methods eval { Mojo::Asset->add_chunk }; like $@, qr/Method "add_chunk" not implemented by subclass/, 'right error'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/t/mojo/hypnotoad.t new/Mojolicious-7.11/t/mojo/hypnotoad.t --- old/Mojolicious-7.10/t/mojo/hypnotoad.t 2016-11-01 13:25:01.000000000 +0100 +++ new/Mojolicious-7.11/t/mojo/hypnotoad.t 2016-11-29 17:34:01.000000000 +0100 @@ -61,6 +61,7 @@ my $port2 = Mojo::IOLoop::Server->generate_port; spurt <<EOF, $script; use Mojolicious::Lite; +use Mojo::IOLoop; app->log->path('$log'); @@ -77,6 +78,19 @@ get '/hello' => {text => 'Hello Hypnotoad!'}; +my \$graceful; +Mojo::IOLoop->singleton->on(finish => sub { \$graceful++ }); + +get '/graceful' => sub { + my \$c = shift; + my \$id; + \$id = Mojo::IOLoop->recurring(0 => sub { + return unless \$graceful; + \$c->render(text => 'Graceful shutdown!'); + Mojo::IOLoop->remove(\$id); + }); +}; + app->start; EOF @@ -130,6 +144,12 @@ EOF open my $hot_deploy, '-|', $^X, "$prefix/hypnotoad", $script; +# Wait for hot deployment to fail +while (1) { + last if slurp($log) =~ qr/Zero downtime software upgrade failed/; + sleep 1; +} + # Connection did not get lost $tx = $ua->get("http://127.0.0.1:$port1/hello"); ok $tx->is_finished, 'transaction is finished'; @@ -146,11 +166,10 @@ is $tx->res->code, 200, 'right status'; is $tx->res->body, 'Hello Hypnotoad!', 'right content'; -# Wait for hot deployment to fail -while (1) { - last if slurp($log) =~ qr/Zero downtime software upgrade failed/; - sleep 1; -} +# Request that will be served after graceful shutdown has been initiated +$tx = $ua->build_tx(GET => "http://127.0.0.1:$port1/graceful"); +$ua->start($tx => sub { }); +Mojo::IOLoop->one_tick until $tx->req->is_finished; # Update script spurt <<EOF, $script; @@ -172,31 +191,12 @@ app->log->level('debug'); -get '/hello' => {text => 'Hello World!'}; +get '/hello' => sub { shift->render(text => "Hello World \$\$!") }; app->start; EOF open $hot_deploy, '-|', $^X, "$prefix/hypnotoad", $script; -# Connection did not get lost -$tx = $ua->get("http://127.0.0.1:$port1/hello"); -ok $tx->is_finished, 'transaction is finished'; -ok $tx->keep_alive, 'connection will be kept alive'; -ok $tx->kept_alive, 'connection was kept alive'; -is $tx->res->code, 200, 'right status'; -is $tx->res->body, 'Hello Hypnotoad!', 'right content'; - -# Connection did not get lost (second port) -$tx = $ua->get("http://127.0.0.1:$port2/hello"); -ok $tx->is_finished, 'transaction is finished'; -ok $tx->keep_alive, 'connection will be kept alive'; -ok $tx->kept_alive, 'connection was kept alive'; -is $tx->res->code, 200, 'right status'; -is $tx->res->body, 'Hello Hypnotoad!', 'right content'; - -# Remove keep-alive connections -$ua = Mojo::UserAgent->new; - # Wait for hot deployment to finish while (1) { sleep 1; @@ -204,37 +204,47 @@ last if $new ne $old; } +# Request that will be served by an old worker that is still running +Mojo::IOLoop->one_tick until $tx->is_finished; +ok !$tx->keep_alive, 'connection will not be kept alive'; +ok !$tx->kept_alive, 'connection was not kept alive'; +is $tx->res->code, 200, 'right status'; +is $tx->res->body, 'Graceful shutdown!', 'right content'; + # Application has been reloaded $tx = $ua->get("http://127.0.0.1:$port1/hello"); ok $tx->is_finished, 'transaction is finished'; ok !$tx->keep_alive, 'connection will not be kept alive'; ok !$tx->kept_alive, 'connection was not kept alive'; -is $tx->res->code, 200, 'right status'; -is $tx->res->body, 'Hello World!', 'right content'; +is $tx->res->code, 200, 'right status'; +my $first = $tx->res->body; +like $first, qr/Hello World \d+!/, 'right content'; # Application has been reloaded (second port) $tx = $ua->get("http://127.0.0.1:$port2/hello"); ok $tx->is_finished, 'transaction is finished'; ok !$tx->keep_alive, 'connection will not be kept alive'; ok !$tx->kept_alive, 'connection was not kept alive'; -is $tx->res->code, 200, 'right status'; -is $tx->res->body, 'Hello World!', 'right content'; +is $tx->res->code, 200, 'right status'; +is $tx->res->body, $first, 'same content'; # Same result $tx = $ua->get("http://127.0.0.1:$port1/hello"); ok $tx->is_finished, 'transaction is finished'; ok !$tx->keep_alive, 'connection will not be kept alive'; ok !$tx->kept_alive, 'connection was not kept alive'; -is $tx->res->code, 200, 'right status'; -is $tx->res->body, 'Hello World!', 'right content'; +is $tx->res->code, 200, 'right status'; +my $second = $tx->res->body; +isnt $first, $second, 'different content'; +like $second, qr/Hello World \d+!/, 'right content'; # Same result (second port) $tx = $ua->get("http://127.0.0.1:$port2/hello"); ok $tx->is_finished, 'transaction is finished'; ok !$tx->keep_alive, 'connection will not be kept alive'; ok !$tx->kept_alive, 'connection was not kept alive'; -is $tx->res->code, 200, 'right status'; -is $tx->res->body, 'Hello World!', 'right content'; +is $tx->res->code, 200, 'right status'; +is $tx->res->body, $second, 'same content'; # Stop open my $stop, '-|', $^X, "$prefix/hypnotoad", $script, '-s'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/t/mojo/ioloop.t new/Mojolicious-7.11/t/mojo/ioloop.t --- old/Mojolicious-7.10/t/mojo/ioloop.t 2016-07-19 02:38:18.000000000 +0200 +++ new/Mojolicious-7.11/t/mojo/ioloop.t 2016-11-07 23:35:02.000000000 +0100 @@ -42,6 +42,18 @@ Mojo::IOLoop->start; like $err, qr/^Mojo::IOLoop already running/, 'right error'; +# Double one_tick +$err = undef; +Mojo::IOLoop->next_tick( + sub { + my $loop = shift; + eval { $loop->one_tick }; + $err = $@; + } +); +Mojo::IOLoop->one_tick; +like $err, qr/^Mojo::IOLoop already running/, 'right error'; + # Basic functionality my ($ticks, $timer, $hirestimer); my $id = $loop->recurring(0 => sub { $ticks++ }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/t/mojo/util.t new/Mojolicious-7.11/t/mojo/util.t --- old/Mojolicious-7.10/t/mojo/util.t 2016-11-01 18:18:05.000000000 +0100 +++ new/Mojolicious-7.11/t/mojo/util.t 2016-11-29 18:13:34.000000000 +0100 @@ -422,6 +422,14 @@ spurt "just\nworks!", $file; is slurp($file), "just\nworks!", 'successful roundtrip'; +# spurt (incomplete write) +{ + no warnings 'redefine'; + local *IO::Handle::syswrite = sub { $! = 0; 5 }; + eval { spurt "just\nworks!", $file }; + like $@, qr/Can't write to file ".*/, 'right error'; +} + # files is_deeply [files 'does_not_exist'], [], 'no files'; is_deeply [files __FILE__], [], 'no files'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-7.10/t/mojolicious/app.t new/Mojolicious-7.11/t/mojolicious/app.t --- old/Mojolicious-7.10/t/mojolicious/app.t 2016-08-27 05:40:16.000000000 +0200 +++ new/Mojolicious-7.11/t/mojolicious/app.t 2016-11-30 00:23:19.000000000 +0100 @@ -449,18 +449,18 @@ ->header_is(Server => 'Mojolicious (Perl)') ->content_is("Development template with high precedence.\n"); -# Check develpment mode log level -my $app = Mojolicious->new; -is $app->log->level, 'debug', 'right log level'; +# Check default development mode log level +is(Mojolicious->new->log->level, 'debug', 'right log level'); + +# Check non-development mode log level +is(Mojolicious->new->mode('test')->log->level, 'info', 'right log level'); # Make sure we can override attributes with constructor arguments -$app = MojoliciousTest->new(mode => 'test'); -is $app->mode, 'test', 'right mode'; -$app = MojoliciousTest->new({mode => 'test'}); -is $app->mode, 'test', 'right mode'; +is(MojoliciousTest->new(mode => 'test')->mode, 'test', 'right mode'); +is(MojoliciousTest->new({mode => 'test'})->mode, 'test', 'right mode'); # Persistent error -$app = MojoliciousTest->new; +my $app = MojoliciousTest->new; my $tx = $t->ua->build_tx(GET => '/foo'); $app->handler($tx); is $tx->res->code, 200, 'right status';
