[Rt-commit] rtir branch, 4.0/pass-tests, created. 4.0.1rc1-41-g7361a199

? sunnavy sunnavy at bestpractical.com
Fri Mar 9 14:48:53 EST 2018


The branch, 4.0/pass-tests has been created
        at  7361a19942bca9f927efc4162540cd5163285a82 (commit)

- Log -----------------------------------------------------------------
commit 345f1714eced41ad5ef98fc27655aa82a47f1ef6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 00:12:08 2018 +0800

    Auth::Crypt has been removed from plugin since RT 4.4

diff --git a/lib/RT/IR/Test/GnuPG.pm b/lib/RT/IR/Test/GnuPG.pm
index f619a344..82bb0de8 100644
--- a/lib/RT/IR/Test/GnuPG.pm
+++ b/lib/RT/IR/Test/GnuPG.pm
@@ -96,7 +96,7 @@ Set(\%GnuPG, (
     OutgoingMessagesFormat => 'RFC',
 ));
 Set(\%GnuPGOptions => \%{ $dumped_gnupg_options });
-Set(\@MailPlugins => qw(Auth::MailFrom Auth::Crypt));
+Set(\@MailPlugins => qw(Auth::MailFrom));
 };
 
 }

commit ad1a60eda103e13d4e894dbda76e7c7c73fc3de7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 00:23:24 2018 +0800

    "undef $m" to make tests exit cleanly
    
    There is code to help avoid this statement in RT 4.4-trunk(e9960b2e), so
    there'll be no need to do so for future versions of RT.
    
    Once bound to those RT versions, we can then safely remove all the
    "undef $m" in tests.

diff --git a/t/report/split.t b/t/report/split.t
index 92b34680..9e09d3c1 100644
--- a/t/report/split.t
+++ b/t/report/split.t
@@ -105,4 +105,5 @@ sub create_incident_report {
     return $ir;
 }
 
+undef $m;
 done_testing;

commit 9eaefadcf9b0f3a1d6ac284943a6135c50e38457
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 00:23:46 2018 +0800

    update tests for the changed content returned from whois.verisign-grs.com
    
    "No match" is probably a better test string.

diff --git a/t/tools/lookup.t b/t/tools/lookup.t
index 7f5e8613..32e20635 100644
--- a/t/tools/lookup.t
+++ b/t/tools/lookup.t
@@ -50,7 +50,7 @@ SKIP:{
     $agent->form_name('ToolFormWhois');
     $agent->click;
     $agent->content_contains('WHOIS Results');
-    $agent->content_contains('Domain names in the .com and .net domains');
+    $agent->content_contains('No match');
 }
 }
 

commit 36ffa65adb36dc2a3b2c4dbea35ec9bfe80c9915
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 03:44:04 2018 +0800

    remove duplicated "undef $agent"

diff --git a/t/tools/lookup.t b/t/tools/lookup.t
index 32e20635..39b088ef 100644
--- a/t/tools/lookup.t
+++ b/t/tools/lookup.t
@@ -54,7 +54,5 @@ SKIP:{
 }
 }
 
-undef $agent;
-
 undef $agent;
 done_testing;

commit fdf8605d77a0158bf5817692ebd5f6722c72e1d7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 04:24:35 2018 +0800

    no need to parse URI if it's empty
    
    Otherwise we may get warnings like "Couldn't resolve '' into a URI".
    
    The reason that NewValue could be empty is in Condition
    "RTIR_LinkingToIncident.pm", besides "AddLink" transactions, IR "Create"
    transactions could also get passed, which don't have NewValue.
    
    Since empty URIs can't be successfully parsed anyway, this change
    doesn't change the action's behavior.

diff --git a/lib/RT/Action/RTIR_MergeIPs.pm b/lib/RT/Action/RTIR_MergeIPs.pm
index 08ef3288..8922b463 100644
--- a/lib/RT/Action/RTIR_MergeIPs.pm
+++ b/lib/RT/Action/RTIR_MergeIPs.pm
@@ -61,7 +61,7 @@ sub Commit {
     my $self = shift;
 
     my $txn = $self->TransactionObj;
-    my $uri = $txn->NewValue ||'';
+    my $uri = $txn->NewValue or return 1;
 
     my $uri_obj = RT::URI->new( $self->CurrentUser );
     my ($status) = $uri_obj->FromURI( $uri );

commit bd63a92b76eef82a0d1127c24eb429d0f094363c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 04:48:13 2018 +0800

    refactor goto_create_rtir_ticket to use real lifecycle name
    
    Old approach is a fragile hack of the queue name, which is not always
    correct because we have customized queue names in some tests.

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 3c6b5d82..0abb0628 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -73,10 +73,19 @@ sub create_countermeasure {
 
 sub goto_create_rtir_ticket {
     my $self = shift;
-    my $queue = shift; # we play a dumb game to change queues to lifecycles
+    my $queue = shift;
     local $Test::Builder::Level = $Test::Builder::Level + 1;
-    my $lifecycle = lc( $queue);
-    $lifecycle =~ s/ /_/;
+
+    my $queue_obj = RT::Queue->new(RT->SystemUser);
+    $queue_obj->Load($queue);
+    my $lifecycle;
+    if ( $queue_obj->id ) {
+        $lifecycle = $queue_obj->Lifecycle;
+    }
+    else {
+        warn "Failed to load queue: $queue";
+    }
+    $lifecycle ||= 'Default';
 
     $self->get_ok("/RTIR/CreateInQueue.html?Lifecycle=$lifecycle");
     $self->click_through_createinqueue( $queue );

commit 4dcddc3e4dbe376d985514fdef693a4f05d51aaf
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 05:08:41 2018 +0800

    turn debug on for Net::Whois::RIPE only when we have debug log
    
    It's not necessary to always enable debug there.

diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index 89a80eef..20f79f28 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -651,7 +651,14 @@ sub WhoisLookup {
     $port = 43 unless ($port || '') =~ /^\d+$/;
 
     use Net::Whois::RIPE;
-    my $whois = Net::Whois::RIPE->new( $host, Port => $port, Debug => 1 );
+    my $debug;
+    for my $log_config ( qw/LogToSyslog LogToSTDERR LogToFile/ ) {
+        if ( ( RT->Config->Get( $log_config ) // '' ) eq 'debug' ) {
+            $debug = 1;
+            last;
+        }
+    }
+    my $whois = Net::Whois::RIPE->new( $host, Port => $port, Debug => $debug || 0 );
     my $iterator;
     $iterator = $whois->query_iterator( $args{'Query'} )
         if $whois;

commit b2907e38c8234a54dfddb16245053908524b6ce5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 05:11:54 2018 +0800

    add a missing warnings check for t/tools/lookup.t
    
    Note that "info" log level is set to turn off debug mode of
    Net::Whois::RIPE

diff --git a/t/tools/lookup.t b/t/tools/lookup.t
index 39b088ef..d62c2dd2 100644
--- a/t/tools/lookup.t
+++ b/t/tools/lookup.t
@@ -3,6 +3,8 @@ use warnings;
 
 use RT::IR::Test tests => undef;
 
+RT->Config->Set( LogToFile => 'info' );
+
 RT::Test->started_ok;
 my $agent = default_agent();
 
@@ -20,13 +22,14 @@ diag "Test Lookup page directly";
     $agent->get_ok("/RTIR/Tools/Lookup.html", "Loaded Lookup page");
 
 SKIP:{
-    skip "No network", 2 if $no_network;
+    skip "No network", 3 if $no_network;
     $agent->form_name('ToolFormWhois');
     $agent->field('q', 'mit.edu');
     $agent->select('WhoisServer', 'IANA');
     $agent->click;
     $agent->content_contains('WHOIS Results');
     $agent->content_contains('IANA WHOIS server');
+    $agent->next_warning_like( qr/Asked to run a full text search from Lookup\.html/ );
 }
 }
 

commit e3856af9d3e06eba26b20e482331fba1f0657239
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 05:13:35 2018 +0800

    add missing warnings checks for gpg tests

diff --git a/t/gnupg/on-create.t b/t/gnupg/on-create.t
index 50160f72..f991b407 100644
--- a/t/gnupg/on-create.t
+++ b/t/gnupg/on-create.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use RT::IR::Test::GnuPG tests => 61, gnupg_options => { passphrase => 'rt-test' };
+use RT::IR::Test::GnuPG tests => undef, gnupg_options => { passphrase => 'rt-test' };
 
 my $queue = RT::Test->load_or_create_queue(
     Name              => 'Incident Reports',
@@ -49,6 +49,9 @@ diag "check that things don't work if there is no key";
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
+
+    $agent->next_warning_like(qr/public key not found/) for 1 .. 2;
+    $agent->no_leftover_warnings_ok;
 }
 
 diag "import first key of rt-test\@example.com";
diff --git a/t/gnupg/on-incident.t b/t/gnupg/on-incident.t
index 3fde87d2..8d6a7f6b 100644
--- a/t/gnupg/on-incident.t
+++ b/t/gnupg/on-incident.t
@@ -43,6 +43,11 @@ diag "check that things don't work if there is no key";
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails'
         or diag "Emails' have been sent: \n". join "\n\n", @mail;
+
+    $agent->next_warning_like(qr/public key not found/) for 1 .. 2;
+    $agent->next_warning_like(qr/keyring.+created/);
+    $agent->next_warning_like(qr/public key not found/) for 1 .. 2;
+    $agent->no_leftover_warnings_ok;
 }
 
 diag 'import rt-recipient at example.com key and sign it';
@@ -84,6 +89,8 @@ diag "check that things don't work if there is no key";
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
+    $agent->next_warning_like(qr/public key not found/) for 1 .. 8;
+    $agent->no_leftover_warnings_ok;
 }
 
 undef $agent;
diff --git a/t/gnupg/on-update.t b/t/gnupg/on-update.t
index fee59df9..28919c53 100644
--- a/t/gnupg/on-update.t
+++ b/t/gnupg/on-update.t
@@ -59,6 +59,9 @@ diag "check that things don't work if there is no key";
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
+
+    $agent->next_warning_like(qr/public key not found/) for 1 .. 2;
+    $agent->no_leftover_warnings_ok;
 }
 
 diag "import first key of rt-test\@example.com";

commit 9ca429e18e118cfd0162b6d9146131cdb2ef1579
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Mar 7 05:15:35 2018 +0800

    use string cmparison for "Constituency" checks and take care of empty values

diff --git a/html/RTIR/Merge/index.html b/html/RTIR/Merge/index.html
index 23a9b00e..f3ce0a30 100644
--- a/html/RTIR/Merge/index.html
+++ b/html/RTIR/Merge/index.html
@@ -99,8 +99,8 @@ if ( $MergeTicket ) {
         }
 
         if (RT::IR->StrictConstituencyLinking) {
-        if (RT::IR->ConstituencyFor($Ticket) 
-            != RT::IR->ConstituencyFor($MergeTicket)) {
+        if ( (RT::IR->ConstituencyFor($Ticket) // '')
+            ne (RT::IR->ConstituencyFor($MergeTicket) // '') ) {
             push @results, 
             loc("Merge failed: Ticket #[_1] is associated with a different constituency", 
                 $MergeTicket->Id );

commit 910674433a5329d3b5825891ec9b94772a2d2672
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Mar 8 07:23:22 2018 +0800

    Lifecycle is needed to build ResultPage and BaseQuery from ARGS
    
    Here is a failure case without it: to link IRs to an incident(via "Link"
    on incident display page), the "Edit Search" link has args "id" and
    "Lifecycle", which is set to the incident id and "incident_reports",
    respectively.
    
    After any action in the builder(e.g. "Add these terms and Search"),
    "Lifecycle" arg is lost, so ResultPage and BaseQuery relying on it are
    wrong, which results in wrong links in page menu and also wrong page
    title.

diff --git a/html/RTIR/Link/FromIncident/Refine.html b/html/RTIR/Link/FromIncident/Refine.html
index 18ccff01..9f90e93e 100644
--- a/html/RTIR/Link/FromIncident/Refine.html
+++ b/html/RTIR/Link/FromIncident/Refine.html
@@ -58,5 +58,6 @@ return $m->comp(
         Lifecycle       => $ARGS{'Lifecycle'},
         NotMemberOf => $ARGS{'id'},
     ),
+    ExtraQueryParams => [ 'Lifecycle' ],
 );
 </%INIT>

commit 7361a19942bca9f927efc4162540cd5163285a82
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Mar 8 21:36:29 2018 +0800

    Use lexical iterator so inline test server can render articles
    
    In RT's /Articles/Article/Elements/Preformatted, there is code using
    global $_ as while/foreach iterator, unfortunately the foreach loop in
    test assigns $_ to constants:
    
        foreach ( 'Incident Reports', 'Investigations', 'Countermeasures' )
    
    So $_ becomes readonly inside the loop. As the test shares the same perl
    process with inline server, server dies with error message "Modification
    of a read-only value attempted"

diff --git a/t/articles/on-create.t b/t/articles/on-create.t
index a3a51469..b319f530 100644
--- a/t/articles/on-create.t
+++ b/t/articles/on-create.t
@@ -36,10 +36,10 @@ diag "create an article" if $ENV{'TEST_VERBOSE'};
 }
 
 # TODO: Once incident+investigation creation is re-added, this should be put back
-#foreach ( 'Incidents', 'Incident Reports', 'Investigations', 'Countermeasures' ) {
-foreach ( 'Incident Reports', 'Investigations', 'Countermeasures' ) {
+#foreach my $q_name ( 'Incidents', 'Incident Reports', 'Investigations', 'Countermeasures' ) {
+foreach my $q_name ( 'Incident Reports', 'Investigations', 'Countermeasures' ) {
     my $queue = RT::Queue->new(RT->SystemUser);
-    $queue->Load( $_ );
+    $queue->Load( $q_name );
     ok $agent->goto_create_ticket( $queue ), "UI -> create ticket";
 
     my $content_name = $queue->Name eq 'Incidents'? 'InvestigationContent': 'Content';

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


More information about the rt-commit mailing list