[Rt-commit] rt branch, 4.0/apache2-fixes, created. rt-4.0.0rc5-25-ga199c21
Alex Vandiver
alexmv at bestpractical.com
Mon Feb 28 19:36:39 EST 2011
The branch, 4.0/apache2-fixes has been created
at a199c2163e696f00538f72a9c6242826dc5fe30a (commit)
- Log -----------------------------------------------------------------
commit 2ef4a4224db2a89fbfcd5f6e55f95dc4740913fb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 18:05:38 2011 -0500
Allow setting apache module path even if apxs is not installed
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 544e4f4..35e0af0 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -50,13 +50,13 @@ package RT::Test::Apache;
use strict;
use warnings;
-my $apache_module_prefix;
+my $apache_module_prefix = $ENV{RT_TEST_APACHE_MODULES};
my $apxs =
$ENV{RT_TEST_APXS}
|| RT::Test->find_executable('apxs')
|| RT::Test->find_executable('apxs2');
-if ($apxs) {
+if ($apxs and not $apache_module_prefix) {
$apache_module_prefix = `$apxs -q LIBEXECDIR`;
chomp $apache_module_prefix;
}
commit 5129823417121c3bd10a35b246fef8096264ee83
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 18:05:58 2011 -0500
Bail unless module path is set correctly
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 35e0af0..52d0b15 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -135,6 +135,11 @@ sub apache_server_info {
|| $self->find_apache_server
|| Test::More::BAIL_OUT("Couldn't find apache server, use RT_TEST_APACHE");
+ Test::More::BAIL_OUT(
+ "Couldn't find apache modules directory (set APXS= or RT_TEST_APACHE_MODULES=)"
+ ) unless -d $apache_module_prefix;
+
+
RT::Test::diag("Using '$bin' apache executable for testing");
my $info = `$bin -V`;
commit 3ee92cac2d0bb2243504002b6dbb489687d41caa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 18:07:10 2011 -0500
Show Apache error log if it fails to start, for debugging
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 52d0b15..8b1a0c4 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -114,10 +114,18 @@ sub start_server {
last unless $tries;
sleep 1;
}
- Test::More::BAIL_OUT("Couldn't start apache server, no pid file")
- unless -e $opt{'pid_file'};
- open( my $pid_fh, '<', $opt{'pid_file'} )
- or Test::More::BAIL_OUT("Couldn't open pid file: $!");
+ my $pid_fh;
+ unless (-e $opt{'pid_file'} and open($pid_fh, '<', $opt{'pid_file'})) {
+ Test::More::BAIL_OUT("Couldn't start apache server, no pid file (unknown error)")
+ unless -e $opt{log_file};
+
+ open my $log, "<", $opt{log_file};
+ my $error = do {local $/; <$log>};
+ close $log;
+ $RT::Logger->error($error) if $error;
+ Test::More::BAIL_OUT("Couldn't start apache server!");
+ }
+
my $pid = <$pid_fh>;
chomp $pid;
$pid;
commit 9144205a877c8a1cac0b4a6d522a1e68a76a7ae3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 18:08:05 2011 -0500
Use skip_all instead of wrapping the entire file in a SKIP block
This means we do not need to keep updating the SKIP count, as well
diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index d92b18d..cc6505a 100644
--- a/t/web/cf_datetime.t
+++ b/t/web/cf_datetime.t
@@ -3,17 +3,15 @@
use strict;
use warnings;
-use RT::Test tests => 51;
-RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
-my ($baseurl, $m);
+use RT::Test tests => undef;
+
+plan skip_all => 'test with apache+mod_perl has a bug with timezones'
+ if $ENV{RT_TEST_WEB_HANDLER} and $ENV{RT_TEST_WEB_HANDLER} =~ /apache\+mod_perl/;
-SKIP: {
- skip 'test with apache+mod_perl has a bug of timezone', 51
- if $ENV{RT_TEST_WEB_HANDLER}
- && $ENV{RT_TEST_WEB_HANDLER} =~ /apache/
- && $ENV{RT_TEST_WEB_HANDLER} !~ /fastcgi/;
+plan tests => 51;
-($baseurl, $m) = RT::Test->started_ok;
+RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
+my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
my $root = RT::User->new( RT->SystemUser );
ok( $root->Load('root'), 'load root user' );
@@ -185,7 +183,6 @@ 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');
}
-}
sub is_results_number {
local $Test::Builder::Level = $Test::Builder::Level + 1;
commit b65f76905af692cdfafacb509f869785ac3e2ddd
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 03:23:37 2011 -0500
Whether a ticket ->can($field) depends if the method has been called already
Since SearchBuilder uses AUTOLOAD to dynamically create methods,
$ticket->can($field) can return false, yet $ticket->$field could
succeed. Thus, look at ->_Accessible to determine if such a method
_will_ exist if we call it. This avoids heisenbugs where examining
the state of any ticket can increase the number of tests that a test
file runs.
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 9375d58..14ddecc 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -674,7 +674,9 @@ sub create_ticket {
Test::More::is( $got, $expected, 'correct CF values' );
}
else {
- next if ref $args{$field} || !$ticket->can($field) || ref $ticket->$field();
+ next if ref $args{$field};
+ next unless $ticket->can($field) or $ticket->_Accessible($field,"read");
+ next if ref $ticket->$field();
Test::More::is( $ticket->$field(), $args{$field}, "$field is correct" );
}
}
commit c3f6b26632fbe09659a3c9105cf214587193ecf3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 03:27:21 2011 -0500
Update test counts to reflect better method reflection
diff --git a/t/api/has_rights.t b/t/api/has_rights.t
index d87704f..990fc01 100644
--- a/t/api/has_rights.t
+++ b/t/api/has_rights.t
@@ -1,4 +1,4 @@
-use RT::Test nodata => 1, tests => 7;
+use RT::Test nodata => 1, tests => 9;
use strict;
use warnings;
diff --git a/t/fts/not_indexed.t b/t/fts/not_indexed.t
index 9d81647..c96aacd 100644
--- a/t/fts/not_indexed.t
+++ b/t/fts/not_indexed.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 9;
+use RT::Test tests => 11;
RT->Config->Set( FullTextSearch => Enable => 1, Indexed => 0 );
diff --git a/t/ticket/cfsort-freeform-multiple.t b/t/ticket/cfsort-freeform-multiple.t
index 45e5af3..e285d0e 100644
--- a/t/ticket/cfsort-freeform-multiple.t
+++ b/t/ticket/cfsort-freeform-multiple.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use RT::Test nodata => 1, tests => 29;
+use RT::Test nodata => 1, tests => 41;
use strict;
use warnings;
diff --git a/t/ticket/cfsort-freeform-single.t b/t/ticket/cfsort-freeform-single.t
index e564ac8..35a53fb 100644
--- a/t/ticket/cfsort-freeform-single.t
+++ b/t/ticket/cfsort-freeform-single.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use RT::Test nodata => 1, tests => 61;
+use RT::Test nodata => 1, tests => 89;
use strict;
use warnings;
diff --git a/t/ticket/search_by_cf_freeform_multiple.t b/t/ticket/search_by_cf_freeform_multiple.t
index e102720..4e7cddc 100644
--- a/t/ticket/search_by_cf_freeform_multiple.t
+++ b/t/ticket/search_by_cf_freeform_multiple.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 104;
+use RT::Test nodata => 1, tests => 118;
use RT::Ticket;
my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
diff --git a/t/ticket/search_by_cf_freeform_single.t b/t/ticket/search_by_cf_freeform_single.t
index 19e0b86..278a3ce 100644
--- a/t/ticket/search_by_cf_freeform_single.t
+++ b/t/ticket/search_by_cf_freeform_single.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 98;
+use RT::Test nodata => 1, tests => 106;
use RT::Ticket;
my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
diff --git a/t/ticket/search_by_links.t b/t/ticket/search_by_links.t
index 1eb83df..61b69b7 100644
--- a/t/ticket/search_by_links.t
+++ b/t/ticket/search_by_links.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 86;
+use RT::Test nodata => 1, tests => 98;
use RT::Ticket;
my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
diff --git a/t/ticket/search_by_watcher.t b/t/ticket/search_by_watcher.t
index 4dd98c2..809450b 100644
--- a/t/ticket/search_by_watcher.t
+++ b/t/ticket/search_by_watcher.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 1975;
+use RT::Test nodata => 1, tests => 2108;
use RT::Ticket;
my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
diff --git a/t/ticket/sort-by-queue.t b/t/ticket/sort-by-queue.t
index 4aa7f47..bf2934b 100644
--- a/t/ticket/sort-by-queue.t
+++ b/t/ticket/sort-by-queue.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use RT::Test nodata => 1, tests => 8;
+use RT::Test nodata => 1, tests => 12;
use strict;
use warnings;
diff --git a/t/ticket/sort-by-user.t b/t/ticket/sort-by-user.t
index c504ea2..10d43de 100644
--- a/t/ticket/sort-by-user.t
+++ b/t/ticket/sort-by-user.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use RT::Test nodata => 1, tests => 34;
+use RT::Test nodata => 1, tests => 52;
use strict;
use warnings;
diff --git a/t/web/ticket_forward.t b/t/web/ticket_forward.t
index 37bd0cb..27785bc 100644
--- a/t/web/ticket_forward.t
+++ b/t/web/ticket_forward.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 29;
+use RT::Test tests => 30;
use File::Temp 'tempfile';
use File::Spec;
my ( $att_fh, $att_file ) =
@@ -87,7 +87,7 @@ diag "Foward Ticket without content" if $ENV{TEST_VERBOSE};
{
my $ticket = RT::Test->create_ticket(
Subject => 'test forward without content',
- Queue => 'General',
+ Queue => 1,
);
$m->get_ok( $baseurl . '/Ticket/Forward.html?id=' . $ticket->id );
$m->submit_form(
diff --git a/t/web/ticket_modify_all.t b/t/web/ticket_modify_all.t
index 351f8a5..a385c0e 100644
--- a/t/web/ticket_modify_all.t
+++ b/t/web/ticket_modify_all.t
@@ -1,11 +1,11 @@
use strict;
use warnings;
-use RT::Test tests => 11;
+use RT::Test tests => 12;
my $ticket = RT::Test->create_ticket(
Subject => 'test bulk update',
- Queue => 'General',
+ Queue => 1,
);
my ( $url, $m ) = RT::Test->started_ok;
commit e9356bcce58351072d131089216287c0097b431d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 03:27:45 2011 -0500
Ensure that a server is running at the end of the test file if not under plack
Otherwise, the warning-clean tests fail to pass, since the server has
already been stopped.
diff --git a/t/web/squish.t b/t/web/squish.t
index 9e3525e..d617ccb 100644
--- a/t/web/squish.t
+++ b/t/web/squish.t
@@ -25,7 +25,6 @@ diag "test squished files with devel mode disabled";
$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";
@@ -33,6 +32,7 @@ SKIP:
{
skip 'need plack server to reinitialize', 6
if $ENV{RT_TEST_WEB_HANDLER} && $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;
@@ -49,11 +49,11 @@ SKIP:
$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' );
commit 909fce0291385b2c9e226293149b991700e6970e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 04:17:53 2011 -0500
Always push the decided-upon handler into RT_TEST_WEB_HANDLER, to skip defined checks elsewhere
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 14ddecc..a2c444f 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1194,7 +1194,8 @@ sub started_ok {
$ENV{'RT_TEST_WEB_HANDLER'} = undef
if $rttest_opt{actual_server} && ($ENV{'RT_TEST_WEB_HANDLER'}||'') eq 'inline';
- my $which = $ENV{'RT_TEST_WEB_HANDLER'} || 'plack';
+ $ENV{'RT_TEST_WEB_HANDLER'} ||= 'plack';
+ my $which = $ENV{'RT_TEST_WEB_HANDLER'};
my ($server, $variant) = split /\+/, $which, 2;
my $function = 'start_'. $server .'_server';
@@ -1290,15 +1291,14 @@ sub stop_server {
my $in_end = shift;
my $sig = 'TERM';
- $sig = 'INT' if !$ENV{'RT_TEST_WEB_HANDLER'}
- || $ENV{'RT_TEST_WEB_HANDLER'} =~/^standalone(?:\+|\z)/;
+ $sig = 'INT' if $ENV{'RT_TEST_WEB_HANDLER'} eq "plack";
kill $sig, @SERVERS;
foreach my $pid (@SERVERS) {
waitpid $pid, 0;
}
sleep 2
- if !$in_end && $ENV{'RT_TEST_WEB_HANDLER'} && $ENV{'RT_TEST_WEB_HANDLER'} =~ /apache/;
+ if !$in_end && $ENV{'RT_TEST_WEB_HANDLER'} =~ /^apache/;
@SERVERS = ();
}
diff --git a/t/web/cf_datetime.t b/t/web/cf_datetime.t
index cc6505a..bf514d9 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} and $ENV{RT_TEST_WEB_HANDLER} =~ /apache\+mod_perl/;
+ if $ENV{RT_TEST_WEB_HANDLER} eq "apache+mod_perl";
plan tests => 51;
diff --git a/t/web/squish.t b/t/web/squish.t
index d617ccb..c331bc2 100644
--- a/t/web/squish.t
+++ b/t/web/squish.t
@@ -31,7 +31,7 @@ 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} && $ENV{RT_TEST_WEB_HANDLER} ne 'plack';
+ if $ENV{RT_TEST_WEB_HANDLER} ne 'plack';
RT::Test->stop_server;
RT->AddJavaScript( 'IE7/IE7.js' );
RT->AddStyleSheets( 'print.css' );
commit caac0b1c63fa090d9e8b5e10c1f009dbc09aaffc
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 18:04:51 2011 -0500
Always push the decided-upon apache variant into RT_TEST_WEB_HANDLER
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index a2c444f..f39b22e 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1276,6 +1276,7 @@ sub start_inline_server {
sub start_apache_server {
my $self = shift;
my $variant = shift || 'mod_perl';
+ $ENV{RT_TEST_WEB_HANDLER} = "apache+$variant";
require RT::Test::Apache;
my $pid = RT::Test::Apache->start_server($variant || 'mod_perl', $port, \%tmp);
commit 64e3f75bde4449ee2fa1113aec6580ff11ef14cb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 18:07:27 2011 -0500
Refactor apache_*_server_options into a simple data structure
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 8b1a0c4..38f3ecc 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -50,6 +50,13 @@ package RT::Test::Apache;
use strict;
use warnings;
+my %MODULES = (
+ '2.2' => {
+ "mod_perl" => [qw(authz_host env alias perl)],
+ "fastcgi" => [qw(authz_host env alias mime fastcgi)],
+ },
+);
+
my $apache_module_prefix = $ENV{RT_TEST_APACHE_MODULES};
my $apxs =
$ENV{RT_TEST_APXS}
@@ -87,16 +94,14 @@ sub start_server {
rt_bin_path => $RT::BinPath,
rt_sbin_path => $RT::SbinPath,
rt_site_config => $ENV{'RT_SITE_CONFIG'},
+ load_modules => $info{load_modules},
);
foreach (qw(log pid lock)) {
$opt{$_ .'_file'} = File::Spec->catfile(
"$tmp{'directory'}", "apache.$_"
);
}
- {
- my $method = 'apache_'.$variant.'_server_options';
- $self->$method( \%info, \%opt );
- }
+
$tmp{'config'}{'apache'} = File::Spec->catfile(
"$tmp{'directory'}", "apache.conf"
);
@@ -165,47 +170,27 @@ sub apache_server_info {
split /\r*\n/, `$bin -l`
];
- return %res;
-}
-
-sub apache_mod_perl_server_options {
- my $self = shift;
- my %info = %{ shift() };
- my $current = shift;
-
- my %required_modules = (
- '2.2' => [qw(authz_host env alias perl)],
- );
- my @mlist = @{ $required_modules{ $info{'version'} } };
-
- $current->{'load_modules'} = '';
- foreach my $mod ( @mlist ) {
- next if grep $_ =~ /^(mod_|)$mod\.c$/, @{ $info{'modules'} };
-
- $current->{'load_modules'} .=
- "LoadModule ${mod}_module $apache_module_prefix/mod_${mod}.so\n";
- }
- return;
-}
+ Test::More::BAIL_OUT(
+ "Unsupported apache version $res{version}"
+ ) unless exists $MODULES{$res{version}};
-sub apache_fastcgi_server_options {
- my $self = shift;
- my %info = %{ shift() };
- my $current = shift;
+ Test::More::BAIL_OUT(
+ "Unsupported apache variant $res{variant}"
+ ) unless exists $MODULES{$res{version}}{$res{variant}};
- my %required_modules = (
- '2.2' => [qw(authz_host env alias mime fastcgi)],
- );
- my @mlist = @{ $required_modules{ $info{'version'} } };
+ my @mlist = @{$MODULES{$res{version}}{$res{variant}}};
- $current->{'load_modules'} = '';
+ $res{'load_modules'} = '';
foreach my $mod ( @mlist ) {
- next if grep $_ =~ /^(mod_|)$mod\.c$/, @{ $info{'modules'} };
+ next if grep $_ =~ /^(mod_|)$mod\.c$/, @{ $res{'modules'} };
- $current->{'load_modules'} .=
- "LoadModule ${mod}_module $apache_module_prefix/mod_${mod}.so\n";
+ my $so_file = $apache_module_prefix."/mod_".$mod.".so";
+ Test::More::BAIL_OUT( "Couldn't load $mod module (expected in $so_file)" )
+ unless -f $so_file;
+ $res{'load_modules'} .=
+ "LoadModule ${mod}_module $so_file\n";
}
- return;
+ return %res;
}
sub find_apache_server {
commit 0b4d3766af09e2977da1a8b9d4ecbaecffad0427
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Feb 25 04:19:13 2011 -0500
Remove a possible race condition with an existant but not-yet-written-to apache PID file
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 38f3ecc..ada5b08 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -114,7 +114,7 @@ sub start_server {
$self->fork_exec($info{'executable'}, '-f', $tmp{'config'}{'apache'});
my $pid = do {
my $tries = 10;
- while ( !-e $opt{'pid_file'} ) {
+ while ( !-s $opt{'pid_file'} ) {
$tries--;
last unless $tries;
sleep 1;
commit a199c2163e696f00538f72a9c6242826dc5fe30a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Sat Feb 26 02:13:12 2011 -0500
Better document why we check caller() on ->Set during tests
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index f39b22e..aef5e61 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -314,7 +314,9 @@ sub set_config_wrapper {
*RT::Config::Set = sub {
# Determine if the caller is either from a test script, or
# from helper functions called by test script to alter
- # configuration that should be written.
+ # configuration that should be written. This is necessary
+ # because some extensions (RTIR, for example) temporarily swap
+ # configuration values out and back in Mason during requests.
my @caller = caller(1); # preserve list context
@caller = caller(0) unless @caller;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list