Bug 1083418

Summary: perl-Log-Dispatch-2.41-1.fc21 FTBFS
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: perl-Log-DispatchAssignee: Petr Pisar <ppisar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: perl-devel, rc040203, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://koji.fedoraproject.org/koji/taskinfo?taskID=6698466
Whiteboard:
Fixed In Version: perl-Log-Dispatch-2.41-2.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-07 13:32:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Pisar 2014-04-02 08:23:53 UTC
perl-Log-Dispatch-2.41-1.fc21 fails to build in F21 due to test plan for t/01-basic.t:

t/01-basic.t            (Wstat: 0 Tests: 344 Failed: 167)
  Failed tests:  11-177
  Parse errors: Plan (1..177) must be at the beginning or end of the TAP output
                Tests out of sequence.  Found (11) but expected (178)
                Tests out of sequence.  Found (12) but expected (179)
                Tests out of sequence.  Found (13) but expected (180)
                Tests out of sequence.  Found (14) but expected (181)
Displayed the first 5 of 170 TAP syntax errors.

The problem is:

$ LOG_DISPATCH_TEST_EMAIL="root" prove -l -v t/01-basic.t
t/01-basic.t ..
ok 1 - created Log::Dispatch object
ok 2 - First line in log file set to level 'emerg' is 'emerg level 1'
ok 3 - Second line in log file set to level 'emerg' is 'emerg level 2'
ok 4 - First line in log file set to level 'debug' is 'info level 2'
ok 5 - Second line in log file set to level 'debug' is 'emerg level 2'
ok 6 - second LD object used syswrite
ok 7 - First line in log file with a max level of 'crit' is 'critical'
ok 8 - Log::Dispatch::Handle created log file should contain 'handle test\n'
# Sending email with Mail::Send to root.
# If you get it then the test succeeded (PID 3444)
No real MTA found, using 'testfile' at /usr/share/perl5/vendor_perl/Mail/Mailer.pm line 108.
ok 9 - sent email via MailSend
# Sending email with Mail::Sendmail to root.
# If you get it then the test succeeded (PID 3444)
Error sending mail: connect to localhost failed (Connection refused)
connect to localhost failed
connect to localhost failed (Connection refused) no (more) retries!
ok 10 - sent email via MailSendmail
# Sending email with MIME::Lite to root.
# If you get it then the test succeeded (PID 3444)
ok 11 - sent mail via MIMELite
[...]
ok 177 - code received the expected messages
1..177
ok 11 - sent mail via MIMELite
[...]
ok 177 - code received the expected messages
1..177

Something echoes the output since test 11 twice which break TAP.

Comment 1 Petr Pisar 2014-04-02 08:37:48 UTC
It's because emitting TAP messages after undefining Log::Dispatch object. E.g. here:

# Log::Dispatch::Email::MIMELite
SKIP:
{   

    skip "Cannot do MIMELite tests", 1
        unless $tests{MIMELite} && $TestConfig{email_address};

    my $dispatch = Log::Dispatch->new;

    $dispatch->add(
        Log::Dispatch::Email::MIMELite->new(
            name      => 'Mime::Lite',
            min_level => 'debug',
            to        => $TestConfig{email_address},
            subject   => 'Log::Dispatch test suite'
        )
    );

    $dispatch->log(
        level => 'emerg',
        message =>
            "MIME::Lite - If you can read this then the test succeeded (PID $$)"
    );

    diag(
        "Sending email with MIME::Lite to $TestConfig{email_address}.\nIf you get it then the test succeeded (PID $$)\n"
    );
    undef $dispatch;

    ok( 1, 'sent mail via MIMELite' );
}

The 'sent mail via MIMELite', the first doubled TAP message, gets doubled because it is invoked after undef $dispatch.

Comment 2 Petr Pisar 2014-04-04 06:32:11 UTC
This package failure blocks tens of other packages (perl-Log-Log4Perl, perl-Catalyst, rt3).

Comment 3 Petr Pisar 2014-04-07 13:22:56 UTC
I don't know why, but if /usr/sbin/sendmail is available the test pass. The requires e-mail modules do not require /usr/sbin/sendmail because they allow local /usr/sbin/sendmail or SMTP, both optional. I will add /usr/sbin/sendmail into build-requires on the executable to this package.