Make sure to filter filecache subfolders in sql query instead of memory#36565
Make sure to filter filecache subfolders in sql query instead of memory#36565
Conversation
Codecov Report
@@ Coverage Diff @@
## master #36565 +/- ##
=========================================
Coverage 64.69% 64.69%
- Complexity 19114 19116 +2
=========================================
Files 1269 1269
Lines 74808 74816 +8
Branches 1327 1327
=========================================
+ Hits 48395 48403 +8
Misses 26022 26022
Partials 391 391
Continue to review full report at Codecov.
|
|
I will probably add 1 more unit test |
52b1c19 to
f6e8efd
Compare
|
Code looks good but we need to fix the tests. |
|
yes I noticed that my test that I wrote failed because of some wrapping logic |
f6e8efd to
c7aff85
Compare
c7aff85 to
54a4def
Compare
| $this->assertTrue(true); | ||
| } | ||
|
|
||
| public function testFolderContentsFilter() { |
There was a problem hiding this comment.
I don't really like this...
If the problem is that the parent test is calling a private method, can we adjust that test to call a public one ensuring that the call goes through the code we want? If needed, add 2 different tests, one per case.
There was a problem hiding this comment.
@jvillafanez I actually did as some other examples above in that test case. I am not sure if this is relevant to build testcase here.
There was a problem hiding this comment.
My worry is that, if we ever need to change the implementation in the CacheJail class, we might assume that there are tests, and due to the test passing we could think the code works even though it might be broken.
I think it's easier to call a public method in the CacheTest, and then copy & paste the test to adjust the expectations, if needed, in the rest of the implementations
There was a problem hiding this comment.
@jvillafanez ok now I remember why I commented with not supported as parent CacheTest calls private method of Cache class. Because if I try to call this private function I get exceptions on connection being null.
Please note that this function under test is private! It is called from public function remove, that currently has no unit tests.
There was a problem hiding this comment.
What if you test the public functions that call that private function instead?
I'm not sure if it's a better alternative that we mark the test as skipped or incomplete instead.
There was a problem hiding this comment.
Ok I will test public function remove, but it means also we cannot test filtering mechanism itself (coverage will however be happy)
54a4def to
cc5bd22
Compare
|
@mrow4a code style, double empty line |
cc5bd22 to
5dd63aa
Compare
Related issue: https://github.com/owncloud/enterprise/issues/2925
Goal: avoid having peaks in memory for large directory contents
While deleting directories with a lot of files inside using
view->unlink, we do not need to put in memory unnecessarily records. Filter for directories when only subdirs needed.Example:
unlinkon that folder contentsunlinkunlink