I am using parallel testing addon for phpunit, paratest, with a Laravel application to speed up the execution of our testsuite. This works most of the time but occasionally I get the following failure.
League\Flysystem\Exception: Impossible to create the root directory "/codebuild/output/src0123456/src/github.com/org/repo/storage/framework/testing/disks/local". file_get_contents(/codebuild/output/src0123456/src/github.com/org/repo/.env): failed to open stream: No such file or directory
/codebuild/output/src0123456/src/github.com/org/repo/vendor/league/flysystem/src/Adapter/Local.php:112
/codebuild/output/src0123456/src/github.com/org/repo/vendor/league/flysystem/src/Adapter/Local.php:78
/codebuild/output/src0123456/src/github.com/org/repo/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemManager.php:167
/codebuild/output/src0123456/src/github.com/org/repo/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:261
/codebuild/output/src0123456/src/github.com/org/repo/vendor/laravel/framework/src/Illuminate/Support/Facades/Storage.php:70
/codebuild/output/src0123456/src/github.com/org/repo/tests/TestCase.php:42
The failure on line 42 relates to this line which is creating the local storage folder for testing.
Storage::persistentFake();
I think the second half of the error that mentions the .env file is unrelated as the exception picks the last logged error rather than the error related to the failure.
This only happens every now and again so it must be a sequence of operation or timing issue.
The tests are running and failing inside an AWS codebuild environment against php 7.3 and 7.4.
Anyone have any ideas?