diff options
author | Don Anderson <dda@ddanderson.com> | 2015-01-23 08:58:41 -0500 |
---|---|---|
committer | Don Anderson <dda@ddanderson.com> | 2015-01-23 08:58:41 -0500 |
commit | 014ef3fda7de90ea470ca686648f3fe5f38f2f81 (patch) | |
tree | a8ce6138fa625ae3a0aee669623248bf3149ceca | |
parent | 7d677aedfdcaa5458e900e556b662def460d0281 (diff) | |
download | mongo-014ef3fda7de90ea470ca686648f3fe5f38f2f81.tar.gz |
Enhance the drop test case to drop indices and drop with fresh sessions.
Refs #1567.
-rw-r--r-- | test/suite/helper.py | 5 | ||||
-rw-r--r-- | test/suite/test_drop.py | 32 |
2 files changed, 27 insertions, 10 deletions
diff --git a/test/suite/helper.py b/test/suite/helper.py index 21eac2359b6..36792433cb7 100644 --- a/test/suite/helper.py +++ b/test/suite/helper.py @@ -81,7 +81,7 @@ def confirm_does_not_exist(self, uri): self.pr('confirm_does_not_exist: ' + uri) self.assertRaises(wiredtiger.WiredTigerError, lambda: self.session.open_cursor(uri, None)) - self.assertEqual(glob.glob('*' + uri.split(":")[1] + '*'), [], + self.assertEqual(glob.glob('*' + uri.split(":")[-1] + '*'), [], 'confirm_does_not_exist: URI exists, file name matching \"' + uri.split(":")[1] + '\" found') @@ -204,6 +204,9 @@ def complex_populate_type(self, uri, config, rows, type): cursor.insert() cursor.close() +def complex_populate_index_name(self, uri): + return 'index:' + uri.split(":")[1] + ':indx1' + def complex_populate_check_cursor(self, cursor, rows): i = 0 for key, s1, i2, s3, s4 in cursor: diff --git a/test/suite/test_drop.py b/test/suite/test_drop.py index 1daafb72db1..b87760f077e 100644 --- a/test/suite/test_drop.py +++ b/test/suite/test_drop.py @@ -28,7 +28,8 @@ import os, time import wiredtiger, wttest -from helper import confirm_does_not_exist, complex_populate, simple_populate +from helper import confirm_does_not_exist, complex_populate, \ + complex_populate_index_name, simple_populate # test_drop.py # session level drop operation @@ -44,7 +45,7 @@ class test_drop(wttest.WiredTigerTestCase): ] # Populate an object, remove it and confirm it no longer exists. - def drop(self, populate, with_cursor): + def drop(self, populate, with_cursor, close_session, drop_index): uri = self.uri + self.name populate(self, uri, 'key_format=S' + self.extra_config, 10) @@ -55,19 +56,33 @@ class test_drop(wttest.WiredTigerTestCase): lambda: self.session.drop(uri, None)) cursor.close() - self.session.drop(uri, None) - confirm_does_not_exist(self, uri) + if close_session: + self.reopen_conn() + + if drop_index: + drop_uri = complex_populate_index_name(self, uri) + else: + drop_uri = uri + self.session.drop(drop_uri, None) + confirm_does_not_exist(self, drop_uri) # Test drop of an object. def test_drop(self): # Simple file or table object. - self.drop(simple_populate, False) - self.drop(simple_populate, True) + # Try all combinations except dropping the index, the simple + # case has no indices. + for with_cursor in [False, True]: + for close_session in [False, True]: + self.drop(simple_populate, with_cursor, close_session, False) # A complex, multi-file table object. + # Try all test combinations. if self.uri == "table:": - self.drop(complex_populate, False) - self.drop(complex_populate, True) + for with_cursor in [False, True]: + for close_session in [False, True]: + for drop_index in [False, True]: + self.drop(complex_populate, with_cursor, + close_session, drop_index) # Test drop of a non-existent object: force succeeds, without force fails. def test_drop_dne(self): @@ -89,6 +104,5 @@ class test_drop(wttest.WiredTigerTestCase): self.assertRaises( wiredtiger.WiredTigerError, lambda: self.session.drop(lsmuri, None)) - if __name__ == '__main__': wttest.run() |