Skip to content

Commit

Permalink
Test max_connection logic in backend/redis
Browse files Browse the repository at this point in the history
  • Loading branch information
awmackowiak committed Jun 14, 2023
1 parent 5f9c1d5 commit ce4580d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion t/unit/backends/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,11 +1111,22 @@ def test_socket_keepalive_options(self):
}
}

x = self.Backend('socket:///tmp/redis.sock?virtual_host=/3', app=self.app)
x = self.Backend('redis://:bosco@vandelay.com:123//1', app=self.app)

assert x.connparams['socket_keepalive'] is True
assert x.connparams['socket_keepalive_options'] == {4: 300, 6: 9, 5: 45}

def test_setup_proper_max_conenction_value_depends_on_passed_value(self):
x = self.Backend('redis://:bosco@vandelay.com:123//1', app=self.app)
assert x.connparams['max_connections'] is None

x = self.Backend('redis://:bosco@vandelay.com:123//1', app=self.app, max_connections=0)
assert x.connparams['max_connections'] == 0

self.app.conf.redis_max_connections = 10
x = self.Backend('redis://:bosco@vandelay.com:123//1', app=self.app)
assert x.connparams['max_connections'] == 10


class test_RedisBackend_chords_complex(basetest_RedisBackend):
@pytest.fixture(scope="function", autouse=True)
Expand Down

0 comments on commit ce4580d

Please sign in to comment.