Replacing old hooks with symfony events#25
Conversation
fa0f4a7 to
d4f3c82
Compare
|
Hi @sharidas are there any news on that PR? |
|
@micbar what happens to old PRs like this? |
|
@janackermann @JammingBen Can you do a rebase? |
Yes we can, but this code doesn't work proper, we need to make changes to the core aswell to make it work |
|
We digged into this and created a new branch: https://github.com/owncloud/encryption/compare/revisit-symfony-events. The issues we have encountered so far:
Some tests do a tearDown after they have finished. This tearDown calls I am unsure about how to fix this properly because it may affect other scenarios. Possible solutions that come into my mind:
Maybe @micbar or @DeepDiver1975 could give us a hint to find an appropriate solution here? Edit: After some more debugging this behaviour seems to be directly and only related to the tests. The Symfony event listeners of UserHook.php seem to listen during the whole test run, so the corresponding events get fired. This was not the case with the previous event system. Edit2: We resolved the issue |
|
@JammingBen mind to sign the cla? it is just a click away in the link provided by the cla assistant 😄 |
|
Resolved the above mentioned issues in the meantime, still need to fix the acceptance tests though. |
|
@JammingBen can you also do a rebase? |
5ea27d3 to
611f4ec
Compare
|
The pending PR became obsolete as I found a way to use the existing event emitters in core. However, there is still one acceptance test failing: |
|
The last nightly run of tests with encryption on had a list of fails in tags scenarios: https://drone.owncloud.com/owncloud/encryption/1552/120/17 - those happened with both master and user key encryption. I will follow that up in the morning. https://drone.owncloud.com/owncloud/encryption/1552/120/17 - the test fails also with user key encryption. That test is supposed to have the sequence:
|
That is perhaps related to owncloud/core#38197.
Ahh you're right, it also happens with user key encryption :/ Maybe the user hooks still act different than the old ones... I will do some more tests on this. |
|
Phew... finally found the issue here. The Symfony Event Dispatcher during loginWithPassword sits after the When I move the event dispatcher a few lines up to where it was before, the tests work fine. @phil-davis Do you know the intention behind this? The question now is, do we change the position of the event emitter, or do we adjust this test scenario... |
|
The scenario is intended to test that a user can be created by the admin, and between the time that the user is created and the time that the user actually receives their password and logs in (might be 24 hours later or...) people share things with the new user. Those shares should work, and be seen by the user when they login, even if the received shared resource happens to have a name that matches a skeleton file or folder. The scenario The test could be re-factored so that it allows either way around. But it would be nice if the behaviour in core without encryption is the same is with encryption enabled. Otherwise someone will get confused about it some day. |
I second that. So in summary: the problem is the position of the dispatched Is there a reason why the
Seems to be very inconsistent... Maybe @DeepDiver1975 @jvillafanez you guys know something about this decision? |
I don't know. It should be consistent. If there is no comment explaining and the commit introducing the change doesn't say anything about it, for me it's a bug. |
|
Once owncloud/core#38289 goes through, this one might finally be ready (to review). |
jvillafanez
left a comment
There was a problem hiding this comment.
just a couple of things, but in general I think it's good.
|
|
||
| public static function tearDownAfterClass(): void { | ||
| parent::tearDownAfterClass(); | ||
| \OC_App::disable('encryption'); |
There was a problem hiding this comment.
Is this needed? I'm not sure if this will affect to other tests. We might want to run the whole test suite with encryption enable and this could disable encryption. This could mean that the rest of the suite will be run without encryption.
tests/unit/Hooks/UserHooksTest.php
Outdated
| $this->recoveryMock = $recoveryMock; | ||
| $this->utilMock = $this->createMock(Util::class); | ||
| $this->utilMock->expects($this->any())->method('isMasterKeyEnabled')->willReturn(false); | ||
| $this->eventDispatcher = \OC::$server->getEventDispatcher(); |
There was a problem hiding this comment.
I'd rather use a mock instance instead. I don't know if it will break things or not.
|
Kudos, SonarCloud Quality Gate passed! |
Replacing old hooks with symfony events.
The old hooks were private hooks. The symfony
events are public.
Signed-off-by: Sujith H sharidasan@owncloud.com