[Test] Rename fixture and refactor to solve random error#3677
[Test] Rename fixture and refactor to solve random error#3677samsonasik merged 10 commits intomainfrom
Conversation
|
I refactored RenameForeachValueVariableToMatchMethodCallReturnTypeRector to ensure return node only when variable renamed. |
| if (! is_file($inputFilePath)) { | ||
| // give enough time to write process | ||
| sleep(3); | ||
| } |
There was a problem hiding this comment.
on file not exists, it probably file write and read is overlapped, this is to ensure give enough time to write process.
|
All checks have passed 🎉 @TomasVotruba let's give it a try ;) |
| // write temp file | ||
| FileSystem::write($inputFilePath, $inputFileContents); | ||
|
|
||
| if (! is_file($inputFilePath)) { |
There was a problem hiding this comment.
Why shouldn't the file exists? Where is it deleted?
There was a problem hiding this comment.
Probably overlapped by tearDown
rector-src/packages/Testing/PHPUnit/AbstractRectorTestCase.php
Lines 73 to 78 in 10c36b0
There was a problem hiding this comment.
Could be verified by dropping the delete.
Do tests exist which re-use the same fixture ?
There was a problem hiding this comment.
that's temporary file with .php file instead of .php.inc so it needs to be deleted, I am thinking that internal phpunit tearDown may cause the overlap
* [Test] Rename fixture to solve random error * [ci-review] Rector Rectify * [ci-review] Rector Rectify * also rename fixture on PropertyRenameFactoryTest * increment name * reduce fixture length * refactor * try give enough time to write to temporary file when FileSystem::write() overlapped * fix phpstan * retry write --------- Co-authored-by: GitHub Action <actions@github.com>
@staabm @TomasVotruba let's see if it can solve random error like in https://github.com/rectorphp/rector-src/actions/runs/4781602665/jobs/8500219176#step:5:78