fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-08-28 06:06 am

[dw-free] fix t/dev-setup.t

[commit: http://hg.dwscoalition.org/dw-free/rev/374caf99bd84]

http://bugs.dwscoalition.org/show_bug.cgi?id=2808

Skip over parts of the tests for unclustered dev setups.

Patch by [personal profile] kareila.

Files modified:
  • t/dev-setup.t
--------------------------------------------------------------------------------
diff -r 60737893fbda -r 374caf99bd84 t/dev-setup.t
--- a/t/dev-setup.t	Fri Aug 27 22:05:07 2010 -0500
+++ b/t/dev-setup.t	Sat Aug 28 14:06:42 2010 +0800
@@ -5,19 +5,22 @@ use lib "$ENV{LJHOME}/cgi-bin";
 use lib "$ENV{LJHOME}/cgi-bin";
 require 'ljlib.pl';
 
-plan skip_all => "Fix this test!";
 if ($LJ::IS_DEV_SERVER) {
-    plan tests => 6;
+    plan 'no_plan';
 } else {
     plan skip_all => "not a developer machine";
     exit 0;
 }
 
+my $clustered = ( scalar @LJ::CLUSTERS < 2 ) ? 0 : 1;
+
 my $u = LJ::load_user("system");
-ok($u);
+ok( $u, "loaded system user" );
 
-ok(scalar @LJ::CLUSTERS >= 2, "have 2 or more clusters");
-ok(scalar keys %LJ::DBINFO >= 3, "have 3 or more dbinfo config sections");
+if ( $clustered ) {  # don't complain about nonclustered dev setups
+    ok( $clustered, "have 2 or more clusters" );
+    ok(scalar keys %LJ::DBINFO >= 3, "have 3 or more dbinfo config sections");
+}
 
 {
     my %have = ();
@@ -31,6 +34,7 @@ while (my ($n, $inf) = each %LJ::DBINFO)
 while (my ($n, $inf) = each %LJ::DBINFO) {
     if ($n eq "master") {
         ok(1, "have a master section");
+        next unless $clustered;
         my $user_on_master = 0;
         foreach my $cid (@LJ::CLUSTERS) {
             $user_on_master = 1 if
@@ -39,4 +43,3 @@ while (my ($n, $inf) = each %LJ::DBINFO)
         ok(!$user_on_master, "you don't have a cluster configured on a master");
     }
 }
-
--------------------------------------------------------------------------------