[dw-free] Per-user poll votes not being fetched when the voter is on a different cluster than journa
[commit: http://hg.dwscoalition.org/dw-free/rev/8425401f97b1]
http://bugs.dwscoalition.org/show_bug.cgi?id=3925
Skip tests if we don't have multiple appropriate clusters.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3925
Skip tests if we don't have multiple appropriate clusters.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/Test.pm
- t/poll.t
-------------------------------------------------------------------------------- diff -r 76474a4be4cf -r 8425401f97b1 cgi-bin/LJ/Test.pm --- a/cgi-bin/LJ/Test.pm Sat Sep 03 01:07:07 2011 +0800 +++ b/cgi-bin/LJ/Test.pm Mon Sep 05 15:55:56 2011 +0800 @@ -73,6 +73,7 @@ my %args = @_; my $underscore = delete $args{'underscore'}; my $journaltype = delete $args{'journaltype'} || "P"; + my $cluster = delete $args{cluster}; croak('unknown args') if %args; my $pfx = $underscore ? "_" : "t_"; @@ -83,6 +84,7 @@ name => "test account $username", email => "test\@$LJ::DOMAIN", journaltype => $journaltype, + cluster => $cluster, }); if ($uid) { my $u = LJ::load_userid($uid) or next; diff -r 76474a4be4cf -r 8425401f97b1 t/poll.t --- a/t/poll.t Sat Sep 03 01:07:07 2011 +0800 +++ b/t/poll.t Mon Sep 05 15:55:56 2011 +0800 @@ -5,13 +5,17 @@ use lib "$ENV{LJHOME}/cgi-bin"; require 'ljlib.pl'; +if ( @LJ::CLUSTERS < 2 || @{$LJ::DEFAULT_CLUSTER||[]} < 2) { + plan skip_all => "Less than two clusters."; + exit 0; +} + use LJ::Test qw( temp_user ); use LJ::Poll; note( "Set up a poll where the voter is on a different cluster" ); { - $LJ::DEFAULT_CLUSTER = 1; - my $poll_journal = temp_user(); + my $poll_journal = temp_user( cluster => $LJ::DEFAULT_CLUSTER->[0] ); my $entry = $poll_journal->t_post_fake_entry(); my $poll = LJ::Poll->create( @@ -25,8 +29,7 @@ ); - $LJ::DEFAULT_CLUSTER = 2; - my $voter = temp_user(); + my $voter = temp_user( cluster => $LJ::DEFAULT_CLUSTER->[1] ); LJ::set_remote( $voter ); LJ::Poll->process_submission( { pollid => $poll->id, "pollq-1" => "voter's answers" } ); --------------------------------------------------------------------------------