From cff908db09a2e60da2e51c16c02f4117799d8247 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Mon, 10 Mar 2014 12:11:46 -0700 Subject: [PATCH] fix ldb_test TtlPutGet test Summary: If the last byte of the timestamp is 0, the output value of the ttl db can cut off earlier. Change to compare hex format instead. Test Plan: this does not happen consistently, but it did not fail after the last 100 runs for i in {1..100}; do python ./tools/ldb_test.py; done Reviewers: igor, haobo Reviewed By: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D16725 --- tools/ldb_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/ldb_test.py b/tools/ldb_test.py index fe9a6c60a..4ee3d7fef 100644 --- a/tools/ldb_test.py +++ b/tools/ldb_test.py @@ -205,10 +205,12 @@ class LDBTestCase(unittest.TestCase): def testTtlPutGet(self): print "Running testTtlPutGet..." self.assertRunOK("put a1 b1 --ttl --create_if_missing", "OK") - self.assertRunOK("scan ", "a1 : b1", True) + self.assertRunOK("scan --hex", "0x6131 : 0x6231", True) self.assertRunOK("dump --ttl ", "a1 ==> b1", True) + self.assertRunOK("dump --hex --ttl ", + "0x6131 ==> 0x6231\nKeys in range: 1") self.assertRunOK("scan --hex --ttl", "0x6131 : 0x6231") - self.assertRunOK("get a1", "b1", True) + self.assertRunOK("get --value_hex a1", "0x6231", True) self.assertRunOK("get --ttl a1", "b1") self.assertRunOK("put a3 b3 --create_if_missing", "OK") # fails because timstamp's length is greater than value's