Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8fec502

Browse files
mykauldkropachev
authored andcommitted
Fix test_use_requested_compression() to use Protocol version 4
Per review comments, reverted the changes to test, but changed it to explicitly use v4 of the protocol.
1 parent 2371634 commit 8fec502

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎tests/unit/test_connection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
class ConnectionTest(unittest.TestCase):
3535

36-
def make_connection(self):
37-
c = Connection(DefaultEndPoint('1.2.3.4'))
36+
def make_connection(self, **kwargs):
37+
c = Connection(DefaultEndPoint('1.2.3.4'), **kwargs)
3838
c._socket = Mock()
3939
c._socket.send.side_effect = lambda x: len(x)
4040
return c
@@ -186,17 +186,18 @@ def test_requested_compression_not_available(self, *args):
186186
assert isinstance(args[0], ProtocolError)
187187

188188
def test_use_requested_compression(self, *args):
189-
c = self.make_connection()
189+
c = self.make_connection(protocol_version=4)
190190
c._requests = {0: (c._handle_options_response, ProtocolHandler.decode_message, [])}
191191
c.defunct = Mock()
192-
# request LZ4 compression
193-
c.compression = "lz4"
192+
# request snappy compression
193+
c.compression = "snappy"
194194

195195
locally_supported_compressions.pop('lz4', None)
196196
locally_supported_compressions.pop('snappy', None)
197197
locally_supported_compressions['lz4'] = ('lz4compress', 'lz4decompress')
198198
locally_supported_compressions['snappy'] = ('snappycompress', 'snappydecompress')
199199

200+
# the server only supports snappy
200201
options_buf = BytesIO()
201202
write_stringmultimap(options_buf, {
202203
'CQL_VERSION': ['3.0.3'],
@@ -206,8 +207,7 @@ def test_use_requested_compression(self, *args):
206207

207208
c.process_msg(_Frame(version=4, flags=0, stream=0, opcode=SupportedMessage.opcode, body_offset=9, end_pos=9 + len(options)), options)
208209

209-
210-
assert c.decompressor == locally_supported_compressions['lz4'][1]
210+
assert c.decompressor == locally_supported_compressions['snappy'][1]
211211

212212
def test_disable_compression(self, *args):
213213
c = self.make_connection()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /