New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Test] Rename fixture and refactor to solve random error #3677
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ;) |
@@ -125,6 +125,14 @@ protected function doTestFile(string $fixtureFilePath): void | |||
// write temp file | |||
FileSystem::write($inputFilePath, $inputFileContents); | |||
|
|||
if (! is_file($inputFilePath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why shouldn't the file exists? Where is it deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably overlapped by tearDown
rector-src/packages/Testing/PHPUnit/AbstractRectorTestCase.php
Lines 73 to 78 in 10c36b0
protected function tearDown(): void | |
{ | |
// clear temporary file | |
if (is_string($this->inputFilePath)) { | |
FileSystem::delete($this->inputFilePath); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be verified by dropping the delete.
Do tests exist which re-use the same fixture ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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