Bug 14602 - Fix failing t/Creators.t test, when using koha-shell
Summary: Fix failing t/Creators.t test, when using koha-shell
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Mason James
QA Contact: Marcel de Rooy
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-25 08:10 UTC by Mason James
Modified: 2016-06-21 21:39 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 14602 - Fix failing t/Creators.t test (2.23 KB, patch)
2015-07-25 08:56 UTC, Mason James
Details | Diff | Splinter Review
Bug 14602 - Fix failing t/Creators.t test (2.23 KB, patch)
2015-08-02 21:47 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 14602 - Fix failing t/Creators.t test (2.33 KB, patch)
2015-09-03 13:01 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mason James 2015-07-25 08:10:37 UTC
more info to come
Comment 1 Mason James 2015-07-25 08:15:07 UTC
 t/Creators.t always fails, from a git repo on latest master (3b23fb8)


mason@xen1:~/g/k/3.16.x$ sudo  koha-shell -c '  export PERL5LIB=/home/mason/g/k/3.16.x ; cd /home/mason/g/k/3.16.x ;  prove -v  t/Creators.t  '   k316x1
t/Creators.t ..
1..16
ok 1 - use C4::Creators;
ok 2 - use C4::Creators::PDF;
ok 3 - testing new() works
ok 4 - testing pdf file created
ok 5 - testing Add() works
ok 6 - testing Bookmark() works
ok 7 - testing Compress() works
ok 8 - testing Font() works
ok 9 - testing FontSize() is set to 12 by default
ok 10 - testing FontSize() can be set to a different value
ok 11 - testing Page() works
ok 12 - testing StrWidth() returns correct point width
ok 13 - testing Text() writes from a given x-value
ok 14 - testing Text() writes to the correct x-value
print() on closed filehandle $fh at /home/mason/g/k/3.16.x/C4/Creators/PDF.pm line 65, <$fh> chunk 1.
ok 15 - testing End() works
not ok 16 - test.pdf created

#   Failed test 'test.pdf created'
#   at t/Creators.t line 59.
# Looks like you failed 1 test of 16.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/16 subtests

Test Summary Report
-------------------
t/Creators.t (Wstat: 256 Tests: 16 Failed: 1)
  Failed test:  16
  Non-zero exit status: 1
Files=1, Tests=16,  0 wallclock secs ( 0.03 usr  0.01 sys +  0.47 cusr  0.07 csys =  0.58 CPU)
Result: FAIL
Comment 2 Mason James 2015-07-25 08:56:42 UTC Comment hidden (obsolete)
Comment 3 Liz Rea 2015-08-02 21:47:44 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2015-08-05 07:38:21 UTC
It passes for me (using a dev install from git).
Comment 5 Jonathan Druart 2015-08-28 14:12:03 UTC
ping Mason!

% git checkout -b bug_14602 3b23fb8
Switched to a new branch 'bug_14602'
                           
% prove t/Creators.t
t/Creators.t .. ok     
All tests successful.
Files=1, Tests=16,  1 wallclock secs ( 0.04 usr  0.00 sys +  0.60 cusr  0.02 csys =  0.66 CPU)
Result: PASS
Comment 6 Mason James 2015-08-29 04:20:07 UTC
(In reply to Jonathan Druart from comment #4)
> It passes for me (using a dev install from git).

if you use koha-shell to run tests (and you should be!), it will fail

so, bug still exists for some situations
Comment 7 Tomás Cohen Arazi 2015-08-30 22:15:06 UTC
(In reply to Mason James from comment #6)
> (In reply to Jonathan Druart from comment #4)
> > It passes for me (using a dev install from git).
> 
> if you use koha-shell to run tests (and you should be!), it will fail
> 
> so, bug still exists for some situations

I'm not against the patch, but Liz, didn't w find a koha-shell bug the other day? Maybe it is related
Comment 8 Liz Rea 2015-08-30 22:24:00 UTC
Naw, that bug is that on a gitified install koha-shell uses the system /usr/share/koha PERL5LIB instead of the one from the git install, and that can cause general test weirdness.

I think this is different, I get this issue in my vagrant and/or gitify installs as well. Something to do with the fact that it can't write a temp file, but I didn't have time to try and fix it.
Comment 9 Mason James 2015-09-01 00:27:26 UTC
(In reply to Liz Rea from comment #8)
> I think this is different, I get this issue in my vagrant and/or gitify
> installs as well. Something to do with the fact that it can't write a temp
> file, but I didn't have time to try and fix it.

yep, thats all correct ^ :)
Comment 10 Marcel de Rooy 2015-09-03 13:01:05 UTC
Created attachment 42315 [details] [review]
Bug 14602 - Fix failing t/Creators.t test

to test..

1/ run t/Creators.t test from git repo, get a FAIL

2/ apply patch

3/ repeat step 1, get a PASS

mason@xen1:~/g/k/3.16.x$ sudo  koha-shell -c 'export PERL5LIB=/home/mason/g/k/3.16.x ; cd /home/mason/g/k/3.16.x ;  prove -v  t/Creators.t' k316x1
t/Creators.t ..
1..16
ok 1 - use C4::Creators;
ok 2 - use C4::Creators::PDF;
ok 3 - testing new() works
ok 4 - testing pdf file created
ok 5 - testing Add() works
ok 6 - testing Bookmark() works
ok 7 - testing Compress() works
ok 8 - testing Font() works
ok 9 - testing FontSize() is set to 12 by default
ok 10 - testing FontSize() can be set to a different value
ok 11 - testing Page() works
ok 12 - testing StrWidth() returns correct point width
ok 13 - testing Text() writes from a given x-value
ok 14 - testing Text() writes to the correct x-value
ok 15 - testing End() works
ok 16 - test file /tmp/4YjPQDExeS created OK
ok
All tests successful.
Files=1, Tests=16,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.48 cusr  0.05 csys =  0.57 CPU)
Result: PASS

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Marcel de Rooy 2015-09-03 13:01:43 UTC
(In reply to Mason James from comment #9)
> (In reply to Liz Rea from comment #8)
> > I think this is different, I get this issue in my vagrant and/or gitify
> > installs as well. Something to do with the fact that it can't write a temp
> > file, but I didn't have time to try and fix it.
> 
> yep, thats all correct ^ :)

It wrote in the current directory..
Comment 12 Tomás Cohen Arazi 2015-09-07 14:58:38 UTC
Patch pushed to master.

Thanks Mason!

Note: I didn't reproduce the problem, but I agree with the change and it doesn't break tests.