test: test moving cache items from cache jail with sharding

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/54580/head
Robin Appelman 2025-08-22 19:11:37 +07:00
parent 1a716578fd
commit afe77e32f2
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 19 additions and 0 deletions

@ -10,6 +10,7 @@ namespace Test\Files\Cache;
use OC\Files\Cache\Cache;
use OC\Files\Cache\CacheEntry;
use OC\Files\Cache\Wrapper\CacheJail;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
use OC\Files\Storage\Temporary;
@ -521,6 +522,24 @@ class CacheTest extends \Test\TestCase {
$this->assertTrue($this->cache->inCache('targetfolder/sub'));
}
public function testMoveFromCacheJail(): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'];
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE];
$this->cache2->put('folder', $folderData);
$this->cache2->put('folder/sub', $data);
$jail = new CacheJail($this->cache2, 'folder');
$this->cache->moveFromCache($jail, 'sub', 'targetsub');
$this->assertTrue($this->cache2->inCache('folder'));
$this->assertFalse($this->cache2->inCache('folder/sub'));
$this->assertTrue($this->cache->inCache('targetsub'));
$this->assertEquals($this->cache->getId(''), $this->cache->get('targetsub')->getParentId());
}
public function testGetIncomplete(): void {
$file1 = 'folder1';
$file2 = 'folder2';