Bug 17920

Summary: t/db_dependent/Sitemapper.t fails because of permissions
Product: Koha Reporter: Mark Tompsett <mtompset>
Component: Test SuiteAssignee: Mark Tompsett <mtompset>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, katrin.fischer, kyle, m.de.rooy, mtj
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17917
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17919
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17934
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 17920: t/db_dependent/Sitemapper.t fails because of permissions
Bug 17920: t/db_dependent/Sitemapper.t fails because of permissions
Bug 17920: t/db_dependent/Sitemapper.t fails because of permissions

Description Mark Tompsett 2017-01-17 06:41:51 UTC
The directory it attempts to create an xml file may not be writable for the user running the test. By changing the directory from the current directory to a temporary one, the test runs. After all 'chmod 777 t/db_dependent' is a bad idea.
Comment 1 Mark Tompsett 2017-01-17 06:44:40 UTC
Created attachment 59060 [details] [review]
Bug 17920: t/db_dependent/Sitemapper.t fails because of permissions

The directory it attempts to create an xml file may not be writable for
the user running the test. By changing the directory from the current
directory to a temporary one, the test runs. After all 'chmod 777
t/db_dependent' is a bad idea.

TEST PLAN
---------
1) sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   -- fails
2) apply patch
3) sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   -- succeeds
4) run koha qa test tools
Comment 2 Claire Gravely 2017-01-17 07:52:13 UTC
Created attachment 59067 [details] [review]
Bug 17920: t/db_dependent/Sitemapper.t fails because of permissions

The directory it attempts to create an xml file may not be writable for
the user running the test. By changing the directory from the current
directory to a temporary one, the test runs. After all 'chmod 777
t/db_dependent' is a bad idea.

TEST PLAN
---------
1) sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   -- fails
2) apply patch
3) sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   -- succeeds
4) run koha qa test tools

Tested without qa tools
Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>
Comment 3 Jonathan Druart 2017-01-17 08:18:29 UTC
Patch looks ok but I do not recreate:
 sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   Error: The instance doesn't exist: prove t/db_dependent/Sitemapper.t

With -c:
  sudo koha-shell -c "prove t/db_dependent/Sitemapper.t" kohadev

The tests pass, even without the patch.
Comment 4 Marcel de Rooy 2017-01-18 12:12:05 UTC
(In reply to Jonathan Druart from comment #3)
> Patch looks ok but I do not recreate:
>  sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
>    Error: The instance doesn't exist: prove t/db_dependent/Sitemapper.t
> 
> With -c:
>   sudo koha-shell -c "prove t/db_dependent/Sitemapper.t" kohadev
> 
> The tests pass, even without the patch.

Depends on your permissions, but the patch is definitely an improvement.
Comment 5 Marcel de Rooy 2017-01-18 12:12:23 UTC
Created attachment 59157 [details] [review]
Bug 17920: t/db_dependent/Sitemapper.t fails because of permissions

The directory it attempts to create an xml file may not be writable for
the user running the test. By changing the directory from the current
directory to a temporary one, the test runs. After all 'chmod 777
t/db_dependent' is a bad idea.

TEST PLAN
---------
1) sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   -- fails
2) apply patch
3) sudo koha-shell "prove t/db_dependent/Sitemapper.t" kohadev
   -- succeeds
4) run koha qa test tools

Tested without qa tools
Signed-off-by: Claire Gravely <claire_gravely@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2017-01-18 12:13:12 UTC
Mark,
Here are a few other potential candidates:

t/db_dependent/SuggestionEngine_ExplodedTerms.t:    my $location = File::Spec->rel2abs(dirname(__FILE__));
t/db_dependent/www/auth_values_input_www.t:my $testdir = File::Spec->rel2abs( dirname(__FILE__) );
t/db_dependent/www/batch.t:my $testdir = File::Spec->rel2abs( dirname(__FILE__) );
t/db_dependent/www/search_utf8.t:my $testdir = File::Spec->rel2abs( dirname(__FILE__) );
t/db_dependent/zebra_config.pl:my $source = File::Spec->rel2abs('.');
Comment 7 Mark Tompsett 2017-01-18 13:51:53 UTC
(In reply to Marcel de Rooy from comment #6)
> Mark,
> Here are a few other potential candidates:
> 
> t/db_dependent/SuggestionEngine_ExplodedTerms.t:    my $location =
> File::Spec->rel2abs(dirname(__FILE__));
> t/db_dependent/www/auth_values_input_www.t:my $testdir =
> File::Spec->rel2abs( dirname(__FILE__) );
> t/db_dependent/www/batch.t:my $testdir = File::Spec->rel2abs(
> dirname(__FILE__) );
> t/db_dependent/www/search_utf8.t:my $testdir = File::Spec->rel2abs(
> dirname(__FILE__) );
> t/db_dependent/zebra_config.pl:my $source = File::Spec->rel2abs('.');

Since you mentioned these, I'll put these on a separate bug.
Comment 8 Kyle M Hall 2017-01-20 14:06:40 UTC
Pushed to master for 17.05, thanks Mark!
Comment 9 Katrin Fischer 2017-01-22 20:16:51 UTC
This patch has been pushed to 16.11.x and will be in 16.11.02.

Couldn't reproduce the error on kohadevbox, but patches still pass after applying the patch.
Comment 10 Mason James 2017-01-27 03:48:37 UTC
Pushed to 16.05.x, for 16.05.08 release