|
14 | 14 | rdb = read_test_rdb('database_empty.rdb', options)
|
15 | 15 |
|
16 | 16 | events = [
|
17 |
| - [:start_rdb, [3]], |
| 17 | + [:start_rdb, [6]], |
18 | 18 | [:end_rdb, []],
|
19 | 19 | ]
|
20 | 20 |
|
|
61 | 61 | rdb = read_test_rdb('keys_with_expiration.rdb', options)
|
62 | 62 |
|
63 | 63 | events = [
|
64 |
| - [:start_rdb, [3]], |
| 64 | + [:start_rdb, [4]], |
65 | 65 | [:start_database, [0]],
|
66 |
| - [:set, ['expires_ms_precision', '2022-12-25 10:11:12.000573']], |
67 |
| - [:pexpireat, ['expires_ms_precision', 1671943272573000]], |
| 66 | + [:set, ['expires_ms_precision', '2022-12-25 10:11:12.573 UTC']], |
| 67 | + [:pexpireat, ['expires_ms_precision', 1671963072573000]], |
68 | 68 | [:end_database, [0]],
|
69 | 69 | [:end_rdb, []],
|
70 | 70 | ]
|
71 | 71 |
|
72 | 72 | assert events == rdb.events
|
| 73 | + assert Time.parse(rdb.events[2][1][1]) == pexpireat_to_time(rdb.events[3][1][1]) |
73 | 74 | end
|
74 | 75 |
|
75 | 76 | test 'should read LZF-compressed key strings' do |options|
|
|
118 | 119 | rdb = read_test_rdb('list_of_integers_as_ziplist.rdb', options)
|
119 | 120 |
|
120 | 121 | events = [
|
121 |
| - [:start_rdb, [3]], |
| 122 | + [:start_rdb, [6]], |
122 | 123 | [:start_database, [0]],
|
123 |
| - [:start_list, ['ziplist_with_integers', 4]], |
| 124 | + [:start_list, ['ziplist_with_integers', 24]], |
| 125 | + [:rpush, ['ziplist_with_integers', 0]], |
| 126 | + [:rpush, ['ziplist_with_integers', 1]], |
| 127 | + [:rpush, ['ziplist_with_integers', 2]], |
| 128 | + [:rpush, ['ziplist_with_integers', 3]], |
| 129 | + [:rpush, ['ziplist_with_integers', 4]], |
| 130 | + [:rpush, ['ziplist_with_integers', 5]], |
| 131 | + [:rpush, ['ziplist_with_integers', 6]], |
| 132 | + [:rpush, ['ziplist_with_integers', 7]], |
| 133 | + [:rpush, ['ziplist_with_integers', 8]], |
| 134 | + [:rpush, ['ziplist_with_integers', 9]], |
| 135 | + [:rpush, ['ziplist_with_integers', 10]], |
| 136 | + [:rpush, ['ziplist_with_integers', 11]], |
| 137 | + [:rpush, ['ziplist_with_integers', 12]], |
| 138 | + [:rpush, ['ziplist_with_integers', -2]], |
| 139 | + [:rpush, ['ziplist_with_integers', 13]], |
| 140 | + [:rpush, ['ziplist_with_integers', 25]], |
| 141 | + [:rpush, ['ziplist_with_integers', -61]], |
124 | 142 | [:rpush, ['ziplist_with_integers', 63]],
|
125 | 143 | [:rpush, ['ziplist_with_integers', 16380]],
|
126 |
| - [:rpush, ['ziplist_with_integers', 65535]], |
| 144 | + [:rpush, ['ziplist_with_integers', 49536]], |
| 145 | + [:rpush, ['ziplist_with_integers', 16777008]], |
| 146 | + [:rpush, ['ziplist_with_integers', -16773840]], |
| 147 | + [:rpush, ['ziplist_with_integers', 1073741872]], |
127 | 148 | [:rpush, ['ziplist_with_integers', 9223372036854775807]],
|
128 | 149 | [:end_list, ['ziplist_with_integers']],
|
129 | 150 | [:end_database, [0]],
|
|
341 | 362 | assert events == rdb.events
|
342 | 363 | end
|
343 | 364 |
|
| 365 | +test 'should handle hashes with values between 253 and 255 bytes encoded as zipmaps' do |options| |
| 366 | + rdb = read_test_rdb('hash_with_big_values.rdb', options) |
| 367 | + |
| 368 | + events = [ |
| 369 | + [:start_rdb, [2]], |
| 370 | + [:start_database, [0]], |
| 371 | + [:start_hash, ['zipmap_with_big_values', 4]], |
| 372 | + [:hset, ['zipmap_with_big_values', '253bytes', 'NYKK5QA4TDYJFZH0FCVT39DWI89IH7HV9HV162MULYY9S6H67MGS6YZJ54Q2NISW'+ |
| 373 | + '9U69VC6ZK3OJV6J095P0P5YNSEHGCBJGYNZ8BPK3GEFBB8ZMGPT2Y33WNSETHINM'+ |
| 374 | + 'SZ4VKWUE8CXE0Y9FO7L5ZZ02EO26TLXF5NUQ0KMA98973QY62ZO1M1WDDZNS25F3'+ |
| 375 | + '7KGBQ8W4R5V1YJRR2XNSQKZ4VY7GW6X038UYQG30ZM0JY1NNMJ12BKQPF2IDQ']], |
| 376 | + [:hset, ['zipmap_with_big_values', '254bytes', 'IZ3PNCQQV5RG4XOAXDN7IPWJKEK0LWRARBE3393UYD89PSQFC40AG4RCNW2M4YAV'+ |
| 377 | + 'JR0WD8AVO2F8KFDGUV0TGU8GF8M2HZLZ9RDX6V0XKIOXJJ3EMWQGFEY7E56RAOPT'+ |
| 378 | + 'A60G6SQRZ59ZBUKA6OMEW3K0LH464C7XKAX3K8AXDUX63VGX99JDCW1W2KTXPQRN'+ |
| 379 | + '1R1PY5LXNXPW7AAIYUM2PUKN2YN2MXWS5HR8TPMKYJIFTLK2DNQNGTVAWMULON']], |
| 380 | + [:hset, ['zipmap_with_big_values', '255bytes', '6EUW8XSNBHMEPY991GZVZH4ITUQVKXQYL7UBYS614RDQSE7BDRUW00M6Y4W6WUQB'+ |
| 381 | + 'DFVHH6V2EIAEQGLV72K4UY7XXKL6K6XH6IN4QVS15GU1AAH9UI40UXEA8IZ5CZRR'+ |
| 382 | + 'K6SAV3R3X283O2OO9KG4K0DG0HZX1MLFDQHXGCC96M9YUVKXOEC5X35Q4EKET0SD'+ |
| 383 | + 'FDSBF1QKGAVS9202EL7MP2KPOYAUKU1SZJW5OP30WAPSM9OG97EBHW2XOWGICZG']], |
| 384 | + [:hset, ['zipmap_with_big_values', '300bytes', 'IJXP54329MQ96A2M28QF6SFX3XGNWGAII3M32MSIMR0O478AMZKNXDUYD5JGMHJR'+ |
| 385 | + 'B9A85RZ3DC3AIS62YSDW2BDJ97IBSH7FKOVFWKJYS7XBMIBX0Z1WNLQRY7D27PFP'+ |
| 386 | + 'BBGBDFDCKL0FIOBYEADX6G5UK3B0XYMGS0379GRY6F0FY5Q9JUCJLGOGDNNP8XW3'+ |
| 387 | + 'SJX2L872UJZZL8G871G9THKYQ2WKPFEBIHOOTIGDNWC15NL5324W8FYDP97JHKCS'+ |
| 388 | + 'MLWXNMSTYIUE7F22ZGR4NZK3T0UTBZ2AFRCT5LMT3P6B']], |
| 389 | + [:end_hash, ['zipmap_with_big_values']], |
| 390 | + [:end_database, [0]], |
| 391 | + [:end_rdb, []], |
| 392 | + ] |
| 393 | + |
| 394 | + assert events == rdb.events |
| 395 | +end |
| 396 | + |
344 | 397 | test 'should filter top-level objects before raising events' do |options|
|
345 | 398 | options[:callbacks].filter = lambda do |state|
|
346 | 399 | state.database == 2 && state.key.match(/second/) && state.key_type == :string
|
|
0 commit comments