Skip Menu |

This queue is for tickets about the TAP-Harness-JUnit CPAN distribution.

Report information
The Basics
Id: 78642
Status: resolved
Priority: 0/
Queue: TAP-Harness-JUnit

People
Owner: Nobody in particular
Requestors: dev [...] archonet.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.36
Fixed in: (no value)



Subject: Test prefix environment-var to have package-names in Jenkins CI
I have a perl app split between several modules and Jenkins just displays a single package '(root)' and inside it all the .t filenames are jumbled together. The attached diff is an implementation (very minimal, no input validation) that allows you to set env-var JUNIT_PREFIX. This lets me have a different prefix (db, app, web) for each run of prove and so db/auth.t, app/auth.t, web/auth.t If this feature is of any interest, I would be happy to rework the patch properly, add some tests etc. and provide it on github.
Subject: prefix_diff.txt
--- /usr/local/share/perl/5.14.2/TAP/Harness/JUnit.pm 2012-07-29 10:03:06.000000000 +0100 +++ /var/lib/jenkins/perl5/lib/perl5/TAP/Harness/JUnit.pm 2012-07-29 12:15:03.912167519 +0100 @@ -191,8 +191,12 @@ } } + my $prefixname = ($ENV{JUNIT_PREFIX}) + ? $ENV{JUNIT_PREFIX}.'.'.$name + : $name; + my $xml = { - name => $name, + name => $prefixname, failures => 0, errors => 0, tests => undef, @@ -234,7 +238,7 @@ my $test = { 'time' => $time, name => $self->uniquename($xml, $result->description), - classname => $name, + classname => $prefixname, }; if ($result->ok eq 'not ok') { @@ -263,7 +267,7 @@ push @{$xml->{testcase}}, { 'time' => $time, name => $self->uniquename($xml, 'Test died too soon, even before plan.'), - classname => $name, + classname => $prefixname, failure => { type => 'Plan', message => 'The test suite died before a plan was produced. You need to have a plan.', @@ -279,7 +283,7 @@ push @{$xml->{testcase}}, { 'time' => $time, name => $self->uniquename($xml, 'Number of runned tests does not match plan.'), - classname => $name, + classname => $prefixname, failure => { type => 'Plan', message => ($xml->{failures} > 0 @@ -298,7 +302,7 @@ push @{$xml->{testcase}}, { 'time' => $time, name => $self->uniquename($xml, 'Test returned failure'), - classname => $name, + classname => $prefixname, failure => { type => 'Died', message => "Test died with return code $badretval",
CC: Jeff Lavallee <jeff [...] zeroclue.com>
Subject: Re: [rt.cpan.org #78642] Test prefix environment-var to have package-names in Jenkins CI
Date: Wed, 1 Aug 2012 13:13:54 +0200
To: bug-TAP-Harness-JUnit [...] rt.cpan.org, dev [...] archonet.com
From: Lubomir Rintel <lubo.rintel [...] gooddata.com>
Looks fine to me. I can't really think of a better way to propagate the setting and we already use environment variables for this (JUNIT_OUTPUT_FILE). Adding Jeff to Cc. Jeff, what's your opinion on this? Also, if we're going to pull it, it needs a POD documentation. Thank you! On Sun, Jul 29, 2012 at 1:31 PM, Richard Huxton via RT <bug-TAP-Harness-JUnit@rt.cpan.org> wrote: Show quoted text
> Sun Jul 29 07:31:01 2012: Request 78642 was acted upon. > Transaction: Ticket created by rhuxton > Queue: TAP-Harness-JUnit > Subject: Test prefix environment-var to have package-names in Jenkins CI > Broken in: 0.36 > Severity: Wishlist > Owner: Nobody > Requestors: dev@archonet.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78642 > > > > I have a perl app split between several modules and Jenkins just > displays a single package '(root)' and inside it all the .t filenames > are jumbled together. > > The attached diff is an implementation (very minimal, no input > validation) that allows you to set env-var JUNIT_PREFIX. > > This lets me have a different prefix (db, app, web) for each run of > prove and so db/auth.t, app/auth.t, web/auth.t > > If this feature is of any interest, I would be happy to rework the patch > properly, add some tests etc. and provide it on github. > > --- /usr/local/share/perl/5.14.2/TAP/Harness/JUnit.pm 2012-07-29 10:03:06.000000000 +0100 > +++ /var/lib/jenkins/perl5/lib/perl5/TAP/Harness/JUnit.pm 2012-07-29 12:15:03.912167519 +0100 > @@ -191,8 +191,12 @@ > } > } > > + my $prefixname = ($ENV{JUNIT_PREFIX}) > + ? $ENV{JUNIT_PREFIX}.'.'.$name > + : $name; > + > my $xml = { > - name => $name, > + name => $prefixname, > failures => 0, > errors => 0, > tests => undef, > @@ -234,7 +238,7 @@ > my $test = { > 'time' => $time, > name => $self->uniquename($xml, $result->description), > - classname => $name, > + classname => $prefixname, > }; > > if ($result->ok eq 'not ok') { > @@ -263,7 +267,7 @@ > push @{$xml->{testcase}}, { > 'time' => $time, > name => $self->uniquename($xml, 'Test died too soon, even before plan.'), > - classname => $name, > + classname => $prefixname, > failure => { > type => 'Plan', > message => 'The test suite died before a plan was produced. You need to have a plan.', > @@ -279,7 +283,7 @@ > push @{$xml->{testcase}}, { > 'time' => $time, > name => $self->uniquename($xml, 'Number of runned tests does not match plan.'), > - classname => $name, > + classname => $prefixname, > failure => { > type => 'Plan', > message => ($xml->{failures} > 0 > @@ -298,7 +302,7 @@ > push @{$xml->{testcase}}, { > 'time' => $time, > name => $self->uniquename($xml, 'Test returned failure'), > - classname => $name, > + classname => $prefixname, > failure => { > type => 'Died', > message => "Test died with return code $badretval", >
-- Lubomir Rintel <lubo.rintel@gooddata.com>
Subject: Re: [rt.cpan.org #78642] Test prefix environment-var to have package-names in Jenkins CI
Date: Thu, 02 Aug 2012 09:12:00 +0100
To: bug-TAP-Harness-JUnit [...] rt.cpan.org
From: Richard Huxton <dev [...] archonet.com>
On 01/08/12 12:14, Lubomir Rintel via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=78642> > > Looks fine to me. I can't really think of a better way to propagate > the setting and we already use environment variables for this > (JUNIT_OUTPUT_FILE). > Adding Jeff to Cc. Jeff, what's your opinion on this? > > Also, if we're going to pull it, it needs a POD documentation.
Of course. I'll try and tidy it up a bit next week. -- Richard Huxton Archonet Ltd
RT-Send-CC: lubo.rintel [...] gooddata.com
On Wed Aug 01 07:14:05 2012, lkundrak wrote: Show quoted text
> Looks fine to me. I can't really think of a better way to propagate > the setting and we already use environment variables for this > (JUNIT_OUTPUT_FILE). > Adding Jeff to Cc. Jeff, what's your opinion on this?
Seems reasonable enough to me. I do wonder if we could use the directory that the .t files are in for the prefix - that would only work when they're split up in separate top-level directories though, which isn't particularly standard.
Subject: Re: [rt.cpan.org #78642] Test prefix environment-var to have package-names in Jenkins CI
Date: Fri, 03 Aug 2012 15:14:37 +0100
To: bug-TAP-Harness-JUnit [...] rt.cpan.org
From: Richard Huxton <dev [...] archonet.com>
On 03/08/12 15:02, Jeff Lavallee via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=78642> > > On Wed Aug 01 07:14:05 2012, lkundrak wrote:
>> Looks fine to me. I can't really think of a better way to propagate >> the setting and we already use environment variables for this >> (JUNIT_OUTPUT_FILE). >> Adding Jeff to Cc. Jeff, what's your opinion on this?
> > Seems reasonable enough to me. I do wonder if we could use the directory that the .t files are in > for the prefix - that would only work when they're split up in separate top-level directories > though, which isn't particularly standard.
In my case I've currently got four sections/prefixes for my app: 1. db (PostgreSQL database build+test via pgTap) 2. app (core app functionality + API tests) 3. web (dancer app wrapping #2) 4. selenium tests for #3 I thought about having some sort of wildcard in the env-var but it seemed simpler to just have a literal string and do something like: prove -l t/t_selenium/* It does mean running prove once for each prefix though. -- Richard Huxton Archonet Ltd
TAP::Harness::JUnit 0.37 is on its way to CPAN
RT-Send-CC: lubo.rintel [...] gooddata.com
On Sun Aug 05 19:24:31 2012, JLAVALLEE wrote: Show quoted text
> TAP::Harness::JUnit 0.37 is on its way to CPAN
Looks like I no longer have permission to release TAP::Harness::JUnit: The following packages (grouped by status) have been found in the distro: Status: Permission missing ========================== module: TAP::Harness::JUnit::Parser version: undef in file: lib/TAP/Harness/JUnit.pm status: Not indexed because permission missing. Current registered primary maintainer is LKUNDRAK. Hint: you can always find the legitimate maintainer(s) on PAUSE under "View Permissions".
Subject: Re: [rt.cpan.org #78642] Test prefix environment-var to have package-names in Jenkins CI
Date: Tue, 07 Aug 2012 09:07:32 +0100
To: bug-TAP-Harness-JUnit [...] rt.cpan.org
From: Richard Huxton <dev [...] archonet.com>
On 06/08/12 00:29, Jeff Lavallee via RT wrote: Show quoted text
Thanks - I've deployed 0.37 to my Jenkins installation and it's working fine. -- Richard Huxton Archonet Ltd
Resolving the ticket. Thank you both!