-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Konstantin Knizhnik
committed
Jul 25, 2024
1 parent
18f5874
commit b20f670
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from fixtures.neon_fixtures import NeonEnvBuilder | ||
|
||
|
||
def test_combocid(neon_env_builder: NeonEnvBuilder): | ||
env = neon_env_builder.init_start() | ||
endpoint = env.endpoints.create_start("main") | ||
|
||
conn = endpoint.connect() | ||
cur = conn.cursor() | ||
n_records = 100000 | ||
|
||
cur.execute("create table t(id integer, val integer)") | ||
cur.execute(f"insert into t values (generate_series(1,{n_records}), 0)") | ||
|
||
cur.execute("begin") | ||
|
||
cur.execute("update t set val=val+1") | ||
assert cur.rowcount == n_records | ||
cur.execute("update t set val=val+1") | ||
assert cur.rowcount == n_records | ||
cur.execute("update t set val=val+1") | ||
assert cur.rowcount == n_records | ||
|
||
cur.execute("delete from t") | ||
assert cur.rowcount == n_records | ||
cur.execute("delete from t") | ||
assert cur.rowcount == 0 | ||
|
||
cur.execute(f"insert into t values (generate_series(1,{n_records}), 0)") | ||
cur.execute("update t set val=val+1") | ||
assert cur.rowcount == n_records | ||
cur.execute("update t set val=val+1") | ||
assert cur.rowcount == n_records | ||
cur.execute("update t set val=val+1") | ||
assert cur.rowcount == n_records | ||
|
||
cur.execute("rollback") |