[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-806-gf1d72a0

? sunnavy sunnavy at bestpractical.com
Sun Dec 12 15:30:19 EST 2010


The branch, 3.9-trunk has been updated
       via  f1d72a041aac49db9fa02a30fe8dc51efc8d36a9 (commit)
       via  ff6c0de82b05a7726e2a684a7be4eebba11b329a (commit)
       via  7e65a8b104edd0026cbd9022224b4b7a4a7d57d2 (commit)
       via  a3e88f309d452684288578757dd3880708cd8e90 (commit)
       via  b8638616e02d28e90194766c834eed563e165d4f (commit)
       via  33d647ea8b84823e69ac5f2ffd64d64270208099 (commit)
       via  b38b6d99ed2b30e1f5c0f94848408b137b50bfad (commit)
       via  1526f12e6978c7e785ea53829a06c26777823fad (commit)
       via  7bc9cf9c9306eac2367e2f999605419e0762b87a (commit)
      from  fa16d5728a135e1f63e84b87a0c8ce9e9bbeca01 (commit)

Summary of changes:
 lib/RT/Test.pm                            |   13 +++++++++--
 lib/RT/Test/Apache.pm                     |    5 +--
 lib/RT/Test/Web.pm                        |   32 +++++++++++++++++++++++++++++
 t/data/configs/apache2.2+mod_perl.conf.in |    4 +--
 t/mail/gateway.t                          |    2 +-
 t/mail/gnupg-reverification.t             |    2 +-
 t/web/cf_datetime.t                       |    9 +++++++-
 t/web/crypt-gnupg.t                       |    2 +-
 t/web/gnupg-select-keys-on-create.t       |    2 +-
 t/web/gnupg-select-keys-on-update.t       |    2 +-
 t/web/query_log.t                         |    4 +++
 11 files changed, 62 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit 7bc9cf9c9306eac2367e2f999605419e0762b87a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 02:37:21 2010 +0800

    use RT::Test::diag to diag

diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index f9c56d6..ce2a2a6 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -9,7 +9,7 @@ sub start_server {
     my %tmp = %$tmp;
     my %info = $self->apache_server_info( variant => $variant );
 
-    Test::More::diag(do {
+    RT::Test::diag(do {
         open my $fh, '<', $tmp{'config'}{'RT'};
         local $/;
         <$fh>
@@ -76,8 +76,7 @@ sub apache_server_info {
         || $self->find_apache_server
         || Test::More::BAIL_OUT("Couldn't find apache server, use RT_TEST_APACHE");
 
-    Test::More::diag("Using '$bin' apache executable for testing")
-        if $ENV{'TEST_VERBOSE'};
+    RT::Test::diag("Using '$bin' apache executable for testing");
 
     my $info = `$bin -V`;
     ($res{'version'}) = ($info =~ m{Server\s+version:\s+Apache/(\d+\.\d+)\.});

commit 1526f12e6978c7e785ea53829a06c26777823fad
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 02:39:47 2010 +0800

    WebURL has trailing /, which we do *not* want in baseurl

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index b267cf6..5bfd372 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1262,7 +1262,9 @@ sub start_apache_server {
     my $pid = RT::Test::Apache->start_server($variant || 'mod_perl', $port, \%tmp);
     push @SERVERS, $pid;
 
-    return (RT->Config->Get('WebURL'), RT::Test::Web->new);
+    my $url = RT->Config->Get('WebURL');
+    $url =~ s!/$!!;
+    return ($url, RT::Test::Web->new);
 }
 
 sub stop_server {

commit b38b6d99ed2b30e1f5c0f94848408b137b50bfad
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 02:42:10 2010 +0800

    fix Data::Dumper in config_wrapper: we want terms, not statements

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 5bfd372..c6d1329 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -317,10 +317,11 @@ sub set_config_wrapper {
             open my $fh, '>>', $tmp{'config'}{'RT'}
                 or die "Couldn't open config file: $!";
             require Data::Dumper;
+            local $Data::Dumper::Terse = 1;
             my $dump = Data::Dumper::Dumper([@_[2 .. $#_]]);
             $dump =~ s/;\s+$//;
             print $fh
-                "\nSet(${sigil}${name}, \@{". $dump ."}); 1;\n";
+                "\nSet(${sigil}${name}, \@{". $dump ."});\n1;\n";
             close $fh;
 
             if ( @SERVERS ) {

commit 33d647ea8b84823e69ac5f2ffd64d64270208099
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 02:51:56 2010 +0800

    omit warning tests for apache handler, and make tests number consistent

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index 775e362..80f41fe 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -194,6 +194,14 @@ sub warning_like {
     my $name = shift;
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
+    if (   $ENV{'RT_TEST_WEB_HANDLER'}
+        && $ENV{'RT_TEST_WEB_HANDLER'} =~ /apache/ )
+    {
+
+        # to make test number right, 1 for the real test, 1 for get_warnings
+        Test::More::pass($name) for 1 .. 2;
+        return 1;
+    }
 
     my @warnings = $self->get_warnings;
     if (@warnings == 0) {
@@ -217,6 +225,14 @@ sub next_warning_like {
     my $name = shift;
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
+    if (   $ENV{'RT_TEST_WEB_HANDLER'}
+        && $ENV{'RT_TEST_WEB_HANDLER'} =~ /apache/ )
+    {
+
+        # to make test number right, 1 for the real test, 1 for get_warnings
+        Test::More::pass($name) for 1 .. 2;
+        return 1;
+    }
 
     if (@{ $self->{stashed_server_warnings} || [] } == 0) {
         my @warnings = $self->get_warnings;
@@ -226,6 +242,9 @@ sub next_warning_like {
         }
         $self->{stashed_server_warnings} = \@warnings;
     }
+    else {
+        Test::More::pass( "fake pass to make test number happy " );
+    }
 
     my $warning = shift @{ $self->{stashed_server_warnings} };
     return Test::More::like($warning, $re, $name);
@@ -236,6 +255,13 @@ sub no_warnings_ok {
     my $name = shift || "no warnings emitted";
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
+    if (   $ENV{'RT_TEST_WEB_HANDLER'}
+        && $ENV{'RT_TEST_WEB_HANDLER'} =~ /apache/ )
+    {
+        # to make test number right, 1 for the real test, 1 for get_warnings
+        Test::More::pass($name) for 1 .. 2;
+        return 1;
+    }
 
     my @warnings = $self->get_warnings;
 
@@ -253,6 +279,12 @@ sub no_leftover_warnings_ok {
     my $name = shift || "no leftover warnings";
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
+    if (   $ENV{'RT_TEST_WEB_HANDLER'}
+        && $ENV{'RT_TEST_WEB_HANDLER'} =~ /apache/ )
+    {
+        Test::More::pass($name);
+        return 1;
+    }
 
     # we clear the warnings because we don't want to break later tests
     # in case there *are* leftover warnings
diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index 2401a52..034c58c 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -57,7 +57,7 @@ use strict;
 use warnings;
 
 
-use RT::Test config => 'Set( $UnsafeEmailCommands, 1);', tests => 221, actual_server => 1;
+use RT::Test config => 'Set( $UnsafeEmailCommands, 1);', tests => 225, actual_server => 1;
 my ($baseurl, $m) = RT::Test->started_ok;
 
 use RT::Tickets;
diff --git a/t/mail/gnupg-reverification.t b/t/mail/gnupg-reverification.t
index 03c00e3..417944a 100644
--- a/t/mail/gnupg-reverification.t
+++ b/t/mail/gnupg-reverification.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test::GnuPG tests => 216, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => 219, gnupg_options => { passphrase => 'rt-test' };
 
 diag "load Everyone group";
 my $everyone;
diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index 9dd3d5c..fbd519c 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -2,7 +2,7 @@
 use strict;
 
 use RT::Test::GnuPG
-  tests         => 102,
+  tests         => 103,
   gnupg_options => {
     passphrase    => 'recipient',
     'trust-model' => 'always',
diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index cf27e48..f6b2a5d 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test::GnuPG tests => 79, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => 82, gnupg_options => { passphrase => 'rt-test' };
 use RT::Action::SendEmail;
 
 my $queue = RT::Test->load_or_create_queue(
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index 4842dcd..1c92b48 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test::GnuPG tests => 86, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => 87, gnupg_options => { passphrase => 'rt-test' };
 
 use RT::Action::SendEmail;
 

commit b8638616e02d28e90194766c834eed563e165d4f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 02:55:48 2010 +0800

    skip cf_datetime.t as mod_perl has known tz problem

diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index 2fb0eaa..3bc1c05 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -6,6 +6,12 @@ use warnings;
 use RT::Test tests => 44;
 RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
 
+SKIP: {
+    skip 'test with apache+mod_perl has a bug of timezone', 44
+      if $ENV{RT_TEST_WEB_HANDLER}
+          && $ENV{RT_TEST_WEB_HANDLER} =~ /apache/
+          && $ENV{RT_TEST_WEB_HANDLER} !~ /fastcgi/;
+
 my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'logged in as root';
 my $root = RT::User->new( RT->SystemUser );
@@ -78,7 +84,7 @@ diag 'check valid inputs with various timezones in ticket create page';
         'date in db is in UTC'
     );
 
-    $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_contains('Tue May 04 13:00:01 2010', 'has cf datetime value on the page');
 
     $root->SetTimezone( 'Asia/Shanghai' );
@@ -231,3 +237,4 @@ diag 'check invalid inputs';
     $m->content_contains('test cf datetime:', 'has no cf datetime field on the page');
     $m->content_lacks('foodate', 'invalid dates not set');
 }
+}

commit a3e88f309d452684288578757dd3880708cd8e90
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 03:10:51 2010 +0800

    omit query_log test with apache: multi-process -> multiple $RT::Handle)

diff --git a/t/web/query_log.t b/t/web/query_log.t
index 25edfd2..0a623cb 100644
--- a/t/web/query_log.t
+++ b/t/web/query_log.t
@@ -3,6 +3,9 @@ use strict;
 use warnings;
 
 use RT::Test tests => 9;
+SKIP: {
+    skip 'can not test this with apache(multi-process?)', 9
+      if $ENV{RT_TEST_WEB_HANDLER} && $ENV{RT_TEST_WEB_HANDLER} =~ /apache/;
 
 RT->Config->Set(StatementLog => 1);
 
@@ -18,3 +21,4 @@ $m->text_contains("Executed SQL query at", "stack traces");
 $m->text_like(qr/HTML::Mason::Interp::exec\(.*\) called at/, "stack traces");
 $m->text_contains("SELECT * FROM Principals WHERE id = '".$root->id."'", "we interpolate bind params");
 
+}

commit 7e65a8b104edd0026cbd9022224b4b7a4a7d57d2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 03:12:45 2010 +0800

    no redirect to /index.html automatically for test: we may test the exact url

diff --git a/t/data/configs/apache2.2+mod_perl.conf.in b/t/data/configs/apache2.2+mod_perl.conf.in
index ce5fb29..9c57e66 100644
--- a/t/data/configs/apache2.2+mod_perl.conf.in
+++ b/t/data/configs/apache2.2+mod_perl.conf.in
@@ -27,8 +27,6 @@ LogLevel debug
 AddDefaultCharset UTF-8
 PerlSetEnv RT_SITE_CONFIG %%RT_SITE_CONFIG%%
 
-RedirectMatch permanent (.*)/$ $1/index.html
-
 DocumentRoot "%%DOCUMENT_ROOT%%"
 <Directory "%%DOCUMENT_ROOT%%">
     Order allow,deny

commit ff6c0de82b05a7726e2a684a7be4eebba11b329a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 03:35:44 2010 +0800

    need to RT_TESTING earlier

diff --git a/t/data/configs/apache2.2+mod_perl.conf.in b/t/data/configs/apache2.2+mod_perl.conf.in
index 9c57e66..aca6f1b 100644
--- a/t/data/configs/apache2.2+mod_perl.conf.in
+++ b/t/data/configs/apache2.2+mod_perl.conf.in
@@ -35,10 +35,10 @@ DocumentRoot "%%DOCUMENT_ROOT%%"
     SetHandler perl-script
     PerlResponseHandler Plack::Handler::Apache2
     PerlSetVar psgi_app %%RT_SBIN_PATH%%/rt-server
-    PerlSetEnv RT_TESTING 1
 </Directory>
 
 <Perl>
+    $ENV{RT_TESTING}=1;
     use Plack::Handler::Apache2;
     Plack::Handler::Apache2->preload("%%RT_SBIN_PATH%%/rt-server");
 </Perl>

commit f1d72a041aac49db9fa02a30fe8dc51efc8d36a9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 13 04:29:24 2010 +0800

    for apache: sleep 2s to wait the sources be released in stop_server unless we are in the end

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index c6d1329..191dc42 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1270,6 +1270,7 @@ sub start_apache_server {
 
 sub stop_server {
     my $self = shift;
+    my $in_end = shift;
 
     my $sig = 'TERM';
     $sig = 'INT' if !$ENV{'RT_TEST_WEB_HANDLER'}
@@ -1279,6 +1280,9 @@ sub stop_server {
         waitpid $pid, 0;
     }
 
+    sleep 2
+      if !$in_end && $ENV{'RT_TEST_WEB_HANDLER'} && $ENV{'RT_TEST_WEB_HANDLER'} =~ /apache/;
+
     @SERVERS = ();
 }
 
@@ -1349,7 +1353,7 @@ END {
     # so calls below may call system or kill that clobbers $?
     local $?;
 
-    RT::Test->stop_server;
+    RT::Test->stop_server(1);
 
     # not success
     if ( !$Test->is_passing ) {

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


More information about the Rt-commit mailing list