- Issue created by @alexpott
- πΊπΈUnited States nicxvan
Do we want a flag to allow them to stay for local debugging if you need to see the actual files created for some reason?
And maybe a way to confirm that cleanup happened so future tests have to clean up after themselves. - π¬π§United Kingdom alexpott πͺπΊπ
@nicxvan no - we don't offer that in WebDriverTestBase which does the same thing. You can always preserve the environment by adding an exit() to the test.
FWIW the fix to \Drupal\Core\File\FileSystem::deleteRecursive() almost makes me want to make this issue about that and not KTB and tidying up. This feels like a serious data destruction bug - we should not be recursing into links and removing files...
- πΊπΈUnited States nicxvan
exit() makes sense, my only thought was sometimes you might need to see more broadly, but that is probably super edge case and not worth the effort.
- π¬π§United Kingdom alexpott πͺπΊπ
Changing the focus of the issue to be the data loss bug discovered here by trying to cleanup the new \Drupal\KernelTests\Core\Hook\HookCollectorPassTest::testSymlink() test.
- π¬π§United Kingdom alexpott πͺπΊπ
I extended test coverage to include links to files outside of the directory being deleted. This is not currently broken but it feels good to have a test for.
- π¬π§United Kingdom alexpott πͺπΊπ
So added some test coverage of the expanded delete functionality. Which opens up more worms because of the way that streams work with links and resolve to the real file or directory and not link. Which imo results in very odd behaviour when you call delete.
- πΊπΈUnited States nicxvan
I took a look at this again, it seems pretty straightforward.
The only question I have is this worth a comment mentioning the risk to consider if this gets changed in the future?
Unless you think the comment for the tests is enough:Tests symlinks in directories do not result in unexpected deletions.
It might be helpful for people using this as example code for themselves to see what to consider. - π¬π§United Kingdom alexpott πͺπΊπ
@nicxvan I think the additional test coverage added here is fine.
- First commit to issue fork.
- πΊπΈUnited States smustgrave
Rebased because it was 190 commits back.
Funny I got 6 random errors bur re-running twice fixed those
All the new tests appear to fail in the test-only job https://git.drupalcode.org/issue/drupal-3482449/-/jobs/3688988
Dont't see any open threads believe this is good.
- π¬π§United Kingdom catch
Committed/pushed to 11.x and cherry-picked to 10.5.x, thanks!
- Status changed to Fixed
about 2 months ago 5:03pm 17 February 2025 Automatically closed - issue fixed for 2 weeks with no activity.