[Rt-commit] rt branch, 4.0/apache2-fixes, updated. rt-4.0.0rc5-30-gdbf587c

Alex Vandiver alexmv at bestpractical.com
Mon Feb 28 22:29:40 EST 2011


The branch, 4.0/apache2-fixes has been updated
       via  dbf587c884a1846056043d350b1038b659e57721 (commit)
       via  571bf147902bfe32a757c975accc4611c9ad968b (commit)
       via  c24eee2de927dd0590b4789fb99403369ff1e2ee (commit)
       via  fe5f63468dd1b48c658712290594b99ada971eae (commit)
       via  96b2de3540ab5fe482834e9dbd2081a27d3cc452 (commit)
      from  a199c2163e696f00538f72a9c6242826dc5fe30a (commit)

Summary of changes:
 lib/RT/Interface/Web.pm |   12 ++++++
 lib/RT/Test.pm          |   13 +++++--
 lib/RT/Test/Apache.pm   |    2 +-
 t/fts/indexed_oracle.t  |    2 +-
 t/fts/indexed_pg.t      |    2 +-
 t/web/cf_datetime.t     |    2 +-
 t/web/squish.t          |   93 +++++++++++++++++++++--------------------------
 7 files changed, 66 insertions(+), 60 deletions(-)

- Log -----------------------------------------------------------------
commit 96b2de3540ab5fe482834e9dbd2081a27d3cc452
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Feb 25 14:04:34 2011 -0500

    Correctly wait until apache children have exited
    
    waitpid() always returns -1 for apache processes because they have
    daemonized themselves into a new process group; instead, simply sleep
    until they exit.  This fixes non-deterministic bugs where tests which
    stopped and restarted servers would error out with "could not bind to
    address."
    
    This also means that we can remove the arbitrary 'sleep 2', which was
    papering over the problem.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index aef5e61..ddbc045 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1297,12 +1297,13 @@ sub stop_server {
     $sig = 'INT' if $ENV{'RT_TEST_WEB_HANDLER'} eq "plack";
     kill $sig, @SERVERS;
     foreach my $pid (@SERVERS) {
-        waitpid $pid, 0;
+        if ($ENV{RT_TEST_WEB_HANDLER} =~ /^apache/) {
+            sleep 1 while kill 0, $pid;
+        } else {
+            waitpid $pid, 0;
+        }
     }
 
-    sleep 2
-      if !$in_end && $ENV{'RT_TEST_WEB_HANDLER'} =~ /^apache/;
-
     @SERVERS = ();
 }
 
diff --git a/t/web/squish.t b/t/web/squish.t
index c331bc2..2350b42 100644
--- a/t/web/squish.t
+++ b/t/web/squish.t
@@ -6,62 +6,51 @@ use RT::Test tests => 18;
 RT->Config->Set( DevelMode            => 0 );
 RT->Config->Set( WebDefaultStylesheet => 'aileron' );
 
-my ( $url, $m );
-
 diag "test squished files with devel mode disabled";
-{
-    ( $url, $m ) = RT::Test->started_ok;
-    $m->login;
-
-    $m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
-        'follow squished css' );
-    $m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
-    $m->content_lacks( 'text-decoration: underline !important;',
-        'no print.css by default' );
-
-    $m->back;
-    my ($js_link) =
-      $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
-    $m->get_ok( $url . $js_link, 'follow squished js' );
-    $m->content_lacks( 'IE7=', 'no IE7.js by default' );
-
-}
+my ( $url, $m ) = RT::Test->started_ok;
+$m->login;
+
+$m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
+    'follow squished css' );
+$m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
+$m->content_lacks( 'text-decoration: underline !important;',
+    'no print.css by default' );
+
+$m->back;
+my ($js_link) =
+  $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
+$m->get_ok( $url . $js_link, 'follow squished js' );
+$m->content_lacks( 'IE7=', 'no IE7.js by default' );
+RT::Test->stop_server;
 
 diag "test squished files with customized files and devel mode disabled";
-SKIP:
-{
-    skip 'need plack server to reinitialize', 6
-      if $ENV{RT_TEST_WEB_HANDLER} ne 'plack';
-    RT::Test->stop_server;
-    RT->AddJavaScript( 'IE7/IE7.js' );
-    RT->AddStyleSheets( 'print.css' );
-    ( $url, $m ) = RT::Test->started_ok;
+RT->AddJavaScript( 'IE7/IE7.js' );
+RT->AddStyleSheets( 'print.css' );
+( $url, $m ) = RT::Test->started_ok;
 
-    $m->login;
-    $m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
-        'follow squished css' );
-    $m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
-    $m->content_contains( 'text-decoration: underline !important;',
-        'has print.css' );
+$m->login;
+$m->follow_link_ok( { url_regex => qr!aileron-squished-([a-f0-9]{32})\.css! },
+    'follow squished css' );
+$m->content_like( qr!/\*\* End of .*?.css \*/!, 'squished css' );
+$m->content_contains( 'text-decoration: underline !important;',
+    'has print.css' );
 
-    $m->back;
-    my ($js_link) =
-      $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
-    $m->get_ok( $url . $js_link, 'follow squished js' );
-    $m->content_contains( 'IE7=', 'has IE7.js' );
-}
+$m->back;
+($js_link) =
+  $m->content =~ m!src="([^"]+?squished-([a-f0-9]{32})\.js)"!;
+$m->get_ok( $url . $js_link, 'follow squished js' );
+$m->content_contains( 'IE7=', 'has IE7.js' );
+RT::Test->stop_server;
 
-diag "test squished files with devel mode enabled";
-{
-    RT::Test->stop_server;
-    RT->Config->Set( 'DevelMode' => 1 );
-    RT->AddJavaScript( 'IE7/IE7.js' );
-    RT->AddStyleSheets( 'nottherebutwedontcare.css' );
 
-    ( $url, $m ) = RT::Test->started_ok;
-    $m->login;
-    $m->content_unlike( qr!squished-.*?\.(js|css)!,
-        'no squished link with develmode' );
-    $m->content_like(qr/IE7\/IE7\.js/, "found extra javascript resource");
-    $m->content_like(qr/nottherebutwedontcare\.css/, "found extra css resource");
-}
+diag "test squished files with devel mode enabled";
+RT->Config->Set( 'DevelMode' => 1 );
+RT->AddJavaScript( 'IE7/IE7.js' );
+RT->AddStyleSheets( 'nottherebutwedontcare.css' );
+
+( $url, $m ) = RT::Test->started_ok;
+$m->login;
+$m->content_unlike( qr!squished-.*?\.(js|css)!,
+    'no squished link with develmode' );
+$m->content_like(qr/IE7\/IE7\.js/, "found extra javascript resource");
+$m->content_like(qr/nottherebutwedontcare\.css/, "found extra css resource");

commit fe5f63468dd1b48c658712290594b99ada971eae
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Feb 28 22:21:51 2011 -0500

    Fix two test counts that c3f6b26 missed

diff --git a/t/fts/indexed_oracle.t b/t/fts/indexed_oracle.t
index 3c943f2..9b1489f 100644
--- a/t/fts/indexed_oracle.t
+++ b/t/fts/indexed_oracle.t
@@ -5,7 +5,7 @@ use warnings;
 
 use RT::Test tests => undef;
 plan skip_all => 'Not Oracle' unless RT->Config->Get('DatabaseType') eq 'Oracle';
-plan tests => 11;
+plan tests => 13;
 
 RT->Config->Set( FullTextSearch => Enable => 1, Indexed => 1 );
 
diff --git a/t/fts/indexed_pg.t b/t/fts/indexed_pg.t
index 84cbaae..c95db24 100644
--- a/t/fts/indexed_pg.t
+++ b/t/fts/indexed_pg.t
@@ -10,7 +10,7 @@ my ($major, $minor) = $RT::Handle->dbh->get_info(18) =~ /^0*(\d+)\.0*(\d+)/;
 plan skip_all => "Need Pg 8.2 or higher; we have $major.$minor"
     if "$major.$minor" < 8.2;
 
-plan tests => 11;
+plan tests => 13;
 
 RT->Config->Set( FullTextSearch => Enable => 1, Indexed => 1 );
 

commit c24eee2de927dd0590b4789fb99403369ff1e2ee
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Feb 28 22:25:30 2011 -0500

    Give Apache the same 15s to start up that standalone servers get
    
    Particularly under high parallelism, it needs all of the time it can get.

diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index ada5b08..7246cf4 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -113,7 +113,7 @@ sub start_server {
 
     $self->fork_exec($info{'executable'}, '-f', $tmp{'config'}{'apache'});
     my $pid = do {
-        my $tries = 10;
+        my $tries = 15;
         while ( !-s $opt{'pid_file'} ) {
             $tries--;
             last unless $tries;

commit 571bf147902bfe32a757c975accc4611c9ad968b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Feb 28 22:27:10 2011 -0500

    Unfortunately, caac0b1 runs too late to be able to use for skip_all
    
    The environment variable is fixed up during start_server, which is
    after we decide if we should skip the test.

diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index bf514d9..73d99c4 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -6,7 +6,7 @@ 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} eq "apache+mod_perl";
+    if ($ENV{RT_TEST_WEB_HANDLER}||'') =~ /^apache(\+mod_perl)?$/;
 
 plan tests => 51;
 

commit dbf587c884a1846056043d350b1038b659e57721
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Feb 28 22:28:05 2011 -0500

    The inline test server persists squished data across restarts; clear it

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 6205d70..cd4beed 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -98,6 +98,18 @@ sub SquishedJS {
     return $js;
 }
 
+=head2 ClearSquished
+
+Removes the cached CSS and JS entries, forcing them to be regenerated
+on next use.
+
+=cut
+
+sub ClearSquished {
+    undef $SQUISHED_JS;
+    %SQUISHED_CSS = ();
+}
+
 =head2 EscapeUTF8 SCALARREF
 
 does a css-busting but minimalist escaping of whatever html you're passing in.
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index ddbc045..f912657 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1271,6 +1271,10 @@ sub start_inline_server {
     require Test::WWW::Mechanize::PSGI;
     unshift @RT::Test::Web::ISA, 'Test::WWW::Mechanize::PSGI';
 
+    # Clear out squished CSS and JS cache, since it's retained across
+    # servers, since it's in-process
+    RT::Interface::Web->ClearSquished;
+
     Test::More::ok(1, "psgi test server ok");
     return ("http://localhost:$port", RT::Test::Web->new);
 }

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


More information about the Rt-commit mailing list