Closed Jacobs63 closed 2 months ago
I believe this should be resolved now with with https://github.com/DirectoryTree/LdapRecord/pull/716. Let me know if otherwise and I can re-open this issue.
Hello,
I've made the issue soon after testing your previous fix.
As I've said, the issue persists but in a different way, as stated above.
Thanks for confirming @Jacobs63.
Linking this here so I can resolve later tonight:
@Jacobs63 I've made a change that will now only register log event listeners if logging is enabled: https://github.com/DirectoryTree/LdapRecord-Laravel/commit/7ab356542792611d83e65493b928304af54f04aa
Can you confirm if this is what you're referring to? If not, can you link exactly where these listeners are being registered and offer reproduction code examples?
Ok fixed in latest v3.3.4 release.
Hey Steve,
sorry for getting back to you so late! Had other priorities on projects instead of unit tests the past month.
I've updated the package to 3.3.5, however, it did not help. I've done some additional debugging to be able to help you out with the debugging a bit.
The first test that runs after using DirectoryEmulator::setup()
still logs a ton of messages as duplicate, I've enabled Spatie's Ray to figure out the first running test in our suite & purposely ran the tests without parallel to be able to get a better understanding.
The first test that uses the emulator is n.o. 478
During this test, all info messages get logged 461 times:
This sort-of correlates with the amount of tests being run in total (and the amount of Laravel application instances being created in the setUp
method of our test cases).
Having LDAP enabled/disabled beforehand has no effect.
The screenshot from Ray should perhaps help you out with finding which listeners take care of that and thus finding out what does not get properly flushed when the Laravel application instance tears down.
Update - checked the related MR you've posted once again, seems like I've disabled the LDAP and not it's logging - setting the ldap.logging.enabled
option to false
via the PHPUnit LDAP_LOGGING
server variable prevents this logging as this gets loaded via env
during the framework boot method.
Thanks for the fix, this was a mistake on my side :)
I've ran profiling on our tests, disabling those logs has a very noticeable impact.
Before:
After: Well.. those tests are nowhere to be seen in the top 10 slowest tests :)
So either way, it still seems like the teardown is not handled properly, this is more of a workaround, but I'm okay with that, since I don't really see a point in logging this when running our tests.
This is a continuation of #653
The service provider appends those logging event listeners every time the framework is booted, regardless of whether LDAP is actually used or not.
This means this still slows down the testing process, until the first test that actually uses LDAP and calls the teardown is called.
In real-case scenario, that means I have around 360 test cases that append these listeners, then a slow test which uses LDAP & logs 360*n changes, tears down and resets these listeners.
I don't believe I should be calling the tearDown on every test, since I don't use LDAP in every test.