Browse Source

Fix broken test that relied on improper zlib assumptions

This test assumed that zlib would always produce the same output for a
given input, and that assumption has proven incorrect. It rested on
zlib never improving. The zlib shipped in Clear Linux has algorithm
improvements, which caused this test to break.

This patch instead decompresses the expected value and compares that.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 575a348ce40a0388a541170c9031194dabf54f94)
Thiago Macieira 6 years ago
parent
commit
289b1279f9
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/borg/testsuite/hashindex.py

+ 2 - 1
src/borg/testsuite/hashindex.py

@@ -321,7 +321,8 @@ class HashIndexDataTestCase(BaseTestCase):
         idx1[H(2)] = 2**31 - 1, 0, 0
         idx1[H(2)] = 2**31 - 1, 0, 0
         idx1[H(3)] = 4294962296, 0, 0  # 4294962296 is -5000 interpreted as an uint32_t
         idx1[H(3)] = 4294962296, 0, 0  # 4294962296 is -5000 interpreted as an uint32_t
 
 
-        assert self._serialize_hashindex(idx1) == self.HASHINDEX
+        serialized = self._serialize_hashindex(idx1)
+        assert self._unpack(serialized) == self._unpack(self.HASHINDEX)
 
 
     def test_read_known_good(self):
     def test_read_known_good(self):
         idx1 = self._deserialize_hashindex(self.HASHINDEX)
         idx1 = self._deserialize_hashindex(self.HASHINDEX)