Skip to content
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

Fixes RedisCanBeAccessed inconsistent check results #45

Merged
merged 1 commit into from Jul 26, 2018
Merged

Fixes RedisCanBeAccessed inconsistent check results #45

merged 1 commit into from Jul 26, 2018

Conversation

Namoshek
Copy link
Contributor

This is only a small PR that hopefully fixes inconsistent check results of the RedisCanBeAccessed check. When I tested the foundation for this test, Redis::connection($name), it seemed to already return a connected connection. But my recent tests do not really confirm this. So I made the check a bit more expressive by explicitely connecting to the redis server.

I also added some additional test cases and additional error messages (also for better testability).

@slavarazum
Copy link

Have found that Redis::connection()->isConnected() always returns false if previously application didn't connect to it.
Try to connect at first in RedisCanBeAccessed before check by isConnected() method.

Tested on Ubuntu: http://prntscr.com/k97e9b
Tested on Mac: http://prntscr.com/k97eoi

Also it works if you try to get some key value: http://prntscr.com/k97j2a

@eduardokum
Copy link

eduardokum commented Jul 23, 2018

You can check the connection this way too.

Str::upper(Redis::connection()->executeRaw(['ping'])) != 'PONG'

like this. eduardokum@9d06479

@mpociot mpociot merged commit 64668ce into beyondcode:master Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants