[Rt-commit] rt branch, 4.0/mod-perl-timezones, created. rt-4.0.1rc1-17-gab1e5c4

Alex Vandiver alexmv at bestpractical.com
Tue Jun 7 20:53:21 EDT 2011


The branch, 4.0/mod-perl-timezones has been created
        at  ab1e5c4ba7788cec907d8e8f55abb21d6df06338 (commit)

- Log -----------------------------------------------------------------
commit 04ee3f8821017e4254942fe1ef429b6232a8072b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 3 16:25:29 2011 +0800

    todo timezone issues with mod_perl+worker or mod_perl+event

diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 6a4acd9..4683134 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -201,6 +201,15 @@ sub find_apache_server {
     return undef;
 }
 
+sub apache_mpm_type {
+    my $self = shift;
+    my $apache = $self->find_apache_server;
+    my $out = `$apache -l`;
+    if ( $out =~ /^\s*(worker|prefork|event|itk)\.c\s*$/m ) {
+        return $1;
+    }
+}
+
 sub fork_exec {
     my $self = shift;
 
diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index 73d99c4..5abb208 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -3,12 +3,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => undef;
-
-plan skip_all => 'test with apache+mod_perl has a bug with timezones'
-    if ($ENV{RT_TEST_WEB_HANDLER}||'') =~ /^apache(\+mod_perl)?$/;
-
-plan tests => 51;
+use RT::Test tests => 51;
 
 RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
 my ($baseurl, $m) = RT::Test->started_ok;
@@ -18,6 +13,15 @@ ok( $root->Load('root'), 'load root user' );
 
 my $cf_name = 'test cf datetime';
 
+my $why;
+
+if ( ( $ENV{RT_TEST_WEB_HANDLER} || '' ) =~ /^apache(\+mod_perl)?$/
+    && RT::Test::Apache->apache_mpm_type =~ /^(?:worker|event)$/ )
+{
+    $why =
+'localizing $ENV{TZ} does *not* work with mod_perl+mpm_event or mod_perl+mpm_worker';
+}
+
 my $cfid;
 diag "Create a CF";
 {
@@ -77,11 +81,14 @@ diag 'check valid inputs with various timezones in ticket create page';
 
     $ticket = RT::Ticket->new( RT->SystemUser );
     $ticket->Load($id);
-    is(
-        $ticket->CustomFieldValues($cfid)->First->Content,
-        '2010-05-04 17:00:01',
-        'date in db is in UTC'
-    );
+    TODO: {
+        local $TODO = $why;
+        is(
+            $ticket->CustomFieldValues($cfid)->First->Content,
+            '2010-05-04 17:00:01',
+            'date in db is in UTC'
+        );
+    }
 
     $m->content_contains('test cf datetime:', 'has cf datetime field on the page');
     $m->content_contains('Tue May 04 13:00:01 2010', 'has cf datetime value on the page');
@@ -89,7 +96,12 @@ diag 'check valid inputs with various timezones in ticket create page';
     $root->SetTimezone( 'Asia/Shanghai' );
     # interesting that $m->reload doesn't work
     $m->get_ok( $m->uri );
-    $m->content_contains('Wed May 05 01:00:01 2010', 'cf datetime value respects user timezone');
+
+    TODO: {
+        local $TODO = $why;
+        $m->content_contains( 'Wed May 05 01:00:01 2010',
+            'cf datetime value respects user timezone' );
+    }
 
     $m->submit_form(
         form_name => "CreateTicketInQueue",
@@ -107,17 +119,29 @@ diag 'check valid inputs with various timezones in ticket create page';
         "created ticket $id" );
     $ticket = RT::Ticket->new( RT->SystemUser );
     $ticket->Load($id);
-    is(
-        $ticket->CustomFieldValues($cfid)->First->Content,
-        '2010-05-05 23:00:01',
-        'date in db is in UTC'
-    );
+    TODO: {
+        local $TODO = $why;
+        is(
+            $ticket->CustomFieldValues($cfid)->First->Content,
+            '2010-05-05 23:00:01',
+            'date in db is in UTC'
+        );
+    }
 
     $m->content_contains('test cf datetime:', 'has no cf datetime field on the page');
-    $m->content_contains('Thu May 06 07:00:01 2010', 'cf datetime input respects user timezone');
+    TODO: {
+        local $TODO = $why;
+        $m->content_contains( 'Thu May 06 07:00:01 2010',
+            'cf datetime input respects user timezone' );
+    }
     $root->SetTimezone( 'EST5EDT' ); # back to -04:00
     $m->get_ok( $m->uri );
-    $m->content_contains('Wed May 05 19:00:01 2010', 'cf datetime value respects user timezone');
+
+    TODO: {
+        local $TODO = $why;
+        $m->content_contains( 'Wed May 05 19:00:01 2010',
+            'cf datetime value respects user timezone' );
+    }
 }
 
 
@@ -154,9 +178,13 @@ diag 'check search build page';
 
     is_results_number( { $cf_op->name => '<', $cf_field->name => '2010-05-07', }, 2 );
     is_results_number( { $cf_op->name => '>', $cf_field->name => '2010-05-04', }, 2 );
+
     is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05', }, 1 );
     is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05 01:00:01', }, 1 );
-    is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05 02:00:01', }, 0 );
+
+    is_results_number(
+        { $cf_op->name => '=', $cf_field->name => '2010-05-05 02:00:01', }, 0 );
+
     is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-06', }, 1 );
     is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-06 07:00:01', }, 1 );
     is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-06 08:00:01', }, 0 );
@@ -184,7 +212,7 @@ diag 'check invalid inputs';
     $m->content_lacks('foodate', 'invalid dates not set');
 }
 
-sub is_results_number { 
+sub is_results_number {
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     my $fields = shift;
     my $number = shift;
@@ -196,7 +224,10 @@ sub is_results_number {
         fields => $fields,
         button => 'DoSearch',
     );
-    $m->content_contains( "Found $number ticket", "Found $number ticket" );
+    TODO: {
+        local $TODO = $why;
+        $m->content_contains( "Found $number ticket", "Found $number ticket" );
+    }
 }
 
 # to make $m->DESTROY happy

commit 15d7acfad1accc2af84718e7d16272b28c51da11
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 8 00:46:08 2011 +0000

    Fix test comment to be logical

diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index 5abb208..5234df5 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -128,7 +128,7 @@ diag 'check valid inputs with various timezones in ticket create page';
         );
     }
 
-    $m->content_contains('test cf datetime:', 'has no cf datetime field on the page');
+    $m->content_contains('test cf datetime:', 'has cf datetime field on the page');
     TODO: {
         local $TODO = $why;
         $m->content_contains( 'Thu May 06 07:00:01 2010',
@@ -208,7 +208,7 @@ diag 'check invalid inputs';
     );
     $m->content_like(qr/Ticket \d+ created/, "a ticket is created succesfully");
 
-    $m->content_contains('test cf datetime:', 'has no cf datetime field on the page');
+    $m->content_contains('test cf datetime:', 'has cf datetime field on the page');
     $m->content_lacks('foodate', 'invalid dates not set');
 }
 

commit fe9cfa2d7bf0d50cdfb3760776c14031b10dae2b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 8 00:47:08 2011 +0000

    Adjust TODOs to more precisely target the failing tests in question

diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index 5234df5..9781c5e 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -129,11 +129,8 @@ diag 'check valid inputs with various timezones in ticket create page';
     }
 
     $m->content_contains('test cf datetime:', 'has cf datetime field on the page');
-    TODO: {
-        local $TODO = $why;
-        $m->content_contains( 'Thu May 06 07:00:01 2010',
-            'cf datetime input respects user timezone' );
-    }
+    $m->content_contains( 'Thu May 06 07:00:01 2010',
+        'cf datetime input respects user timezone' );
     $root->SetTimezone( 'EST5EDT' ); # back to -04:00
     $m->get_ok( $m->uri );
 
@@ -179,8 +176,11 @@ diag 'check search build page';
     is_results_number( { $cf_op->name => '<', $cf_field->name => '2010-05-07', }, 2 );
     is_results_number( { $cf_op->name => '>', $cf_field->name => '2010-05-04', }, 2 );
 
-    is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05', }, 1 );
-    is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05 01:00:01', }, 1 );
+    TODO: {
+        local $TODO = $why;
+        is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05', }, 1 );
+        is_results_number( { $cf_op->name => '=', $cf_field->name => '2010-05-05 01:00:01', }, 1 );
+    }
 
     is_results_number(
         { $cf_op->name => '=', $cf_field->name => '2010-05-05 02:00:01', }, 0 );
@@ -218,16 +218,16 @@ sub is_results_number {
     my $number = shift;
     my $operator = shift;
     my $value = shift;
-    $m->get_ok( $baseurl . '/Search/Build.html?Query=Queue=1' );
+    {
+        local $TODO;
+        $m->get_ok( $baseurl . '/Search/Build.html?Query=Queue=1' );
+    }
     $m->form_name('BuildQuery');
     $m->submit_form(
         fields => $fields,
         button => 'DoSearch',
     );
-    TODO: {
-        local $TODO = $why;
-        $m->content_contains( "Found $number ticket", "Found $number ticket" );
-    }
+    $m->content_contains( "Found $number ticket", "Found $number ticket" );
 }
 
 # to make $m->DESTROY happy

commit ab1e5c4ba7788cec907d8e8f55abb21d6df06338
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 8 00:47:53 2011 +0000

    Precisely note the TZ failure case on worker and event mpms under mod_perl

diff --git a/docs/web_deployment.pod b/docs/web_deployment.pod
index e6161aa..e789c71 100644
--- a/docs/web_deployment.pod
+++ b/docs/web_deployment.pod
@@ -26,6 +26,13 @@ to use L<Starman>, a high performance preforking server:
 
 B<WARNING: mod_perl 1.99_xx is not supported.>
 
+B<WARNING>: Due to thread-safety limitations, all timestamps will be
+presented in the webserver's default time zone when using the C<worker>
+and C<event> MPMs; the C<$Timezone> setting and the user's timezone
+preference are ignored.  We suggest the C<prefork> MPM or FastCGI
+deployment if your privileged users are in a different timezone than the
+one the server is configured for.
+
     <VirtualHost rt.example.com>
         ### Optional apache logs for RT
         # ErrorLog /opt/rt4/var/log/apache2.error

-----------------------------------------------------------------------


More information about the Rt-commit mailing list