Skip to content

Commit 6c6375d

Browse files
committed
Test that write concern of {wtimeout: 1000} is same as {w: 1, wtimeout: 1000}.
1 parent ea24d81 commit 6c6375d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test_collection.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,19 @@ def test_duplicate_key_error(self):
10171017
else:
10181018
self.fail("%s was not raised" % (expected_error.__name__,))
10191019

1020+
def test_wtimeout(self):
1021+
# Ensure setting wtimeout doesn't disable write concern altogether.
1022+
# See SERVER-12596.
1023+
collection = self.db.test
1024+
collection.remove()
1025+
collection.insert({'_id': 1})
1026+
1027+
collection.write_concern = {'w': 1, 'wtimeout': 1000}
1028+
self.assertRaises(DuplicateKeyError, collection.insert, {'_id': 1})
1029+
1030+
collection.write_concern = {'wtimeout': 1000}
1031+
self.assertRaises(DuplicateKeyError, collection.insert, {'_id': 1})
1032+
10201033
def test_continue_on_error(self):
10211034
db = self.db
10221035
if not version.at_least(db.connection, (1, 9, 1)):

0 commit comments

Comments
 (0)