-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[9.x] Improve redis test suite #41718
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
[9.x] Improve redis test suite #41718
Conversation
3912fb4 to
9290e40
Compare
9290e40 to
95c2454
Compare
|
@tillkruss could you have a look as well, please? |
tillkruss
left a comment
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.
This looks good to me. Thank you split-diff-view.
|
I get some Redis failures when running |
Thank you, I will try to run it locally and fix the remaining issue. So far I was just targeting the CI to pass. |
Found the issue. The testsuite locally or in CD is not properly set up to allow TLS/SSL/sentinel connections to redis via predis. It's also not the purpose of those tests to actually test the connection, but rather whether the parameters are properly picked up and set on the connection class. After reverting the changes for the connection tests, it works now. |
e910035 to
4db3147
Compare
|
@taylorotwell @tillkruss The pull request is ready for the final review. Local test run is fixed (I was not aware of /bin/test.sh before 😅). The issue was that the local setup is not configured to support actual tls/sentinel connections (new code tries to always connect, flush the db on connect and flush the db on disconnect in the end, which does not work locally for those connections). So I reverted those specific connection tests to just validate whether the connection params are properly set. |
4db3147 to
5a4c643
Compare
|
I've made some adjustments within phpunits config And got the following output on W11 + WSL2 (tests running within docker). None of those seem to have any connection to redis tests, but are related to either the test.sh being written with macOS in mind or the docker image itself (webp missing -> gd): pull41718.log |
|
@TheLevti I see the same thing as Taylor. Works on 9.x but get weird results on your branch. |
0085298 to
0228708
Compare
|
@driesvints @tillkruss @taylorotwell could you please try again? I updated the test.sh to support any platform. It seems like it was written specifically for mac os only. It should now run on mac os, linux or windows WSL the same way. In addition I noticed that sometimes windows tests failed (https://github.com/laravel/framework/runs/7163912435?check_suite_focus=true), because the The added changes are:
|
c29ccc5 to
927e67b
Compare
|
Output is still all messed up for me. I don't really have time atm to take on such a big PR. Sorry 🫤 |
Can someone please tell me what is wrong with the output? The proposed changes are not related and ci/tests are passing perfectly fine for a long time now. I suspect we still have a non os independent local test setup, which causes some trouble. I asked several of my colleagues to git clone and run the test script on multiple different machines and all finish without a problem now. Even though we found some more points that can be improved for the local test run. |
|
Tests run fine for me on macOS 12.4 using iTerm2 3.4.16. |
|
@TheLevti I think the best course of action for now might be to send in smaller incremental PR's to see if we can solve this and spot the output bug in one of them. Like Taylor indicated, it will probably be impossible to review such a large PR. |
I would like to avoid losing this changes as they have been already reviewed by others and the final benefit is worth the effort. But if Tylor has the last say, I will of course try with smaller chuncks if this is the only way. It would be helpful to get the locally broken output reproduced though. If anyone could contribute with their output plus terminal they use where it is broken, this would be nice. My suggestion here then would be:
Would that work or can we get this pull request fixed somehow together? Anyone knows what machine + which terminal Tylor is using? |
|
Yeah, it's hard to make this PR smaller. Maybe someone who gets the wonky output can do a quick call for diagnostics? |
|
Does it happen to you when you do a fresh git clone and run the tests on your machine @driesvints as for you the output was also broken before? I suspect some old not tracked files/folders with an incorrect user/acl cause some issues. |
|
I can confirm I no longer see the weird test output. I have no idea why that is... I ran @TheLevti we recently made a move to remove as many skipped output as possible. However, this PR re-adds a bunch of that, making it harder to dig into failed tests in the CI. Can you do this differently maybe? |
I added those tests, because I wanted to add the necessary support in the follow up pull request where those tests would run successfully. Shall I leave them and wait for the next pull request or get them out? My follow up pull request will add proper support on the cache component. I just first wanted to clean up redis tests. |
|
It's best to filter out this before we merge. Otherwise it's going to be annoying to review other pr's or failing builds where test fail. |
Ok, sure. Will re-add them once the relevant code will be added. Thank you for the input 🥳 |
|
@driesvints Incomplete tests are gone. What are the next steps? |
|
@taylorotwell will review this next |
|
I still get a bunch of errors locally - I have no idea. I again don't really have a ton of time to dig into this and it's a huge change to our test setup for Redis that I won't know anything about. Is there a particular bug you want to fix in Redis that exists in Laravel right now? If so, can we just fix that and add a test for it? |
Please try to run the test suite with a fresh git clone or workspace clean up (files being generated with www-data or root user must be gone). No, this is not a bug fix, but a cleanup for the current redis tests, because they are not well structured and each component that uses redis has a non consistent test flow. This pull request would first make sure that everything that uses redis, would use the same data providers. Its all about that. I wanted to do this to make sure that the planned follow up pull requests will make sure that everything still works. I will then just provide the follow up pull request with just the necessary tests. |



This is a follow up of #40569, splitting the original pull request up. This pull request is about refining the existing redis test suite making it easy to test future changes related to redis.
What changed
If any test related to redis fails, it will now output the exact data set that caused the failure:
How to use
Now when you need to test something where redis is used, you can simply add the helper trait in the beginning like so:
Then to let a test run through all possible redis variations, add one of the following doc blocks:
To get a custom redis connection during a test you can also pass two additional parameters to the
getRedisManagerhelper method where the second parameter is the driver and third parameter an connection config array:To properly clean up after every test provide the following method call in your tearDown method: