def test_lz4_compress_big_chunk(self): try: import lz4 # noqa pylint: disable=unused-import,import-outside-toplevel except ImportError: raise unittest.SkipTest("lz4 not installed, skip the test") yield self.insertTestData(self.backgroundData + self.testLogLines) line = 'xy' * 10000 self.db.master.config.logCompressionMethod = "lz4" self.assertEqual((yield self.db.logs.appendLog(201, line + '\n')), (7, 7)) def thd(conn): res = conn.execute( self.db.model.logchunks.select( whereclause=self.db.model.logchunks.c.first_line > 6)) row = res.fetchone() res.close() return dict(row) newRow = yield self.db.pool.do(thd) self.assertEqual( newRow, { 'logid': 201, 'first_line': 7, 'last_line': 7, 'content': logs.dumps_lz4(line.encode('utf-8')), 'compressed': 3 })
def test_lz4_compress_big_chunk(self): try: import lz4 # noqa pylint: disable=unused-import except ImportError: raise unittest.SkipTest("lz4 not installed, skip the test") yield self.insertTestData(self.backgroundData + self.testLogLines) line = u'xy' * 10000 self.db.master.config.logCompressionMethod = "lz4" self.assertEqual( (yield self.db.logs.appendLog(201, line + '\n')), (7, 7)) def thd(conn): res = conn.execute(self.db.model.logchunks.select( whereclause=self.db.model.logchunks.c.first_line > 6)) row = res.fetchone() res.close() return dict(row) newRow = yield self.db.pool.do(thd) self.assertEqual(newRow, { 'logid': 201, 'first_line': 7, 'last_line': 7, 'content': logs.dumps_lz4(line), 'compressed': 3})