summaryrefslogtreecommitdiff
path: root/test/suite
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2016-01-01 17:03:57 -0500
committerKeith Bostic <keith@wiredtiger.com>2016-01-01 17:03:57 -0500
commit3e47f870e450daf2010f3d9b2e9d83455437d892 (patch)
tree29830ec20d74bdec5b109b4f75a92a7d0fe60b12 /test/suite
parentcbc6bc593d2de2311811c0661613d7eb930d2261 (diff)
downloadmongo-3e47f870e450daf2010f3d9b2e9d83455437d892.tar.gz
Add a smoke-test of the WT_SESSION.rebalance API.
Diffstat (limited to 'test/suite')
-rw-r--r--test/suite/test_rebalance.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/test/suite/test_rebalance.py b/test/suite/test_rebalance.py
new file mode 100644
index 00000000000..13dcc7f34dd
--- /dev/null
+++ b/test/suite/test_rebalance.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+# Public Domain 2014-2016 MongoDB, Inc.
+# Public Domain 2008-2014 WiredTiger, Inc.
+#
+# This is free and unencumbered software released into the public domain.
+#
+# Anyone is free to copy, modify, publish, use, compile, sell, or
+# distribute this software, either in source code form or as a compiled
+# binary, for any purpose, commercial or non-commercial, and by any
+# means.
+#
+# In jurisdictions that recognize copyright laws, the author or authors
+# of this software dedicate any and all copyright interest in the
+# software to the public domain. We make this dedication for the benefit
+# of the public at large and to the detriment of our heirs and
+# successors. We intend this dedication to be an overt act of
+# relinquishment in perpetuity of all present and future rights to this
+# software under copyright law.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+import os, time
+import wiredtiger, wttest
+from helper import complex_populate, simple_populate
+from wtscenario import check_scenarios
+
+# test_rebalance.py
+# session level rebalance operation
+class test_rebalance(wttest.WiredTigerTestCase):
+ name = 'test_rebalance'
+
+ scenarios = check_scenarios([
+ ('file', dict(uri='file:')),
+ ('table', dict(uri='table:'))
+ ])
+
+ # Populate an object, then rebalance it.
+ def rebalance(self, populate, with_cursor):
+ uri = self.uri + self.name
+ populate(self, uri, 'key_format=S', 10)
+
+ # Open cursors should cause failure.
+ if with_cursor:
+ cursor = self.session.open_cursor(uri, None, None)
+ self.assertRaises(wiredtiger.WiredTigerError,
+ lambda: self.session.drop(uri, None))
+ cursor.close()
+
+ self.session.rebalance(uri, None)
+ self.session.drop(uri)
+
+ # Test rebalance of an object.
+ def test_rebalance(self):
+ # Simple file or table object.
+ self.rebalance(simple_populate, False)
+ self.rebalance(simple_populate, True)
+
+ # A complex, multi-file table object.
+ if self.uri == "table:":
+ self.rebalance(complex_populate, False)
+ self.rebalance(complex_populate, True)
+
+
+if __name__ == '__main__':
+ wttest.run()