Problem/Motivation
In #3063704-20: Deprecate \Drupal\Component\FileSystem\FileSystem::getOsTemporaryDirectory() and replace with sys_get_temp_dir() I found that tests using OS temporary directory instead of one defined by file_system service.
It may cause to use /tmp even if settings.php overrides it (it possible that OS does not allow to use common directory - systemd PrivateTmp=true)
Proposed resolution
Use \Drupal\Core\File\FileSystemInterface::getTempDirectory() inside of tests
Remaining tasks
agree, patch, commit
User interface changes
no
API changes
no
Data model changes
no
Release notes snippet
no
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | interdiff-3225473-4-mr3398.txt | 4.71 KB | bhanu951 |
| #8 | 3225473-nr-bot.txt | 143 bytes | needs-review-queue-bot |
| #4 | 3225473-4.patch | 2.86 KB | andypost |
| #4 | interdiff.txt | 640 bytes | andypost |
Issue fork drupal-3225473
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
andypostNot all places allow use overridden directory
Comment #4
andyposttheme generator can't use container
Comment #8
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #11
bhanu951 commentedRerolled #4 against 10.1.x and raised MR.
Comment #12
smustgrave commentedMR has failures it seems
Comment #13
bhanu951 commentedSeems Random test failures. Re-initiated Tests.
Comment #14
bhanu951 commentedBack to need review after tests green.
Comment #15
smustgrave commentedChange looks good now.
Comment #16
alexpottNot sure that we can change only one call in \Drupal\KernelTests\Core\Theme\TwigEnvironmentTest - if they do return different values (which is possible) then the test will fail.
I'm not convinced that this issue is worth it - we have calls to sys_get_temp_dir() in unit tests that cannot be replaced here so I think we have an expectation that for testing sys_get_temp_dir() works and is writeable.