File: do-not-test-with-old-lz4.patch

package info (click to toggle)
python-kafka 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,236 kB
  • sloc: python: 20,151; makefile: 215; sh: 62
file content (135 lines) | stat: -rw-r--r-- 5,484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Description: Do not test with old lz4
 These tests are failing. In the context of modern Sid/Buster, we probably
 don't really care testing legacy stuff.
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2018-09-07

--- python-kafka-1.4.3.orig/test/record/test_legacy_records.py
+++ python-kafka-1.4.3/test/record/test_legacy_records.py
@@ -32,8 +32,7 @@ def test_read_write_serde_v0_v1_no_compr
 @pytest.mark.parametrize("compression_type", [
     LegacyRecordBatch.CODEC_GZIP,
     LegacyRecordBatch.CODEC_SNAPPY,
-    LegacyRecordBatch.CODEC_LZ4
 ])
 @pytest.mark.parametrize("magic", [0, 1])
 def test_read_write_serde_v0_v1_with_compression(compression_type, magic):
     builder = LegacyRecordBatchBuilder(
@@ -172,7 +171,6 @@ def test_legacy_batch_size_limit(magic):
 @pytest.mark.parametrize("compression_type,name,checker_name", [
     (LegacyRecordBatch.CODEC_GZIP, "gzip", "has_gzip"),
     (LegacyRecordBatch.CODEC_SNAPPY, "snappy", "has_snappy"),
-    (LegacyRecordBatch.CODEC_LZ4, "lz4", "has_lz4")
 ])
 @pytest.mark.parametrize("magic", [0, 1])
 def test_unavailable_codec(magic, compression_type, name, checker_name):
--- a/test/record/test_records.py	2018-09-07 10:50:29.000000000 +0200
+++ b/test/record/test_records.py	2018-09-07 10:55:23.123697770 +0200
@@ -136,73 +136,6 @@
     assert records.next_batch() is None
 
 
-def test_memory_records_corrupt():
-    records = MemoryRecords(b"")
-    assert records.size_in_bytes() == 0
-    assert records.valid_bytes() == 0
-    assert records.has_next() is False
-
-    records = MemoryRecords(b"\x00\x00\x00")
-    assert records.size_in_bytes() == 3
-    assert records.valid_bytes() == 0
-    assert records.has_next() is False
-
-    records = MemoryRecords(
-        b"\x00\x00\x00\x00\x00\x00\x00\x03"  # Offset=3
-        b"\x00\x00\x00\x03"  # Length=3
-        b"\xfe\xb0\x1d",  # Some random bytes
-    )
-    with pytest.raises(CorruptRecordException):
-        records.next_batch()
-
-
-@pytest.mark.parametrize("compression_type", [0, 1, 2, 3])
-@pytest.mark.parametrize("magic", [0, 1, 2])
-def test_memory_records_builder(magic, compression_type):
-    builder = MemoryRecordsBuilder(
-        magic=magic, compression_type=compression_type, batch_size=1024 * 10)
-    base_size = builder.size_in_bytes()  # V2 has a header before
-
-    msg_sizes = []
-    for offset in range(10):
-        metadata = builder.append(
-            timestamp=10000 + offset, key=b"test", value=b"Super")
-        msg_sizes.append(metadata.size)
-        assert metadata.offset == offset
-        if magic > 0:
-            assert metadata.timestamp == 10000 + offset
-        else:
-            assert metadata.timestamp == -1
-        assert builder.next_offset() == offset + 1
-
-    # Error appends should not leave junk behind, like null bytes or something
-    with pytest.raises(TypeError):
-        builder.append(
-            timestamp=None, key="test", value="Super")  # Not bytes, but str
-
-    assert not builder.is_full()
-    size_before_close = builder.size_in_bytes()
-    assert size_before_close == sum(msg_sizes) + base_size
-
-    # Size should remain the same after closing. No traling bytes
-    builder.close()
-    assert builder.compression_rate() > 0
-    expected_size = size_before_close * builder.compression_rate()
-    assert builder.is_full()
-    assert builder.size_in_bytes() == expected_size
-    buffer = builder.buffer()
-    assert len(buffer) == expected_size
-
-    # We can close second time, as in retry
-    builder.close()
-    assert builder.size_in_bytes() == expected_size
-    assert builder.buffer() == buffer
-
-    # Can't append after close
-    meta = builder.append(timestamp=None, key=b"test", value=b"Super")
-    assert meta is None
-
-
 @pytest.mark.parametrize("compression_type", [0, 1, 2, 3])
 @pytest.mark.parametrize("magic", [0, 1, 2])
 def test_memory_records_builder_full(magic, compression_type):
--- a/test/record/test_util.py	2018-09-07 10:14:37.871217836 +0200
+++ b/test/record/test_util.py	2018-09-07 10:56:47.160136019 +0200
@@ -67,30 +67,3 @@
 def test_size_of_varint(encoded, decoded):
     assert util.size_of_varint(decoded) == len(encoded)
 
-
-@pytest.mark.parametrize("crc32_func", [util.crc32c_c, util.crc32c_py])
-def test_crc32c(crc32_func):
-    def make_crc(data):
-        crc = crc32_func(data)
-        return struct.pack(">I", crc)
-    assert make_crc(b"") == b"\x00\x00\x00\x00"
-    assert make_crc(b"a") == b"\xc1\xd0\x43\x30"
-
-    # Took from librdkafka testcase
-    long_text = b"""\
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the author be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution."""
-    assert make_crc(long_text) == b"\x7d\xcd\xe1\x13"