Laravel-AdminLTE icon indicating copy to clipboard operation
Laravel-AdminLTE copied to clipboard

[BUG] Running tests gives error: ErrorException : symlink(): Permission denied

Open PiousVenom opened this issue 3 years ago • 4 comments

Describe the bug

Upon running unit tests, I received the following:

There were 12 errors:

  1. InstallTest::testInstallOnly ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:41

  1. InstallTest::testInstallOnlyInteractive ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:84

  1. InstallTest::testInstallOnlyOverwrite ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:136

  1. InstallTest::testInstallWithoutType ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:221

  1. InstallTest::testInstallWithTypeEnhanced ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:257

  1. InstallTest::testInstallWithTypeFull ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:295

  1. InstallTest::testInstallWithAdditionalResource ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:338

  1. InstallTest::testInstallWithMultipleAdditionalResources ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\InstallTest.php:384

  1. PluginsTest::testInstallAndUninstallSpecificOverwrite ErrorException: mkdir(): No such file or directory

D:\Things\Laravel-AdminLTE\tests\Console\PluginsTest.php:185

  1. PluginsTest::testAllPluginStatus ErrorException: mkdir(): No such file or directory

D:\Things\Laravel-AdminLTE\tests\Console\PluginsTest.php:219

  1. UpdateTest::testUpdateAssets ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\UpdateTest.php:11

  1. UpdateTest::testUpdateAssetsOverwrite ErrorException: symlink(): Permission denied

D:\Things\Laravel-AdminLTE\tests\Console\CommandTestCase.php:139 D:\Things\Laravel-AdminLTE\tests\Console\UpdateTest.php:34

--

There were 5 failures:

  1. PluginsTest::testInstallAndUninstallAll Failed asserting that false is true.

D:\Things\Laravel-AdminLTE\tests\Console\PluginsTest.php:52

  1. PluginsTest::testInstallAndUninstallSpecific Failed asserting that false is true.

D:\Things\Laravel-AdminLTE\tests\Console\PluginsTest.php:85

  1. PluginsTest::testInstallAndUninstallSpecificInteractive Failed asserting that false is true.

D:\Things\Laravel-AdminLTE\tests\Console\PluginsTest.php:143

  1. PluginsTest::testSpecificPluginStatus Failed asserting that false is true.

D:\Things\Laravel-AdminLTE\tests\Console\PluginsTest.php:250

  1. CommandHelperTest::testCopyDirectoryWhenSourceRestricted Failed asserting that directory "test-folder-copy" does not exist.

D:\Things\Laravel-AdminLTE\tests\Helpers\CommandHelperTest.php:149

A quick search, and I found https://github.com/jeroennoten/Laravel-AdminLTE/pull/811, but looking at the link to the PR, it's empty since it's too old.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Fork Repo
  2. Clone new fork locally
  3. Run composer install
  4. Run vendor/bin/phpunit --coverage-html coverage

Expected behavior

I would expect tests to pass on fresh clone of forked repo.

Environment

Complete the next environment information.

Item Version
Laravel 8.5
Project 3.6.1
OS Windows 10

PiousVenom avatar Jul 13 '21 21:07 PiousVenom

I just tested running the tests on my Linux machine and they works fine. I have also executed composer update to get the last Laravel 8.50.0 version and they run fine. Can you check if it is not related to permissions on the folder? Also, give a try to first solution on next stackoverflow post:

https://stackoverflow.com/questions/38521329/how-to-fix-permission-denied-while-running-vendor-bin-phpunit-in-a-laravel-proje

dfsmania avatar Jul 14 '21 01:07 dfsmania

As I stated, I'm not running on Linux. However, the SO post helped, but I'm still getting one error:

  1. CommandHelperTest::testCopyDirectoryWhenSourceRestricted Failed asserting that directory "test-folder-copy" does not exist.

I'm wondering in the grand scheme of it, if I were to do a push and let the Actions run, that test would pass?

PiousVenom avatar Jul 14 '21 04:07 PiousVenom

That test fails because it tries to change file permissions using chmod to assert a folder can't be copy when permissions are not right, but in windows permissions works different. Maybe we can try to ignore that tests, and maybe other ones, when underlying SO is Windows (I will get into this on the future). For the moment, you can ignore it, since tests runs on a Linux machine when you make a PR.

dfsmania avatar Jul 14 '21 14:07 dfsmania

That test fails because it tries to change file permissions using chmod to assert a folder can't be copy when permissions are not right, but in windows permissions works different. Maybe we can try to ignore that tests, and maybe other ones, when underlying SO is Windows (I will get into this on the future). For the moment, you can ignore it, since tests runs on a Linux machine when you make a PR.

I thought about that, being a Linux runner. I did a test push, and it failed when it tried to do upload the code coverage, said the file didn't exist. I'm going to work on the change I'd like, and figure this part out later. Thank you for your help.

PiousVenom avatar Jul 14 '21 14:07 PiousVenom