[Rt-commit] rt branch, 4.2/test-mailgate-return, created. rt-4.2.3-87-g32a3420
Alex Vandiver
alexmv at bestpractical.com
Thu Apr 17 14:55:10 EDT 2014
The branch, 4.2/test-mailgate-return has been created
at 32a342023e3888d60699aedfc52bd06a55f56ead (commit)
- Log -----------------------------------------------------------------
commit 32a342023e3888d60699aedfc52bd06a55f56ead
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Apr 17 14:35:36 2014 -0400
send_via_mailgate's return should act like send_via_mailgate_and_http
a7a0e02c switched to call RT::Interface::Email::Gateway rather than
using bin/rt-mailgate; however, it returned 0/1/-75 for
failure/success/tmpfail instead of the exit code ($?). Since all
callsites shifted the return code by 8 and accepted 0 as "success," all
calls succeeded.
Fake a $?-like return code from send_via_mailgate; left-shifted 1 for
failure, left-shifted -75 for temporary failure, and 0 for success.
Fixes I#19156.
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 0261f42..cda9fdc 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1201,6 +1201,11 @@ sub send_via_mailgate {
my ( $status, $error_message, $ticket )
= RT::Interface::Email::Gateway( {%args, message => $message} );
+
+ # Invert the status to act like a syscall; failing return code is 1,
+ # and it will be right-shifted before being examined.
+ $status = ($status == 1) ? 0 : 1 << 8;
+
return ( $status, $ticket ? $ticket->id : 0 );
}
diff --git a/t/mail/header-characters.t b/t/mail/header-characters.t
index 66cc05f..a94d92b 100644
--- a/t/mail/header-characters.t
+++ b/t/mail/header-characters.t
@@ -25,11 +25,11 @@ here's some content
qr/Couldn't parse or find sender's address/
],
'Got parse error for non-ASCII in From';
- is( $status >> 8, 0, "The mail gateway exited normally" );
TODO: {
- local $TODO = "Currently don't handle non-ASCII for sender";
- ok( $id, "Created ticket" );
- }
+ local $TODO = "Currently don't handle non-ASCII for sender";
+ is( $status >> 8, 0, "The mail gateway exited normally" );
+ ok( $id, "Created ticket" );
+ }
}
diag "Testing non-ASCII latin1 in From: header with MIME-word-encoded phrase";
@@ -49,10 +49,10 @@ here's some content
qr/Couldn't parse or find sender's address/
],
'Got parse error for iso-8859-1 in From';
- is( $status >> 8, 0, "The mail gateway exited normally" );
TODO: {
- local $TODO = "Currently don't handle non-ASCII in sender";
- ok( $id, "Created ticket" );
+ local $TODO = "Currently don't handle non-ASCII in sender";
+ is( $status >> 8, 0, "The mail gateway exited normally" );
+ ok( $id, "Created ticket" );
}
}
@@ -70,6 +70,6 @@ here's some content
warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) }
[qr/Couldn't parse or find sender's address/],
'Got parse error with no sender fields';
- is( $status >> 8, 0, "The mail gateway exited normally" );
+ is( $status >> 8, 1, "The mail gateway failed" );
ok( !$id, "No ticket created" );
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list