Open austintino opened 7 years ago
@olemartinorg Any idea what might be causing this? Issue caused in the code of your last commit.
Thanks in advance!
Huh.. I think this must be a problem with the file system mirror inside the Vagrant VM. I've had strange problems like this with the VirtualBox shared folder drivers before. Can you check a few things for me?
Did you find a solution, @austintino?
Hi @olemartinorg,
Apologies for the slight delay in replying. You can find the answers to your questions below.
As stated above, the c3tmp
directory is created by running the functional tests but then fails to be be able to write files to it which is very peculiar. How the information below helps.
1. Connect to the VM as the root user and try to touch a file in the same directory.
vagrant@ubuntu: ssh root@locahost
root@ubuntu:~# whoami
root
root@ubuntu:~# touch /var/www/phpapps/api.testurl.test/tests/_output/c3tmp/testfile.txt
root@ubuntu:~# ls -l /var/www/phpapps/api.testurl.test/tests/_output/c3tmp/
total 0
-rw-r--r-- 1 vagrant vagrant 0 Aug 23 11:37 testfile.txt
No issues creating a file in this directory. I had tried this before and found the same results.
2.a What are the permission settings on the folder on the host machine?
MyName:api.testurl.test thisismyname$ ls -l /Users/thisismyname/Sites/api.testurl.test/tests/_output/
total 1512
-rw-r--r-- 1 thisismyname staff 1631 23 Aug 11:30 GroupTokenCest.validGroupToken.fail.html
drwxr-xr-x 9 thisismyname staff 306 23 Aug 11:33 blah
drwxr-xr-x 3 thisismyname staff 102 23 Aug 11:37 c3tmp
-rw-r--r-- 1 thisismyname staff 766071 23 Aug 11:31 coverage.serialized
2.b What are you running on your host, is it win/mac/linux?
The host machine is
iMac, Late 2009
macOS Sierra Version 10.12.6
The VM is
VirtualBox
Version 5.1.18 r114002
Vagrant 1.9.2
Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-31-generic x86_64)
3. On the VM, try 'stat someFileThatDontExist' and then create it on your host machine (not on the VM!). After that, run 'ls -l' in the folder to see what the permissions on that (now existing) file is.
On the VM:
vagrant@ubuntu:~$ whoami
vagrant
vagrant@ubuntu:~$ stat /var/www/phpapps/api.testurl.test/tests/_output/c3tmp/doesntexist.txt
stat: cannot stat ‘/var/www/phpapps/api.testurl.test/tests/_output/c3tmp/doesntexist.txt’: No such file or directory
On the host:
MyName:~ thisismyname$ stat /Users/thisismyname/Sites/api.testurl.test/tests/_output/c3tmp/doesntexist.txt
stat: /Users/thisismyname/Sites/api.testurl.test/tests/_output/c3tmp/doesntexist.txt: stat: No such file or directory
MyName:~ thisismyname$ touch /Users/thisismyname/Sites/api.testurl.test/tests/_output/c3tmp/doesntexist.txt
MyName:~ thisismyname$ ls -l /Users/thisismyname/Sites/api.testurl.test/tests/_output/c3tmp/doesntexist.txt
-rw-r--r-- 1 thisismyname staff 0 23 Aug 11:55 /Users/thisismyname/Sites/api.testurl.test/tests/_output/c3tmp/doesntexist.txt
Any update @olemartinorg ?
Oh, sorry about this - I forgot all about it and went on vacation...
Anyway, thanks for all the debugging! I have some more questions, that didn't quite clear things up for me.
Hi @austintino , you can sudo as your webserver/php process user and try to create, edit and save file /var/www/phpapps/api.testurl.test/tests/_output/c3tmp/codecoverage.serialized ` su www-data -s /bin/bash
vi /var/www/phpapps/api.testurl.test/tests/_output/c3tmp/codecoverage.serialized
i new text
[ESC]:qw
ls -al /var/www/phpapps/api.testurl.test/tests/_output/c3tmp/ ` then you will know where to continue with your issue investigation.
Description
I seem to receiving an error when trying to generate code coverage for functional tests inside Vagrant. The tests run and the code coverage generates fine but some test fail (namely any check on the response being valid JSON) due to
PHP Warnings
being thrown by the c3.php file.Steps
When ssh'd into vagrant, I run this command:
All 3 tests fail when trying to assert
$I->seeResponseIsJson();
. When taking a look at the failure report generate intests/_output/tests.Company.Product.CategoriesCest.orderCategoriesDesc.fail.html
I see the following error:At line 321,
c3.php
is trying to execute:https://github.com/Codeception/c3/blob/f08f20b0b6191f0c58be022c6f20d5b1cdc1004c/c3.php#L320-L322
which it can't complete because the permissions for c3tmp directory are as follows:
I'm puzzled as to why codeception wouldn't have permissions to write
codecoverage.serialized
inc3tmp/
when it has created the directory itself... Furthermore, applying full read-write permissions to thec3tmp/
via:results in even more
PHP Warnings
being generated seemingly from the same type of issue i.e incorrect file permissions, read-write lock etc. I've detailed these issues below:Additional Information
Vagrant: Vagrant 1.9.2
PHP: PHP 5.5.9-1ubuntu4.20 (cli)
functional.suite.dist.yml