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

? sunnavy sunnavy at bestpractical.com
Wed Mar 7 19:15:40 EST 2018


The branch, 4.0/pass-tests has been created
        at  24d301f20b6fbc652b132fb5412ba05f503e5dc5 (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 35512e20cb18ffd240fcf172a91f4ade3361350d
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..2ddda30e 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 0;
 
     my $uri_obj = RT::URI->new( $self->CurrentUser );
     my ($status) = $uri_obj->FromURI( $uri );

commit 4b9a078b192d18482174680b60e3c0e9eecb6d1f
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..b0825717 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -73,10 +73,12 @@ 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 = $queue_obj->Lifecycle || 'default';
 
     $self->get_ok("/RTIR/CreateInQueue.html?Lifecycle=$lifecycle");
     $self->click_through_createinqueue( $queue );

commit 462934e57a910103e5e11305e5c2f0b4e0582d39
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 c691ffc373cfbca1eb21e334a80baf6b7c819fb4
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 a7f8c9e13fe52ffb7409737eca1ba0a37fee5066
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 f31efcb97be9c35909b1518977e7d8a222b6bc5d
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 24d301f20b6fbc652b132fb5412ba05f503e5dc5
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>

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


More information about the rt-commit mailing list