summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-11-22 16:26:57 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-01-31 18:27:29 +0000
commit404b340ddaee86c7b464ed846ba96aa95c61a835 (patch)
treeea4ecb6816ecd6004df448ae2dca2a415fcb9759 /tests
parentf56a8e7e9e114bcc0c820fd26ab089e779a4f842 (diff)
downloadnextcloud-server-404b340ddaee86c7b464ed846ba96aa95c61a835.tar.gz
nextcloud-server-404b340ddaee86c7b464ed846ba96aa95c61a835.zip
add test for updating etag with unchanged mtime in child folder
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Cache/ScannerTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php
index 52587aeabc7..22d458a4a9b 100644
--- a/tests/lib/Files/Cache/ScannerTest.php
+++ b/tests/lib/Files/Cache/ScannerTest.php
@@ -423,4 +423,29 @@ class ScannerTest extends TestCase {
$newFolderEntry = $this->cache->get('folder');
$this->assertNotEquals($newFolderEntry->getEtag(), $oldFolderEntry->getEtag());
}
+
+ public function testNoETagUnscannedSubFolder() {
+ $this->fillTestFolders();
+ $this->storage->mkdir('folder/sub');
+
+ $this->scanner->scan('');
+
+ $oldFolderEntry1 = $this->cache->get('folder');
+ $oldFolderEntry2 = $this->cache->get('folder/sub');
+ // create a new file in a folder by keeping the mtime unchanged, but mark the folder as unscanned
+ $this->storage->file_put_contents('folder/sub/new.txt', 'foo');
+ $this->storage->touch('folder/sub', $oldFolderEntry1->getMTime());
+
+ // we only mark the direct parent as unscanned, which is the current "notify" behavior
+ $this->cache->update($oldFolderEntry2->getId(), ['size' => -1]);
+
+ $this->scanner->scan('');
+
+ $this->cache->inCache('folder/new.txt');
+
+ $newFolderEntry1 = $this->cache->get('folder');
+ $this->assertNotEquals($newFolderEntry1->getEtag(), $oldFolderEntry1->getEtag());
+ $newFolderEntry2 = $this->cache->get('folder/sub');
+ $this->assertNotEquals($newFolderEntry2->getEtag(), $oldFolderEntry2->getEtag());
+ }
}