[Rt-commit] rt branch, test-opt, created. rt-3.8.8-614-g48354c2
Chia-liang Kao
clkao at bestpractical.com
Fri Aug 27 10:11:05 EDT 2010
The branch, test-opt has been created
at 48354c2f297b9db37ab4c046674e026fff6083dc (commit)
- Log -----------------------------------------------------------------
commit 218b6269b14d7f60813b021e34afe861c9d6f76b
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Wed Aug 25 16:52:51 2010 +0800
rework the test init sequence to allow nodb, noinitialdata, and nodata options from tests.
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 448e5d0..72c6d94 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -152,10 +152,14 @@ sub import {
$class->bootstrap_db( %args );
- RT->Init;
+ RT->InitClasses();
+ RT->InitLogging();
$class->bootstrap_plugins( %args );
+ RT->InitPlugins();
+ RT->Config->PostLoadCheck;
+
$class->set_config_wrapper;
my $screen_logger = $RT::Logger->remove( 'screen' );
@@ -348,39 +352,48 @@ sub bootstrap_db {
RT::Handle->DropDatabase( $dbh, Force => 1 );
}
- RT::Handle->CreateDatabase( $dbh );
- $dbh->disconnect;
- $created_new_db++;
+ if ($args{nodb}) {
+ $args{noinitialdata} = 1;
+ $args{nodata} = 1;
+ }
- $dbh = _get_dbh(RT::Handle->DSN,
- $ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD});
+ unless ($args{nodb}) {
+ RT::Handle->CreateDatabase( $dbh );
+ $dbh->disconnect;
+ $created_new_db++;
- $RT::Handle = RT::Handle->new;
- $RT::Handle->dbh( $dbh );
- $RT::Handle->InsertSchema( $dbh );
+ $dbh = _get_dbh(RT::Handle->DSN,
+ $ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD});
- my $db_type = RT->Config->Get('DatabaseType');
- $RT::Handle->InsertACL( $dbh ) unless $db_type eq 'Oracle';
+ $RT::Handle = RT::Handle->new;
+ $RT::Handle->dbh( $dbh );
+ $RT::Handle->InsertSchema( $dbh );
- $RT::Handle = RT::Handle->new;
- $RT::Handle->dbh( undef );
- RT->ConnectToDatabase;
- RT->InitLogging;
- RT->InitSystemObjects;
- $RT::Handle->InsertInitialData;
+ my $db_type = RT->Config->Get('DatabaseType');
+ $RT::Handle->InsertACL( $dbh ) unless $db_type eq 'Oracle';
- DBIx::SearchBuilder::Record::Cachable->FlushCache;
- $RT::Handle = RT::Handle->new;
- $RT::Handle->dbh( undef );
- RT->Init;
+ $RT::Handle = RT::Handle->new;
+ $RT::Handle->dbh( undef );
+ RT->ConnectToDatabase;
+ RT->InitLogging;
+
+ unless ($args{noinitialdata}) {
+ $RT::Handle->InsertInitialData;
- $RT::Handle->PrintError;
- $RT::Handle->dbh->{PrintError} = 1;
+ DBIx::SearchBuilder::Record::Cachable->FlushCache;
+ }
+
+ $RT::Handle = RT::Handle->new;
+ $RT::Handle->dbh( undef );
+ RT->ConnectToDatabase();
+ $RT::Handle->PrintError;
+ $RT::Handle->dbh->{PrintError} = 1;
- unless ( $args{'nodata'} ) {
- $RT::Handle->InsertData( $RT::EtcPath . "/initialdata" );
+ unless ( $args{'nodata'} ) {
+ $RT::Handle->InsertData( $RT::EtcPath . "/initialdata" );
+ DBIx::SearchBuilder::Record::Cachable->FlushCache;
+ }
}
- DBIx::SearchBuilder::Record::Cachable->FlushCache;
}
sub bootstrap_plugins {
diff --git a/t/00-compile.t b/t/00-compile.t
index 1a89e77..3c5b92c 100644
--- a/t/00-compile.t
+++ b/t/00-compile.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 31;
+use RT::Test nodb => 1, tests => 31;
require_ok("RT");
require_ok("RT::Test");
diff --git a/t/00-mason-syntax.t b/t/00-mason-syntax.t
index a451805..9e29acd 100644
--- a/t/00-mason-syntax.t
+++ b/t/00-mason-syntax.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 1;
+use RT::Test nodb => 1, tests => 1;
my $ok = 1;
diff --git a/t/api/i18n.t b/t/api/i18n.t
index 17d71b7..6c0da4b 100644
--- a/t/api/i18n.t
+++ b/t/api/i18n.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 9;
+use RT::Test nodb => 1, tests => 9;
{
diff --git a/t/api/queue.t b/t/api/queue.t
index 44d5caf..7346ed4 100644
--- a/t/api/queue.t
+++ b/t/api/queue.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 24;
+use RT::Test nodata => 1, tests => 24;
{
diff --git a/t/mail/mime_decoding.t b/t/mail/mime_decoding.t
index b0093c5..e5449ef 100644
--- a/t/mail/mime_decoding.t
+++ b/t/mail/mime_decoding.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 7;
+use RT::Test nodb => 1, tests => 7;
use_ok('RT::I18N');
diff --git a/t/mail/wrong_mime_charset.t b/t/mail/wrong_mime_charset.t
index f53c872..b0079f8 100644
--- a/t/mail/wrong_mime_charset.t
+++ b/t/mail/wrong_mime_charset.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 3;
+use RT::Test nodb => 1, tests => 3;
use_ok('RT::I18N');
use utf8;
commit da43504d0577ee919086a43b661f60ad627032ad
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Wed Aug 25 20:45:53 2010 +0800
avoid creating db or inserting initialdata for tests that don't need them
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 72c6d94..bcee9fc 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -352,10 +352,18 @@ sub bootstrap_db {
RT::Handle->DropDatabase( $dbh, Force => 1 );
}
+ if (my $forceopt = $ENV{RT_TEST_FORCE_OPT}) {
+ Test::More::diag "forcing $forceopt";
+ $args{$forceopt}=1;
+ }
+
if ($args{nodb}) {
$args{noinitialdata} = 1;
$args{nodata} = 1;
}
+ elsif ($args{noinitialdata}) {
+ $args{nodata} = 1;
+ }
unless ($args{nodb}) {
RT::Handle->CreateDatabase( $dbh );
diff --git a/t/api/ace.t b/t/api/ace.t
index 4031046..8898d76 100644
--- a/t/api/ace.t
+++ b/t/api/ace.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 76;
+use RT::Test nodata => 1, tests => 76;
{
diff --git a/t/api/attachment.t b/t/api/attachment.t
index 07c46ba..c6ab366 100644
--- a/t/api/attachment.t
+++ b/t/api/attachment.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 4;
+use RT::Test nodb => 1, tests => 4;
{
diff --git a/t/api/attribute-tests.t b/t/api/attribute-tests.t
index 90c3ddb..71250a8 100644
--- a/t/api/attribute-tests.t
+++ b/t/api/attribute-tests.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 34;
+use RT::Test nodata => 1, tests => 34;
diff --git a/t/api/attribute.t b/t/api/attribute.t
index cb2626a..0f0d456 100644
--- a/t/api/attribute.t
+++ b/t/api/attribute.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 7;
+use RT::Test nodata => 1, tests => 7;
{
diff --git a/t/api/cf.t b/t/api/cf.t
index 98114c9..b82643e 100644
--- a/t/api/cf.t
+++ b/t/api/cf.t
@@ -3,7 +3,7 @@
use strict;
use warnings FATAL => 'all';
-use RT::Test tests => 139;
+use RT::Test nodata => 1, tests => 139;
# Before we get going, ditch all object_cfs; this will remove
# all custom fields systemwide;
diff --git a/t/api/cf_combo_cascade.t b/t/api/cf_combo_cascade.t
index b37345a..ce5e074 100644
--- a/t/api/cf_combo_cascade.t
+++ b/t/api/cf_combo_cascade.t
@@ -2,7 +2,7 @@
use warnings;
use strict;
-use RT::Test tests => 11;
+use RT::Test nodata => 1, tests => 11;
sub fails { ok(!$_[0], "This should fail: $_[1]") }
sub works { ok($_[0], $_[1] || 'This works') }
diff --git a/t/api/cf_date_search.t b/t/api/cf_date_search.t
index 15abd70..aea2925 100644
--- a/t/api/cf_date_search.t
+++ b/t/api/cf_date_search.t
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use RT::Test tests => 13;
+use RT::Test nodata => 1, tests => 13;
my $q = RT::Queue->new($RT::SystemUser);
ok( $q->Create( Name => 'DateCFTest' . $$ ), 'create queue' );
diff --git a/t/api/cf_datetime_search.t b/t/api/cf_datetime_search.t
index d0884f4..44582e1 100644
--- a/t/api/cf_datetime_search.t
+++ b/t/api/cf_datetime_search.t
@@ -3,7 +3,7 @@
use warnings;
use strict;
-use RT::Test tests => 14;
+use RT::Test nodata => 1, tests => 14;
RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
my $q = RT::Queue->new($RT::SystemUser);
diff --git a/t/api/cf_pattern.t b/t/api/cf_pattern.t
index ffc5b3f..cf791bc 100644
--- a/t/api/cf_pattern.t
+++ b/t/api/cf_pattern.t
@@ -3,7 +3,7 @@ use warnings;
use strict;
use RT;
-use RT::Test tests => 17;
+use RT::Test nodata => 1, tests => 17;
sub fails { ok(!$_[0], "This should fail: $_[1]") }
diff --git a/t/api/cf_single_values.t b/t/api/cf_single_values.t
index 8e96edd..4beb293 100644
--- a/t/api/cf_single_values.t
+++ b/t/api/cf_single_values.t
@@ -3,7 +3,7 @@ use warnings;
use strict;
use RT;
-use RT::Test tests => 8;
+use RT::Test nodata => 1, tests => 8;
diff --git a/t/api/cf_transaction.t b/t/api/cf_transaction.t
index 1ed2ab9..589151f 100644
--- a/t/api/cf_transaction.t
+++ b/t/api/cf_transaction.t
@@ -4,7 +4,7 @@ use warnings;
use strict;
use Data::Dumper;
-use RT::Test tests => 14;
+use RT::Test nodata => 1, tests => 14;
use_ok('RT');
use_ok('RT::Transactions');
diff --git a/t/api/config.t b/t/api/config.t
index 8e24be0..a986c3c 100644
--- a/t/api/config.t
+++ b/t/api/config.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 9;
+use RT::Test nodb => 1, tests => 9;
ok(
RT::Config->AddOption(
diff --git a/t/api/currentuser.t b/t/api/currentuser.t
index c158048..c568b0e 100644
--- a/t/api/currentuser.t
+++ b/t/api/currentuser.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 8;
+use RT::Test noinitialdata => 1, tests => 8;
{
diff --git a/t/api/customfield.t b/t/api/customfield.t
index 44319c4..2347d61 100644
--- a/t/api/customfield.t
+++ b/t/api/customfield.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 29;
+use RT::Test nodata => 1, tests => 29;
use Test::Warn;
diff --git a/t/api/emailparser.t b/t/api/emailparser.t
index 940c26f..18826fe 100644
--- a/t/api/emailparser.t
+++ b/t/api/emailparser.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 4;
+use RT::Test nodb => 1, tests => 4;
RT->Config->Set( RTAddressRegexp => qr/^rt\@example.com$/i );
diff --git a/t/api/group.t b/t/api/group.t
index 551d4f1..19dfd34 100644
--- a/t/api/group.t
+++ b/t/api/group.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 38;
+use RT::Test nodata => 1, tests => 38;
{
diff --git a/t/api/groups.t b/t/api/groups.t
index 9a482f5..f83468c 100644
--- a/t/api/groups.t
+++ b/t/api/groups.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use RT::Test tests => 27;
+use RT::Test nodata => 1, tests => 27;
RT::Group->AddRights(
'RTxGroupRight' => 'Just a right for testing rights',
diff --git a/t/api/link.t b/t/api/link.t
index 0903525..d550227 100644
--- a/t/api/link.t
+++ b/t/api/link.t
@@ -2,8 +2,8 @@
use strict;
use warnings;
-use RT::Test tests => 83;
-use RT::Test::Web;
+use RT::Test nodata => 1, tests => 83;
+use RT::Test nodata => 1, tests => 83;
use RT::Link;
my $link = RT::Link->new($RT::SystemUser);
diff --git a/t/api/rights.t b/t/api/rights.t
index a38bcea..b9f742a 100644
--- a/t/api/rights.t
+++ b/t/api/rights.t
@@ -47,7 +47,7 @@
#
# END BPS TAGGED BLOCK }}}
-use RT::Test tests => 30;
+use RT::Test nodata => 1, tests => 30;
use strict;
use warnings;
diff --git a/t/api/rights_show_ticket.t b/t/api/rights_show_ticket.t
index 3e1d074..4d4474e 100644
--- a/t/api/rights_show_ticket.t
+++ b/t/api/rights_show_ticket.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
-use RT::Test tests => 264;
+use RT::Test nodata => 1, tests => 264;
use strict;
use warnings;
diff --git a/t/api/rt.t b/t/api/rt.t
index 3c06b58..4081a4f 100644
--- a/t/api/rt.t
+++ b/t/api/rt.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 4;
+use RT::Test nodata => 1, tests => 4;
{
diff --git a/t/api/system.t b/t/api/system.t
index 3077115..1979032 100644
--- a/t/api/system.t
+++ b/t/api/system.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 7;
+use RT::Test nodata => 1, tests => 7;
{
diff --git a/t/clicky.t b/t/clicky.t
index 9baa2af..0f16db6 100644
--- a/t/clicky.t
+++ b/t/clicky.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More;
-use RT::Test tests => 14;
+use RT::Test nodb => 1, tests => 14;
my %clicky;
BEGIN {
diff --git a/t/cron.t b/t/cron.t
index 29d7bd7..e28896f 100644
--- a/t/cron.t
+++ b/t/cron.t
@@ -3,7 +3,7 @@
use strict;
use RT;
-use RT::Test tests => 18;
+use RT::Test nodata => 1, tests => 18;
### Set up some testing data. Test the testing data because why not?
diff --git a/t/customfields/access_via_queue.t b/t/customfields/access_via_queue.t
index f372f31..2c442bf 100644
--- a/t/customfields/access_via_queue.t
+++ b/t/customfields/access_via_queue.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 35;
+use RT::Test nodata => 1, tests => 35;
use RT::Ticket;
use RT::CustomField;
diff --git a/t/delegation/cleanup_stalled.t b/t/delegation/cleanup_stalled.t
index f108ecc..750576d 100644
--- a/t/delegation/cleanup_stalled.t
+++ b/t/delegation/cleanup_stalled.t
@@ -15,7 +15,7 @@ use warnings;
use RT;
-use RT::Test tests => 98;
+use RT::Test nodata => 1, tests => 98;
my ($u1, $u2, $g1, $g2, $g3, $pg1, $pg2, $ace, @groups, @users, @principals);
@groups = (\$g1, \$g2, \$g3, \$pg1, \$pg2);
diff --git a/t/delegation/revocation.t b/t/delegation/revocation.t
index 151525e..2cde33c 100644
--- a/t/delegation/revocation.t
+++ b/t/delegation/revocation.t
@@ -5,7 +5,7 @@ use warnings;
use RT;
-use RT::Test tests => 22;
+use RT::Test nodata => 1, tests => 22;
my ($u1, $g1, $pg1, $pg2, $ace, @groups, @users, @principals);
@groups = (\$g1, \$pg1, \$pg2);
diff --git a/t/i18n/default.t b/t/i18n/default.t
index 6c9842a..d580f97 100644
--- a/t/i18n/default.t
+++ b/t/i18n/default.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 8;
+use RT::Test nodb => 1, tests => 8;
my ($baseurl, $m) = RT::Test->started_ok;
$m->get_ok('/');
diff --git a/t/mail/verp.t b/t/mail/verp.t
index 79ede90..ed3af6a 100644
--- a/t/mail/verp.t
+++ b/t/mail/verp.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use RT::Test tests => 1;
+use RT::Test nodb => 1, tests => 1;
TODO: {
todo_skip "No tests written for VERP yet", 1;
ok(1,"a test to skip");
diff --git a/t/shredder/00load.t b/t/shredder/00load.t
index 1e06261..21d5ef7 100644
--- a/t/shredder/00load.t
+++ b/t/shredder/00load.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use File::Spec;
use Test::More tests => 11;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/t/shredder/00skeleton.t b/t/shredder/00skeleton.t
index eab9433..3592429 100644
--- a/t/shredder/00skeleton.t
+++ b/t/shredder/00skeleton.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 1;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/01basics.t b/t/shredder/01basics.t
index 450f2df..069b96f 100644
--- a/t/shredder/01basics.t
+++ b/t/shredder/01basics.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 3;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/01ticket.t b/t/shredder/01ticket.t
index 5625b98..8052e7c 100644
--- a/t/shredder/01ticket.t
+++ b/t/shredder/01ticket.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 15;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
diff --git a/t/shredder/02group_member.t b/t/shredder/02group_member.t
index c391f74..d6815f4 100644
--- a/t/shredder/02group_member.t
+++ b/t/shredder/02group_member.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 22;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/02queue.t b/t/shredder/02queue.t
index 8e3abf3..ab7d541 100644
--- a/t/shredder/02queue.t
+++ b/t/shredder/02queue.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 16;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/02template.t b/t/shredder/02template.t
index 14bda86..769a858 100644
--- a/t/shredder/02template.t
+++ b/t/shredder/02template.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 7;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/02user.t b/t/shredder/02user.t
index 03abd6c..4745e2d 100644
--- a/t/shredder/02user.t
+++ b/t/shredder/02user.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 8;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/03plugin.t b/t/shredder/03plugin.t
index cf51e44..25b1222 100644
--- a/t/shredder/03plugin.t
+++ b/t/shredder/03plugin.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 28;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/03plugin_summary.t b/t/shredder/03plugin_summary.t
index 606cd67..2744531 100644
--- a/t/shredder/03plugin_summary.t
+++ b/t/shredder/03plugin_summary.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 4;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/03plugin_tickets.t b/t/shredder/03plugin_tickets.t
index 57ab0af..08bb15b 100644
--- a/t/shredder/03plugin_tickets.t
+++ b/t/shredder/03plugin_tickets.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 44;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/shredder/03plugin_users.t b/t/shredder/03plugin_users.t
index e49dd7b..4f4ecc8 100644
--- a/t/shredder/03plugin_users.t
+++ b/t/shredder/03plugin_users.t
@@ -6,7 +6,7 @@ use warnings;
use Test::Deep;
use File::Spec;
use Test::More tests => 9;
-use RT::Test ();
+use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
File::Spec->curdir());
diff --git a/t/ticket/add-watchers.t b/t/ticket/add-watchers.t
index ae993a9..19b1fcb 100644
--- a/t/ticket/add-watchers.t
+++ b/t/ticket/add-watchers.t
@@ -45,7 +45,7 @@
#
# END BPS TAGGED BLOCK }}}
-use RT::Test tests => 32;
+use RT::Test nodata => 1, tests => 32;
use strict;
use warnings;
diff --git a/t/ticket/cfsort-freeform-multiple.t b/t/ticket/cfsort-freeform-multiple.t
index b5fd93b..b7bcc0a 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 tests => 24;
+use RT::Test nodata => 1, tests => 24;
use strict;
use warnings;
diff --git a/t/ticket/cfsort-freeform-single.t b/t/ticket/cfsort-freeform-single.t
index 4bf3300..bae7707 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 tests => 57;
+use RT::Test nodata => 1, tests => 57;
use strict;
use warnings;
diff --git a/t/ticket/deferred_owner.t b/t/ticket/deferred_owner.t
index 917bbcd..4b9cb02 100644
--- a/t/ticket/deferred_owner.t
+++ b/t/ticket/deferred_owner.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 18;
+use RT::Test nodata => 1, tests => 18;
use_ok('RT');
use_ok('RT::Ticket');
use Test::Warn;
diff --git a/t/ticket/search.t b/t/ticket/search.t
index 9cec4f7..849ce46 100644
--- a/t/ticket/search.t
+++ b/t/ticket/search.t
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use RT::Test tests => 43;
+use RT::Test nodata => 1, tests => 43;
# setup the queue
diff --git a/t/ticket/search_by_cf_freeform_multiple.t b/t/ticket/search_by_cf_freeform_multiple.t
index 8793a7c..0499a31 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 tests => 105;
+use RT::Test nodata => 1, tests => 105;
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 f597071..4fe598c 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 tests => 99;
+use RT::Test nodata => 1, tests => 99;
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 611c158..462a766 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 tests => 80;
+use RT::Test nodata => 1, tests => 80;
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 b3a16db..57c3a46 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 tests => 119;
+use RT::Test nodata => 1, tests => 119;
use RT::Ticket;
my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
diff --git a/t/ticket/search_long_cf_values.t b/t/ticket/search_long_cf_values.t
index f9cc7b5..339ad70 100644
--- a/t/ticket/search_long_cf_values.t
+++ b/t/ticket/search_long_cf_values.t
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use RT::Test tests => 10;
+use RT::Test nodata => 1, tests => 10;
# setup the queue
diff --git a/t/ticket/sort-by-custom-ownership.t b/t/ticket/sort-by-custom-ownership.t
index b358a99..3e5df64 100644
--- a/t/ticket/sort-by-custom-ownership.t
+++ b/t/ticket/sort-by-custom-ownership.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use RT;
-use RT::Test tests => 7;
+use RT::Test nodata => 1, tests => 7;
use strict;
diff --git a/t/ticket/sort-by-queue.t b/t/ticket/sort-by-queue.t
index 8f89bd3..881a59d 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 tests => 8;
+use RT::Test nodata => 1, tests => 8;
use strict;
use warnings;
diff --git a/t/ticket/sort-by-user.t b/t/ticket/sort-by-user.t
index d1aae1a..b5f6552 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 tests => 32;
+use RT::Test nodata => 1, tests => 32;
use strict;
use warnings;
diff --git a/t/ticket/sort_by_cf.t b/t/ticket/sort_by_cf.t
index 7e25884..8999942 100644
--- a/t/ticket/sort_by_cf.t
+++ b/t/ticket/sort_by_cf.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-use RT::Test tests => 21;
+use RT::Test nodata => 1, tests => 21;
RT::Init();
use strict;
diff --git a/t/web/config_tab_right.t b/t/web/config_tab_right.t
index 4dc9ec0..d7f4cbf 100644
--- a/t/web/config_tab_right.t
+++ b/t/web/config_tab_right.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 8;
+use RT::Test nodata => 1, tests => 8;
my ($uname, $upass, $user) = ('tester', 'tester');
{
diff --git a/t/web/dashboards-groups.t b/t/web/dashboards-groups.t
index cbf1d6a..6b39d01 100644
--- a/t/web/dashboards-groups.t
+++ b/t/web/dashboards-groups.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use RT::Test tests => 40;
+use RT::Test nodata => 1, tests => 40;
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
diff --git a/t/web/dashboards-permissions.t b/t/web/dashboards-permissions.t
index 1724042..8dc7532 100644
--- a/t/web/dashboards-permissions.t
+++ b/t/web/dashboards-permissions.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test tests => 7;
+use RT::Test nodata => 1, tests => 7;
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
diff --git a/t/web/rights1.t b/t/web/rights1.t
index c8892f2..28fac73 100644
--- a/t/web/rights1.t
+++ b/t/web/rights1.t
@@ -2,7 +2,7 @@
use strict;
use HTTP::Cookies;
-use RT::Test tests => 29;
+use RT::Test nodata => 1, tests => 29;
my ($baseurl, $agent) = RT::Test->started_ok;
# Create a user with basically no rights, to start.
diff --git a/t/web/ticket_owner.t b/t/web/ticket_owner.t
index 0460436..d018ec1 100644
--- a/t/web/ticket_owner.t
+++ b/t/web/ticket_owner.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 89;
+use RT::Test nodata => 1, tests => 89;
my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
ok $queue && $queue->id, 'loaded or created queue';
diff --git a/t/web/ticket_owner_autocomplete.t b/t/web/ticket_owner_autocomplete.t
index 9263a75..07f90f2 100644
--- a/t/web/ticket_owner_autocomplete.t
+++ b/t/web/ticket_owner_autocomplete.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 41;
+use RT::Test nodata => 1, tests => 41;
use JSON qw(from_json);
my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
diff --git a/t/web/ticket_seen.t b/t/web/ticket_seen.t
index 748f2cb..a285c6a 100644
--- a/t/web/ticket_seen.t
+++ b/t/web/ticket_seen.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use RT::Test tests => 21;
+use RT::Test nodata => 1, tests => 21;
my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
ok $queue && $queue->id, 'loaded or created queue';
commit 2198da82f25fee042c50c678c120536a5be3f268
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Thu Aug 26 10:28:35 2010 +0800
pg really wants reconnecting to db
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index bcee9fc..e84434a 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -152,12 +152,17 @@ sub import {
$class->bootstrap_db( %args );
- RT->InitClasses();
- RT->InitLogging();
+ RT::InitPluginPaths();
+
+ RT::ConnectToDatabase()
+ unless $args{nodb};
+
+ RT::InitClasses();
+ RT::InitLogging();
$class->bootstrap_plugins( %args );
- RT->InitPlugins();
+ RT::InitPlugins();
RT->Config->PostLoadCheck;
$class->set_config_wrapper;
@@ -437,7 +442,6 @@ sub bootstrap_plugins {
};
RT->Config->Set( Plugins => @plugins );
- RT->InitPluginPaths;
my $dba_dbh;
$dba_dbh = _get_dbh(
commit 98ce1548fd86f784806c29aaad9a6e165938274e
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Thu Aug 26 10:49:47 2010 +0800
Fix test planning
diff --git a/t/api/link.t b/t/api/link.t
index d550227..f8b86ba 100644
--- a/t/api/link.t
+++ b/t/api/link.t
@@ -3,7 +3,7 @@ use strict;
use warnings;
use RT::Test nodata => 1, tests => 83;
-use RT::Test nodata => 1, tests => 83;
+use RT::Test::Web;
use RT::Link;
my $link = RT::Link->new($RT::SystemUser);
commit a42371e2cf85edd99806864758ee1a44d24a26fc
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Thu Aug 26 11:28:52 2010 +0800
Don't drop db on nodb
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index e84434a..07e0aa3 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -352,11 +352,6 @@ sub bootstrap_db {
my $dbh = _get_dbh(RT::Handle->SystemDSN,
$ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD});
- unless ( $ENV{RT_TEST_PARALLEL} ) {
- # already dropped db in parallel tests, need to do so for other cases.
- RT::Handle->DropDatabase( $dbh, Force => 1 );
- }
-
if (my $forceopt = $ENV{RT_TEST_FORCE_OPT}) {
Test::More::diag "forcing $forceopt";
$args{$forceopt}=1;
@@ -371,6 +366,10 @@ sub bootstrap_db {
}
unless ($args{nodb}) {
+ unless ( $ENV{RT_TEST_PARALLEL} ) {
+ # already dropped db in parallel tests, need to do so for other cases.
+ RT::Handle->DropDatabase( $dbh, Force => 1 )
+ }
RT::Handle->CreateDatabase( $dbh );
$dbh->disconnect;
$created_new_db++;
commit 81e42d225496b6fb2118dd58df6f55faca29b55c
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Fri Aug 27 15:34:38 2010 +0800
web tests require db to exist
diff --git a/t/clicky.t b/t/clicky.t
index 0f16db6..b72ae9b 100644
--- a/t/clicky.t
+++ b/t/clicky.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More;
-use RT::Test nodb => 1, tests => 14;
+use RT::Test noinitialdata => 1, tests => 14;
my %clicky;
BEGIN {
diff --git a/t/i18n/default.t b/t/i18n/default.t
index d580f97..cc6f136 100644
--- a/t/i18n/default.t
+++ b/t/i18n/default.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use RT::Test nodb => 1, tests => 8;
+use RT::Test noinitialdata => 1, tests => 8;
my ($baseurl, $m) = RT::Test->started_ok;
$m->get_ok('/');
commit 48354c2f297b9db37ab4c046674e026fff6083dc
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Fri Aug 27 15:34:56 2010 +0800
warn about test server and nodb flag
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 07e0aa3..1b7f846 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -88,6 +88,8 @@ my %tmp = (
mailbox => undef,
);
+my %rttest_opt;
+
=head1 NAME
RT::Test - RT Testing
@@ -130,7 +132,7 @@ BEGIN {
sub import {
my $class = shift;
- my %args = @_;
+ my %args = %rttest_opt = @_;
# Spit out a plan (if we got one) *before* we load modules
if ( $args{'tests'} ) {
@@ -1077,6 +1079,10 @@ sub started_ok {
require RT::Test::Web;
+ if ($rttest_opt{nodb}) {
+ die "you are trying to use a test web server without db, try use noinitialdata => 1 instead";
+ }
+
my $which = $ENV{'RT_TEST_WEB_HANDLER'} || 'standalone';
my ($server, $variant) = split /\+/, $which, 2;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list