[Rt-commit] rt branch, 4.0/invalid-queue-cache-on-name-change, created. rt-4.0.6-251-gbb0c7ad

Kevin Falcone falcone at bestpractical.com
Fri Aug 3 11:46:31 EDT 2012


The branch, 4.0/invalid-queue-cache-on-name-change has been created
        at  bb0c7adedcd652efe1c713cef1596933bc5bd7f6 (commit)

- Log -----------------------------------------------------------------
commit e1a706163282d0f94b493affe361604bbc3e25e6
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Aug 3 11:15:14 2012 -0400

    Switch tests to check names of queues in addition to ids of queues
    
    Otherwise we weren't noticing that a queue name change listed the
    correct queue (id wise) in the Select Queue dropdown, but missed the
    name change.

diff --git a/t/web/queue_caching.t b/t/web/queue_caching.t
index d90aacb..6d13221 100644
--- a/t/web/queue_caching.t
+++ b/t/web/queue_caching.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use RT::Test tests => 36;
+use RT::Test tests => 42;
 
 # make an initial queue, so we have more than 1
 my $original_test_queue = new_queue("Test$$");
@@ -47,7 +47,7 @@ my $a_m = RT::Test::Web->new;
 ok $a_m->login('user_a', 'password'), 'logged in as user A';
 
 # check that they see a single queue
-check_queues($a_m,[$original_test_queue->Id]);
+check_queues($a_m,[$original_test_queue->Id],[$original_test_queue->Name]);
 
 ok( RT::Test->add_rights(
         { Principal => $user_a, Right => [qw(SeeQueue CreateTicket)] },
@@ -75,16 +75,22 @@ sub internal_queues {
 }
 
 
-# takes a WWW::Mech object and an optional arrayref of queue ids
-# compares the list of ids to the dropdown of Queues for the New Ticket In form
+# takes a WWW::Mech object and two optional arrayrefs of queue ids and names
+# compares the list of ids and names to the dropdown of Queues for the New Ticket In form
 sub check_queues {
-    my $browser = shift;
-    my $queue_list = shift;
+    my ($browser, $queue_id_list, $queue_name_list) = @_;
     $browser->get_ok($baseurl,"Navigated to homepage");
     ok(my $form = $browser->form_name('CreateTicketInQueue'), "Found New Ticket In form");
     ok(my $queuelist = $form->find_input('Queue','option'), "Found queue select");
-    my @queues = $queuelist->possible_values;
 
-    $queue_list = [keys %{internal_queues()}] unless $queue_list;
-    is_deeply([sort @queues],[sort @$queue_list], "Queue list contains the expected queues");
+    my @queue_ids = $queuelist->possible_values;
+    my @queue_names = $queuelist->value_names;
+
+    my $full_queue_list = internal_queues();
+    $queue_id_list = [keys %$full_queue_list] unless $queue_id_list;
+    $queue_name_list = [values %$full_queue_list] unless $queue_name_list;
+    is_deeply([sort @queue_ids],[sort @$queue_id_list],
+              "Queue list contains the expected queue ids");
+    is_deeply([sort @queue_names],[sort @$queue_name_list],
+              "Queue list contains the expected queue namess");
 }

commit bb0c7adedcd652efe1c713cef1596933bc5bd7f6
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Aug 3 11:17:01 2012 -0400

    Test that changing a Queue's name is reflected in the dropdowns
    
    We're doing this in _Set because the Description is also cached (although
    currently unused) and it probably makes sense to just bust the cache a
    little more often rather than end up with another bug like this.

diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index 406df92..4d44260 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -1212,6 +1212,7 @@ sub _Set {
     unless ( $self->CurrentUserHasRight('AdminQueue') ) {
         return ( 0, $self->loc('Permission Denied') );
     }
+    RT->System->QueueCacheNeedsUpdate(1);
     return ( $self->SUPER::_Set(@_) );
 }
 
diff --git a/t/web/queue_caching.t b/t/web/queue_caching.t
index 6d13221..d485711 100644
--- a/t/web/queue_caching.t
+++ b/t/web/queue_caching.t
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use RT::Test tests => 42;
+use RT::Test tests => 48;
 
 # make an initial queue, so we have more than 1
 my $original_test_queue = new_queue("Test$$");
@@ -31,6 +31,12 @@ diag("Bring back a disabled queue");
     check_queues($m);
 }
 
+diag("Rename the original queue, make sure the name change is uncached");
+{
+    ok($original_test_queue->SetName("Name Change $$"));
+    check_queues($m);
+}
+
 diag("Test a user who has more limited rights Queues");
 {
 

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


More information about the Rt-commit mailing list