snc / SncRedisBundle

A Redis bundle for Symfony supporting Predis and PhpRedis
https://github.com/snc/SncRedisBundle
MIT License
1.04k stars 327 forks source link

Test environment: $instance->select() causes Redis Server Went Away #317

Closed zaiddabaeen closed 3 years ago

zaiddabaeen commented 7 years ago

In CI, the pipeline is tested using atoum PHP tests. Redis clients are defined for cache and sessions storage and so on, hence there is no need for Redis in the test environment, nor is it called anywhere in the unit tests. One of the redis clients I am using uses database 1 rather than the default.

In the app/cache/test/appTestProjectContainer.php file:

    protected function getSncRedis_CacheService()
    {
        $this->services['snc_redis.cache'] = $instance = new \Redis();

        $instance->connect('127.0.0.1', 6379, 5);

        return $instance;
    }

    protected function getSncRedis_SessionsService()
    {
        $this->services['snc_redis.sessions'] = $instance = new \Redis();

        $instance->connect('127.0.0.1', 6379, 5);
        $instance->select(1);

        return $instance;
    }

Select() method fails with Redis Server went away. All the other clients do not throw exceptions. This exception should be handled for test environments.

curry684 commented 6 years ago

I'm not sure I understand what's happening here. If I understand you correctly the connection is made correctly but then crashes when selecting a different database, while using PhpRedis. In that case this would be a bug in PhpRedis right, not the bundle?

ostrolucky commented 3 years ago

3 years without response = sorry, we have to close this