diff options
author | ulya-sidorina <yulia@ydb.tech> | 2023-05-25 15:31:43 +0300 |
---|---|---|
committer | ulya-sidorina <yulia@ydb.tech> | 2023-05-25 15:31:43 +0300 |
commit | 76e6a533c40affcd3251af43d87a5b485fe09431 (patch) | |
tree | fbfc35f0e108e7fae7adcfe08a359e1e7611009d | |
parent | b6e5ec8493b3bdae3ab35746270b828b5dcf9aa2 (diff) | |
download | ydb-76e6a533c40affcd3251af43d87a5b485fe09431.tar.gz |
add pg tests with immediate effects
test(api): add pg test with immediate effects
-rw-r--r-- | ydb/tests/functional/api/test_isolation.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ydb/tests/functional/api/test_isolation.py b/ydb/tests/functional/api/test_isolation.py index bb5ef73cb75..1b58b39cf69 100644 --- a/ydb/tests/functional/api/test_isolation.py +++ b/ydb/tests/functional/api/test_isolation.py @@ -160,6 +160,41 @@ class TestTransactionIsolation(object): ) t2.commit() + def test_prevents_circular_information_flow_g1c(self): + table_name, session = self._prepare("test_prevents_circular_information_flow_g1c") + + t1 = session.transaction() + t2 = session.transaction() + + t1.execute('update {} set value = 11 where id = 1;'.format(table_name)) + t2.execute('update {} set value = 22 where id = 2;'.format(table_name)) + + result_rows = t1.execute('select * from {} where id = 2;'.format(table_name)) + assert_that( + result_rows[0].rows, + equal_to( + [ + {'id': 2, 'value': 20}, + ] + ) + ) + + result_rows = t2.execute('select * from {} where id = 1;'.format(table_name)) + assert_that( + result_rows[0].rows, + equal_to( + [ + {'id': 1, 'value': 10}, + ] + ) + ) + + t1.commit() + try: + t2.commit() + except ydb.Aborted as e: + assert_that(str(e), contains_string("Transaction locks invalidated")) + def test_isolation_mailing_list_example(self): table_name, session = self._prepare("test_isolation_mailing_list_example") @@ -278,6 +313,22 @@ class TestTransactionIsolation(object): else: assert_that(result_rows[0].rows, equal_to([])) + def test_does_not_prevent_predicate_many_preceders_pmp_for_write_predicates(self): + table_name, session = self._prepare("test_does_not_prevent_predicate_many_preceders_pmp_for_write_predicates") + + t1 = session.transaction() + t2 = session.transaction() + + t1.execute('update {} set value = value + 10;'.format(table_name)) + t2.execute('delete from {} where value = 20;'.format(table_name)) + + t1.commit() + + try: + t2.commit() + except ydb.Aborted as e: + assert_that(str(e), contains_string("Transaction locks invalidated")) + def test_lost_update_p4(self): table_name, session = self._prepare("test_lost_update_p4") |