-
-
Save elliotchance/058f750fcc479dcbc40d1cd71c902596 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DirtyRead(TransactionTest): | |
def run(self): | |
result1 = self.client1.fetch_record(id=1) | |
self.client2.update_record(id=1, name="Joe 2") | |
result2 = self.client1.fetch_record(id=1) | |
return result1 != result2 | |
class NonRepeatableRead(TransactionTest): | |
def run(self): | |
result1 = self.client1.fetch_record(id=1) | |
self.client2.update_record(id=1, name="Joe 2") | |
self.client2.commit() | |
result2 = self.client1.fetch_record(id=1) | |
return result1 != result2 | |
class PhantomRead(TransactionTest): | |
def run(self): | |
result1 = len(self.client1.fetch(lambda r: 1 <= r['id'] <= 3)) | |
self.client2.add_record(id=2, name="John") | |
self.client2.commit() | |
result2 = self.client1.count_records(min_id=1, max_id=3) | |
return result1 != result2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment