Beispiel #1
0
        #cursor.reset()
        #for key, value in cursor:
        #    print('key: ' + str(key))
        #    print('value: ' + str(value))

        cursor.set_key(self.genkey(0))
        cmp = cursor.search_near()
        if self.tablekind != 'fix':
            self.assertEqual(cmp, 1)
            self.assertEqual(cursor.get_key(), self.genkey(1))
            self.assertEqual(cursor.get_value(), self.genvalue(1))
        else:
            self.assertEqual(cmp, 0)
            self.assertEqual(cursor.get_key(), self.genkey(0))
            self.assertEqual(cursor.get_value(), 0)
            
        cursor.set_key(self.genkey(5))
        self.expect_either(cursor, 4, 6)

        cursor.set_key(self.genkey(9))
        self.expect_either(cursor, 8, 11)

        cursor.set_key(self.genkey(10))
        self.expect_either(cursor, 8, 11)

        cursor.close()

if __name__ == '__main__':
    wttest.run()
Beispiel #2
0
# Put the tests in a class that doesn't inherit from unittest.TestCase so
# they will only be called by the concrete subclasses with real implementations.
#
# It doesn't make sense to call test_compress01_base.test_insert_and_verify --
# this is how to avoid that.
class compress01_tests(object):
    def test_insert_and_verify(self):
        self.do_insert()
        # We want a fresh cache so compressed pages are read from disk. 
        self.reopen_conn()
        self.do_verify()


class test_compress01_1_nop(test_compress01_base, compress01_tests):
    def __init__(self, testname):
        test_compress01_base.__init__(self, testname, 'nop_compress', 'nop')

class test_compress01_2_bz(test_compress01_base, compress01_tests):
    def __init__(self, testname):
        test_compress01_base.__init__(self, testname, 'bzip2_compress', 'bz')

class test_compress01_3_sn(test_compress01_base, compress01_tests):
    def __init__(self, testname):
        test_compress01_base.__init__(self, testname, 'snappy_compress', 'sn')


if __name__ == '__main__':
    wttest.run(test_compress01_1_nop)
    wttest.run(test_compress01_2_bz)
    wttest.run(test_compress01_3_sn)
Beispiel #3
0
            return ''

    # override WiredTigerTestCase
    def setUpConnectionOpen(self, dir):
        return self.setUpConnectionWithExtension(dir, self.compressor_name)
        
    def setUpConnectionWithExtension(self, dir, name):
        conn = wiredtiger.wiredtiger_open(dir, 'create,' + self.extensionArg(name))
        self.pr(`conn`)
        return conn


class test_compress01_1_nop(test_compress01_base):
    def __init__(self, testname):
        test_compress01_base.__init__(self, testname, 'nop_compress', 'nop')


class test_compress01_2_bz(test_compress01_base):
    def __init__(self, testname):
        test_compress01_base.__init__(self, testname, 'bzip2_compress', 'bz')

class test_compress01_3_sn(test_compress01_base):
    def __init__(self, testname):
        test_compress01_base.__init__(self, testname, 'snappy_compress', 'sn')


if __name__ == '__main__':
    wttest.run(test_compress01_base)
    wttest.run(test_compress01_1_nop)
    wttest.run(test_compress01_2_bz)
Beispiel #4
0
        # Scenario: 3
        # Check to see LAS working with modify operations.
        bigvalue3 = b"ccccc" * 100
        bigvalue3 = b'AA' + bigvalue3[2:]
        session2 = self.conn.open_session()
        session2.begin_transaction('isolation=snapshot')
        # Apply two modify operations - replacing the first two items with 'A'.
        self.session.begin_transaction()
        self.large_modifies(self.session, uri, 0, ds, nrows)
        self.large_modifies(self.session, uri, 1, ds, nrows)
        self.session.commit_transaction()
        # Check to see the value after recovery.
        self.durable_check(bigvalue3, uri, ds, nrows)
        session2.rollback_transaction()
        session2.close()

        # Scenario: 4
        # Check to see if LAS is working with the old timestamp.
        bigvalue4 = b"ddddd" * 100
        self.conn.set_timestamp('stable_timestamp=' + timestamp_str(1))
        self.large_updates(self.session, uri, bigvalue4, ds, nrows, timestamp=True)
        # Check to see data can be see only till the stable_timestamp
        self.durable_check(bigvalue3, uri, ds, nrows)

        self.conn.set_timestamp('stable_timestamp=' + timestamp_str(i + 1))
        # Check that the latest data can be seen.
        self.durable_check(bigvalue4, uri, ds, nrows)

if __name__ == '__main__':
    wttest.run()