summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test/suite/test_inmem01.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/test/suite/test_inmem01.py')
-rw-r--r--src/third_party/wiredtiger/test/suite/test_inmem01.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_inmem01.py b/src/third_party/wiredtiger/test/suite/test_inmem01.py
index c6ae7ff6c4b..1af43bbd9d9 100644
--- a/src/third_party/wiredtiger/test/suite/test_inmem01.py
+++ b/src/third_party/wiredtiger/test/suite/test_inmem01.py
@@ -28,8 +28,7 @@
import wiredtiger, wttest
from time import sleep
-from helper import simple_populate, simple_populate_check
-from helper import key_populate, value_populate
+from wtdataset import SimpleDataSet
from wtscenario import make_scenarios
# test_inmem01.py
@@ -41,54 +40,60 @@ class test_inmem01(wttest.WiredTigerTestCase):
table_config = ',memory_page_max=32k,leaf_page_max=4k'
scenarios = make_scenarios([
- ('col', dict(fmt='key_format=r,value_format=S')),
- ('fix', dict(fmt='key_format=r,value_format=8t')),
- ('row', dict(fmt='key_format=S,value_format=S'))
+ ('col', dict(keyfmt='r', valuefmt='S')),
+ ('fix', dict(keyfmt='r', valuefmt='8t')),
+ ('row', dict(keyfmt='S', valuefmt='S')),
])
# Smoke-test in-memory configurations, add a small amount of data and
# ensure it's visible.
def test_insert(self):
- config = self.fmt + self.table_config
- simple_populate(self, self.uri, config, 1000)
- simple_populate_check(self, self.uri, 1000)
+ ds = SimpleDataSet(self, self.uri, 1000, key_format=self.keyfmt,
+ value_format=self.valuefmt, config=self.table_config)
+ ds.populate()
+ ds.check()
# Add more data than fits into the configured cache and verify it fails.
def test_insert_over_capacity(self):
- config = self.fmt + self.table_config
msg = '/WT_CACHE_FULL.*/'
+ ds = SimpleDataSet(self, self.uri, 10000000, key_format=self.keyfmt,
+ value_format=self.valuefmt, config=self.table_config)
self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
- lambda:simple_populate(self, self.uri, config, 10000000), msg)
+ lambda:ds.populate(), msg)
# Figure out the last key we successfully inserted, and check all
# previous inserts are still there.
cursor = self.session.open_cursor(self.uri, None)
cursor.prev()
last_key = int(cursor.get_key())
- simple_populate_check(self, self.uri, last_key)
+ ds = SimpleDataSet(self, self.uri, last_key, key_format=self.keyfmt,
+ value_format=self.valuefmt, config=self.table_config)
+ ds.check()
# Fill the cache with data, remove some data, ensure more data can be
# inserted (after a reasonable amount of time for space to be reclaimed).
def test_insert_over_delete(self):
- config = self.fmt + self.table_config
msg = '/WT_CACHE_FULL.*/'
+ ds = SimpleDataSet(self, self.uri, 10000000, key_format=self.keyfmt,
+ value_format=self.valuefmt, config=self.table_config)
self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
- lambda:simple_populate(self, self.uri, config, 10000000), msg)
+ lambda:ds.populate(), msg)
# Now that the database contains as much data as will fit into
# the configured cache, verify removes succeed.
cursor = self.session.open_cursor(self.uri, None)
for i in range(1, 100):
- cursor.set_key(key_populate(cursor, i))
+ cursor.set_key(ds.key(i))
cursor.remove()
# Run queries after adding, removing and re-inserting data.
# Try out keeping a cursor open while adding new data.
def test_insert_over_delete_replace(self):
- config = self.fmt + self.table_config
msg = '/WT_CACHE_FULL.*/'
+ ds = SimpleDataSet(self, self.uri, 10000000, key_format=self.keyfmt,
+ value_format=self.valuefmt, config=self.table_config)
self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
- lambda:simple_populate(self, self.uri, config, 10000000), msg)
+ lambda:ds.populate(), msg)
cursor = self.session.open_cursor(self.uri, None)
cursor.prev()
@@ -98,7 +103,7 @@ class test_inmem01(wttest.WiredTigerTestCase):
# the configured cache, verify removes succeed.
cursor = self.session.open_cursor(self.uri, None)
for i in range(1, last_key / 4, 1):
- cursor.set_key(key_populate(cursor, i))
+ cursor.set_key(ds.key(i))
cursor.remove()
cursor.reset()
@@ -106,7 +111,7 @@ class test_inmem01(wttest.WiredTigerTestCase):
inserted = False
for i in range(1, 1000):
try:
- cursor[key_populate(cursor, 1)] = value_populate(cursor, 1)
+ cursor[ds.key(1)] = ds.value(1)
except wiredtiger.WiredTigerError:
cursor.reset()
sleep(1)