aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-11-07 16:53:45 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-01-31 18:27:29 +0000
commitf56a8e7e9e114bcc0c820fd26ab089e779a4f842 (patch)
tree729d2350e2dad223b35a1151e3189e2db1d4c968 /tests
parentb38708afafbaead1fcf1c54c4f7d3dfec504f045 (diff)
downloadnextcloud-server-f56a8e7e9e114bcc0c820fd26ab089e779a4f842.tar.gz
nextcloud-server-f56a8e7e9e114bcc0c820fd26ab089e779a4f842.zip
add test for updating etag with unchanged mtime
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Files/Cache/ScannerTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php
index e4c052f6025..52587aeabc7 100644
--- a/tests/lib/Files/Cache/ScannerTest.php
+++ b/tests/lib/Files/Cache/ScannerTest.php
@@ -404,4 +404,23 @@ class ScannerTest extends TestCase {
['/sub/folder/foo.txt', false],
];
}
+
+ public function testNoETagUnscannedFolder() {
+ $this->fillTestFolders();
+
+ $this->scanner->scan('');
+
+ $oldFolderEntry = $this->cache->get('folder');
+ // create a new file in a folder by keeping the mtime unchanged, but mark the folder as unscanned
+ $this->storage->file_put_contents('folder/new.txt', 'foo');
+ $this->storage->touch('folder', $oldFolderEntry->getMTime());
+ $this->cache->update($oldFolderEntry->getId(), ['size' => -1]);
+
+ $this->scanner->scan('');
+
+ $this->cache->inCache('folder/new.txt');
+
+ $newFolderEntry = $this->cache->get('folder');
+ $this->assertNotEquals($newFolderEntry->getEtag(), $oldFolderEntry->getEtag());
+ }
}