-
Notifications
You must be signed in to change notification settings - Fork 196
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
Enabled testing of APCU for all PHP versions when running with all extensions enabled #363
Enabled testing of APCU for all PHP versions when running with all extensions enabled #363
Conversation
Actually merging that with 2 failing tests is not the best practice :) |
d497b4c
to
0045448
Compare
Some more trial & error seems to give a bit of a hint with the test failures, though I'm still not sure how to fix the code or test (whichever one is actually broken...). In PHP 8.1 and later, the unserialize() inside the two level cache's load returns false in the testSaveReturnsTrueIfFastIsFullOnFirstSave test, which in turn causes errors about array access on bool (rendering the test "errored"). I added a check for that which, if it fails, will do a remove of the key in both caches and return false in that case. When I do that, the outcome of the test in PHP 8.1 is now like in PHP 7.1 (which is what the results of the above were from). Further adjusting the behavior of load() to remove only the fast cache on corruption and try the slow in that case (succeeding and potentially repopulating the fast cache if the slow succeeds) fixes the testSaveReturnsTrueIfFastIsFullOnFirstSave test in all PHP versions. testSaveOverwritesIfFastIsFull remains failing, even with that change in behavior, and I'm still not sure how unserialize() ends up returning NULL in the first place. That should in theory only happen if the data originally serialized was NULL, but all calls to save() seem to save an array. |
e9cef3a
to
354070c
Compare
8689fe4
to
b64a187
Compare
Moving to 1.23.2, as we have some PRs to be released ASAP. |
1fc208a
to
5363678
Compare
84e5a17
to
50d3926
Compare
OK, it seems the problem was in the test... The test uses a full mock, without specifying what to do on save and load, leading to the fast backend in the test returning NULL all the time, which in turn means it failed. Using partial mock that explicitly mocks only getFillingPercentage() fixes this. Should I keep the debug messages in the code I wonder, since they were instrumental in detecting the problem? There is probably a negligible overhead in checking if a debug logger is configured... |
0d23a31
to
01a80cb
Compare
In order to accomplish successful passing of tests in all supported PHP versions: - Removed a few instances of erroneous doesNotPerformAssertions annotations. - Changed the detection from "apc" to "apcu". - Added protection for classes unserialization in TwoLevels cache and made it remove the ID from either cache if it was corrupted at rest. - Fixed the testSaveOverwritesIfFastIsFull() method to only partially mock the fast cache. Specifically, mock only the getFillingPercentage() method, and still really execute the rest, rather than just return NULL, which in turn caused the test to fail. - Added debug logs in TwoLevels cache, and warnings in File cache on errors.
01a80cb
to
2a2bbcf
Compare
@boenrobot question is, if this is somehow interfering with anything. I mean the debug messages. If not, we probably should keep them. |
No. No interference, i.e. no change in behavior. The only costs are
|
Enabled testing of APCU for all PHP versions when running with all extensions enabled;
Removed a few instances of erroneous doesNotPerformAssertions annotations.
With APC(u) enabled, there are two test failures:
And honestly, I'm not entirely sure what's going on there, as I've never used two level cache. I wonder if I should mark those tests incomplete and we move on? Is this a legit bug that needs fixing? And if it's a legit bug, I'm not sure how to fix it.