summaryrefslogtreecommitdiff
path: root/test/suite/test_index01.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/suite/test_index01.py')
-rw-r--r--test/suite/test_index01.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/test/suite/test_index01.py b/test/suite/test_index01.py
index f2398fee5e8..bebeb191ef0 100644
--- a/test/suite/test_index01.py
+++ b/test/suite/test_index01.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Public Domain 2014-2015 MongoDB, Inc.
+# Public Domain 2014-2016 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
@@ -39,11 +39,6 @@ class test_index01(wttest.WiredTigerTestCase):
NUM_INDICES = 6
index = ['%s:index%d' % (indexbase, i) for i in xrange(NUM_INDICES)]
- def reopen(self):
- self.conn.close()
- self.conn = wiredtiger.wiredtiger_open('.', None)
- self.session = self.conn.open_session()
-
def create_table(self):
self.pr('create table')
self.session.create(self.tablename, 'key_format=Si,value_format=SSii,columns=(name,ID,dept,job,salary,year)')
@@ -222,5 +217,20 @@ class test_index01(wttest.WiredTigerTestCase):
self.assertEqual(list(self.index_iter(i)), [])
self.drop_table()
+ def test_exclusive(self):
+ '''Create indices, then try to create another index exclusively'''
+ self.create_table()
+ # non-exclusive recreate is allowed
+ self.session.create(self.index[0], 'columns=(dept)')
+ # exclusive recreate
+ self.assertRaises(wiredtiger.WiredTigerError,
+ lambda: self.session.create(self.index[0],
+ 'columns=(dept),exclusive'))
+ # non-exclusive create with differing configuration
+ self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
+ lambda: self.session.create(self.index[0],
+ 'columns=(salary)'), '/does not match existing configuration/')
+ self.drop_table()
+
if __name__ == '__main__':
wttest.run()