Tatoeba / tatoeba2

Tatoeba is a platform whose purpose is to create a collaborative and open dataset of sentences and their translations.
https://tatoeba.org
GNU Affero General Public License v3.0
697 stars 132 forks source link

testRunExport_failsIfExportDirNotWritable fails in TatoVM #2814

Open Yorwba opened 3 years ago

Yorwba commented 3 years ago

To Reproduce

  1. In TatoVM, run phpunit tests/TestCase/Model/Table/ExportsTableTest
  2. Note that there's one failure:
    
    1) App\Test\TestCase\Model\Table\ExportsTableTest::testRunExport_failsIfExportDirNotWritable
    Failed asserting that true is false.

/home/vagrant/Tatoeba/tests/TestCase/Model/Table/ExportsTableTest.php:372



**Expected behavior**
The test should pass.

**Additional information**
The test creates a new directory at `/home/vagrant/Tatoeba/tmp/export_tests/readonly` with mode `0444`, which should ensure that it cannot be written to and the export fails. However, by watching the directory as the test was running, I observed that the directory's actual permissions are `775`. I think this is because `tmp` is [mounted as a synced folder with these permissions](https://github.com/Tatoeba/tatoeba2/blob/2284e7caba68943bbf21191cae3bbbdc9c05467c/Vagrantfile#L22) and apparently the syncing mechanism can't handle subdirectories with different permissions?

I think the best solution would be to stop syncing `tmp` and remove it from the repo while we're at it. (The directory structure held in place by "empty" files is kind of pointless.) But that's under the assumption that `tmp` contains nothing of value and it's fine to lose it when destroying the VM.
jiru commented 2 years ago

For the moment, I modified the code so that the unit test is skipped on TatoVM