-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix quota with federated sharing #29220
Conversation
Note: I might want to move the DAV additions to a separate PR as I currently don't know how to properly automatically test this without commenting out the "check the parent instead" logic. |
At least this way we'll let the remote server decide in some cases whether there is enough quota when the quota is not retrievable. For that we need to properly forward the 507 error in the DAV code. |
I didn't see this View warning on master, but also master doesn't have this one test. |
Why can't I catch this with ?? diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 3e4af7cf3d..9cb9bb482f 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1294,6 +1294,10 @@ class View {
try {
// if the file is not in the cache or needs to be updated, trigger the scanner and reload the data
if (!$data || $data['size'] === -1) {
+ if (!!$data && !isset($data['size'])) {
+ $stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50));
+ \OCP\Util::writeLog('DEBUG', 'Size not set: Stack: ' . $stack, \OCP\Util::WARN);
+ }
$this->lockFile($relativePath, ILockingProvider::LOCK_SHARED);
|
Stack trace:
Seems to be about versions... |
If I remove the quota from the integration test, the warning disappears... Weird. |
also if I set the quota high enough in the test, the warning disappears as well. |
If I revert every code change and keep the test, the error appears... so this existed before. |
I've raised #29245 to explain and analyze this bug. It seems unrelated to this PR. It's just that adding the new tests brought it into view. |
Ok, now that we know the warning is unrelated, let's focus on finishing this. |
8d3dbf9
to
b274f67
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, but tests are failing
Relevant failing tests:
|
Ha... failing tests are failing because I added an extra check to assert that setting the quota worked. And apparently here it didn't but the test still passed. |
stable10: #29259 |
ce0ea8f
to
28fec80
Compare
Codecov Report
@@ Coverage Diff @@
## master #29220 +/- ##
===========================================
+ Coverage 59.59% 60.2% +0.6%
- Complexity 17169 17182 +13
===========================================
Files 1029 1030 +1
Lines 57235 57270 +35
===========================================
+ Hits 34111 34477 +366
+ Misses 23124 22793 -331
Continue to review full report at Codecov.
|
I went through great lengths to make codecov happy: 5b5689c
Now waiting to see the new coverage and I'll continue adding tests for that. |
Added moar tests |
Let's watch the test coverage for the DAV class increase now! |
@jvillafanez @DeepDiver1975 please review again. To make codecov happy I had to go to great length and bootstrap unit tests for the Storage\DAV class. In my way of doing this I decided to cover all methods and discovered some small issues on the way which I fixed right away, some others which I will raise later. |
tests/lib/Files/Storage/DavTest.php
Outdated
* ownCloud | ||
* | ||
* @author Robin Appelman | ||
* @copyright 2012 Robin Appelman icewind@owncloud.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to fix that right away...
Properly detect SPACE_UNLIMITED in quota check. Improve error handling when receiving errors like 507 when uploading files to a remote server.
b15219c
to
1a2903f
Compare
Rebased and squashed the DAV test (+fix) commits together into one. DAV.php coverage is now 88% |
/** | ||
* Instantiate new Sabre client | ||
* | ||
* @param array $settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid settings should be known both here and in the interface
Added tests for all FS methods of the Storage\DAV class and also fixed some related issues.
1a2903f
to
4ba6cda
Compare
I've copied the Sabre client settings PHPDoc into the interface and WebdavClientService. Since CI was all green and the PHPDoc will not affect it, I'm merging this directly. |
I was still right in the middle of review .... |
stable10: #29325 |
@DeepDiver1975 sorry, please continue then. I'll adjust in a subsequent PR. |
* | ||
* @package OC\Http | ||
*/ | ||
class WebdavClientService implements IWebdavClientService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be named WebDav
$this->timeFactory = $this->createMock(ITimeFactory::class); | ||
$this->overwriteService('TimeFactory', $this->timeFactory); | ||
|
||
$this->httpClient = $this->createMock(IClient::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing use of IClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
/** | ||
* @expectedException OCP\Files\StorageNotAvailableException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private $webdavClientService; | ||
|
||
/** | ||
* @var Client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done |
Follow up PR for the review items: #29327 |
regression: #29422 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Fix quota with federated sharing and add tests for that.
Related Issue
Fixes #29169
Motivation and Context
How Has This Been Tested?
Run federation_features/federated.feature:240 and quota.feature.
Screenshots (if appropriate):
Types of changes
Checklist: