ZF-3302: Zend_Cache Unit Tests should utilize TMPDIR environment
Description
Zend_Cache Unit Tests write to a directory in the ZF tests/ tree. Unfortunately, for systems that utilize packaging -- Fedora, Ubuntu -- this causes issues when running tests where the user running the tests is not root. It would be better to utilze the environment's TMPDIR for the tests.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2008-05-21T08:49:36.000+0000
This can be accomplished either via additions to TestHelper.php or via a config.ini directive.
Posted by Fabien MARTY (fab) on 2008-05-21T09:24:27.000+0000
It was the case but for some reasons, it has been changed to this.
So I change the bug statut to feature request.
I will try to introduce a sort of switch (is the ZF tests tree writable ? no => TMPDIR) or something like that ?
Posted by Matthew Weier O'Phinney (matthew) on 2008-05-22T07:17:56.000+0000
Attached is a patched CommonBackendTest.php file that would correct the issue.
Posted by Fabien MARTY (fab) on 2008-05-28T09:47:21.000+0000
Your patch use a ini config file ?
I don't have it ? And I don't see why ? $this->_root isn't enough ?
Posted by Jess Portnoy (jess04) on 2008-06-01T01:44:45.000+0000
About $this->_root not being enough, consider the following example:
The FC RPM installs ZF under /usr/share. However, the permissions on /usr/share do not allow regular users to write there. Therefore, if a regular user wishes to run the unit tests, he will not be able to create a temp dir under $this->_root.
The config.ini file does not currently exist and should be added. The code looks there first and, if the directive is not found, searches for the ENV var TMPDIR and, if all else fails, attempts to create the tmpdir under $this->_root.
Posted by Fabien MARTY (fab) on 2008-06-02T10:55:07.000+0000
sure but what about something like :
{{
Posted by Jess Portnoy (jess04) on 2008-06-03T01:12:17.000+0000
This is similar to my patch only it takes the option of $this->_root . DIRECTORY_SEPARATOR . 'zend_cache_tmp_dir' as preferable and does not allow the option of setting it in an INI file, which might be much more convenient than setting an ENV var. I think the config.ini option is useful and should be supported.
Any reason why you object to adding config.ini? in the future, it might serve for other things as well..
Posted by Fabien MARTY (fab) on 2008-06-03T10:18:53.000+0000
I don't want a specific configuration file for Zend_Cache
But I will try something with TestConfiguration.php which is a global one
Posted by Jess Portnoy (jess04) on 2008-06-04T00:09:51.000+0000
The idea is not for config.ini to be specific to Zend_Cache. I thought it could be a generic ZF config file which can be used for many other configurable options. TestConfiguration.php is a bit problematic cause it's more annoying to manipulate via scripting, like a package postinstall script. I think exporting TMPDIR can probably be sufficient if you really don't like the config.ini idea... But could you concat a timestamp for the zend_cache_tmp_dir? Like: return getenv('TMPDIR').DIRECTORY_SEPARATOR . 'zend_cache_tmp_dir_'.date("mdyHi");
This is because it might happen that 2 users are trying to execute the unit test at the same time.. this is a multiuser ENV after all :)
Posted by Jess Portnoy (jess04) on 2008-06-04T00:34:23.000+0000
Sorry, probably should be:
return getenv('TMPDIR').DIRECTORY_SEPARATOR . 'zend_cache_tmp_dir_'.date("mdyHis");
Posted by Fabien MARTY (fab) on 2008-06-04T10:18:05.000+0000
ok, it seems a good idea
Posted by Jess Portnoy (jess04) on 2008-06-04T22:55:41.000+0000
Great. Could you notify me once the patch is applied? I'd like to build a ZF RPM and verify this to be OK..
You may find a related discussion over here: https://bugzilla.redhat.com/show_bug.cgi?id=421241
Maybe you'll also have feedback on the ZF sub packages layout Alexander has devised.
Posted by Fabien MARTY (fab) on 2008-06-06T12:29:11.000+0000
fixed in SVN trunk, please reopen in there is still a problem
thanks
Posted by Jess Portnoy (jess04) on 2008-06-10T01:30:33.000+0000
Hi Fabian,
Thanks. I've given instruction for the Alexander Dahl who is responsible for packging ZF as RPM in Fedora. I'll keep you posted. What about config.ini? Is there a reason why you object to idea?
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:17.000+0000
Updating for the 1.6.0 release.