-
-
Notifications
You must be signed in to change notification settings - Fork 4.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 risky test without assertion #32761
Conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.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.
👍
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
@PVince81 you added tests/lib/Encryption/UtilTest.php last week, but it doesn't work:
Can you have a look? |
hmm, they worked for me locally but I had files_external enabled. probably because we're using a class from an app that might not be enabled during test run, or only during specific order I'll see if I can trigger enabling of the app in setUp, otherwise will need to do it in the test setups |
Because we have more tests now that require classes from this app. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
I didn't find code in core where the app would be enabled through tests, so I added it to "enable_apps.php": 6df0a79 turns out other apps like "encryption" is there too let's see if the tests pass now on CI... they passed locally again for me until I disabled files_external |
looks like enabling files_external makes it worse as now tests are trying to run, I'll revert it for now. will need another more targetted solution that doesn't require including the class |
This reverts commit 6df0a79.
Don't rely on files_external being enabled and mock all the classes from it. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
here we go, all mocked: de93d17 not sure how long this PR will live, we might want to cherry pick some fixes into separate PRs ? |
$storagesServiceMock->expects($this->atLeastOnce())->method('getAllStorages') | ||
->willReturn($storages); | ||
|
||
$this->overwriteService(GlobalStoragesService::class, $storagesServiceMock); | ||
$this->overwriteService('OCA\\Files_External\\Service\\GlobalStoragesService', $storagesServiceMock); |
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.
Why for core class you went from string to ::class and for files-external classes you go the other way around?
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.
Because core classes are fine. This class might not be loaded as the test is in core and the app is not force enabled nor default enabled
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.
maybe some day... owncloud/core#25422
Before: